using web service login in moodle 2.2.1 oktech

using web service login in moodle 2.2.1 oktech

by Nelson Gomez -
Number of replies: 2

using web service login in moodle 2.2.1 oktech
good evening, thank you please help.

Moodle 2.2.1 Install, configure the Web service through notifications, enable the service. among others.

got on my file server with all its contents WSPP.
I go to my external application to use the same code using version 1.9 FORMOODLE. (FOR THIS VERSION worked perfectly)

START A login! THROUGH THIS CODE:

string UsernameADM = "user";
string PasswordADM = "pass";

Note: user and pass is the administrator total in moodle 2.2.1

MoodleWS MyWebServices = new MoodleWS();
loginReturn _loginReturn = MyWebServices.login(UsernameADM, PasswordADM);  

loginReturn _loginReturn = MyWebServices.login(UsernameADM, PasswordADM); HERE IN THIS LINE THROWS ME AN ERROR WHICH EXPOSE ON THE FINAL

try
{
_loginReturn = MyWebServices.login(UsernameADM, PasswordADM);
string client = _loginReturn.client.ToString();
string sessionkey = _loginReturn.sessionkey;

.

.

.

}

---------------------------------------------------

<! DOCTYPE html PUBLIC "- / / W3C / / DTD XHTML 1.0 Strict / / EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
xmlns="http://www.w3.org/1999/xhtml" <html lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="refresh" content="3; url=http://adiestrawebadistancia.com" />
<title> Redirect </ title>
</ Head> <body> <div style = "margin-top: 6em; margin-left: auto; margin-right: auto; color: # 990000; text-align: center; font-size: large; border-width : 1px;
border-color: black; background-color: # ffffee; border-style: solid, border-radius: 20px; border-collapse: collapse;
width: 80%;-moz-border-radius: 20px; padding: 15px ">
Incorrect access detected, may be accessed this server only through "http://adiestrawebadistancia.com" address, sorry. <br /> Please notify server administrator.
</ Div> <! DOCTYPE html PUBLIC "- / / W3C / / DTD XHTML 1.0 Strict / / EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
xmlns="http://www.w3.org/1999/xhtml" <html lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title> Redirect </ title>
</ Head> <div style="margin-top: <body> 3em; margin-left:auto; margin-right:auto; text-align:center;"> This page Should Automatically redirect. If nothing is happening Please use the link below continue. <br /> <a Href="http://adiestrawebadistancia.com"> Continue </ a> </ div> </ body> </ html> </ body> </ html>
-.
 
I'M DOING WRONG?
I'M WITH THE ADMINISTRATOR logging to MOODLE TOTAL

PLEASE HELP...
Average of ratings: -
In reply to Nelson Gomez

Re: using web service login in moodle 2.2.1 oktech

by Patrick Pollet -

Nelson,

   The error message is clear. The URL you are using to call the Web Service (as defined in your client code) dose not match EXACTLY the value of  $CFG->wwwroot = 'http://yourmoodle20';  as defined in the script config.php.

This is a standard error checking of Moodle. 

Check the value your are using in the constructor of your class MoodleWS() 

Cheers.

 

Please note that if you use the historical login method of OK Tech WS, you do not need to install it under local/oktech and go to Notifications and the rest of it... 

 

 

In reply to Patrick Pollet

Re: using web service login in moodle 2.2.1 oktech

by Nelson Gomez -
patrick hello thank you very much for responding, 

In fact I went to config.php and check the root, then change everything 
related to the URL and run the application. 

It turns out that the previous message disappeared, and now shows another error: 

SOAP-ERROR: Parsing WSDL: Couldn't load from '/home/adiestra/moodledata/wspp/moodlews.wsdl' : failed to load external entity "/home/adiestra/moodledata/wspp/moodlews.wsdl"

Can you please help me solve this. 
I deeply appreciate the support friend. 

I await your valuable feedback, you can not imagine how much I have helped ...