ASP.NET/Web services error

ASP.NET/Web services error

by Catalin Maican -
Number of replies: 7
Hi,
I'm trying to use Web Services to integrate an ASP.NET portal with Moodle. However, when I try to add a web reference in Visual Studio 2005 to a Moodle Web Service, it gives me the following error:

The document at the url http://SERVER/ver16/ws/service.php?type=soap&wsdl was not recognized as a known document type.
The error message from each known type may help you fix the problem:
- Report from 'DISCO Document' is 'Discovery document at the URL http://SERVER/ver16/ws/service.php?type=soap&wsdl could not be found.'.
- The document format is not recognized.
- Report from 'WSDL Document' is 'There is an error in XML document (240, 4).'.
- The element was not expected in this context: <xsd:add xmlns:xsd='http://www.w3.org/2001/XMLSchema'>..</xsd:add>;. Expected elements: http://www.w3.org/2001/XMLSchema:annotation, http://www.w3.org/2001/XMLSchema:complexContent, http://www.w3.org/2001/XMLSchema:simpleContent, http://www.w3.org/2001/XMLSchema:group, http://www.w3.org/2001/XMLSchema:sequence, http://www.w3.org/2001/XMLSchema:choice, http://www.w3.org/2001/XMLSchema:all, http://www.w3.org/2001/XMLSchema:attribute, http://www.w3.org/2001/XMLSchema:attributeGroup, http://www.w3.org/2001/XMLSchema:anyAttribute.
- Report from 'XML Schema' is 'The root element of a W3C XML Schema should be <schema> and its namespace should be 'http://www.w3.org/2001/XMLSchema'.'.

I think that WS are the best integration (maybe along with AJAX) between the two platforms... but I have to solve the errors first smile

Please help ?

Thanks, Catalin
Average of ratings: -
In reply to Catalin Maican

Re: ASP.NET/Web services error

by Justin Filip -
Hi Catalin,

Is this running on Moodle 1.8 beta and what version of PHP is running on the server?
In reply to Justin Filip

Re: ASP.NET/Web services error

by Catalin Maican -

Hi,

it is moodle 1.6 on a linux server... Does it matter if PHP has been "built" using the SOAP extenssions ?

I have tried with 1.8 on Windows 2003 and SqlServer 2005/ODBC but I couldn't get the Web services to work...

On this development box I want to use ASP.NET in combination with Moodle.

Thanks,

Catalin

In reply to Catalin Maican

Re: ASP.NET/Web services error

by Catalin Maican -
BTW: when I try the ws-test.php, I get the following error (I presume)

Attempting to create a server connection...

Client connected...

<h2>Login:</h2>

Sent server call...

Error: HTTP Error: no data present after HTTP headers

<h2>Logout:</h2>

Sent server call...

Error: HTTP Error: no data present after HTTP headers


Probably the authentication is not performed...even I try with the Moodle Admin...

Also, I have examined the Server.class.php... Is this file supposed to create some tables in the DB, because I cannot find them...

Catalin

In reply to Catalin Maican

Re: ASP.NET/Web services error

by Catalin Maican -
I've deleted 2 elements with "errors" underlined in VS 2005 in the moodlews.wsdl file...
Now, when I try to generate the proxy using the wsdl.exe, I get the following errors:

Warning: This web reference does not conform to WS-I Basic Profile v1.1.
R2706: A wsdl:binding in a DESCRIPTION MUST use the value of "literal" for the use attribute in all soapbind:body, soapbind:fault, soapbind:header and soapbind:headerfault elements.
- Input element soapbind:body of operation 'soapserver.login' on portType 'MoodleWSBinding' from namespace 'http://econ.unitbv.ro/elearning/ws/wsdl'.
- Output element soapbind:body of operation 'soapserver.login' on portType 'MoodleWSBinding' from namespace 'http://econ.unitbv.ro/elearning/ws/wsdl'.
- Input element soapbind:body of operation 'soapserver.logout' on portType 'MoodleWSBinding' from namespace 'http://econ.unitbv.ro/elearning/ws/wsdl'.
- Output element soapbind:body of operation 'soapserver.logout' on portType 'MoodleWSBinding' from namespace 'http://econ.unitbv.ro/elearning/ws/wsdl'.
- Input element soapbind:body of operation 'soapserver.edit_user' on portType 'MoodleWSBinding' from namespace 'http://econ.unitbv.ro/elearning/ws/wsdl'.
- Output element soapbind:body of operation 'soapserver.edit_user' on portType 'MoodleWSBinding' from namespace 'http://econ.unitbv.ro/elearning/ws/wsdl'.
- Input element soapbind:body of operation 'soapserver.get_user' on portType 'MoodleWSBinding' from namespace 'http://econ.unitbv.ro/elearning/ws/wsdl'.
- Output element soapbind:body of operation 'soapserver.get_user' on portType 'MoodleWSBinding' from namespace 'http://econ.unitbv.ro/elearning/ws/wsdl'.
- Input element soapbind:body of operation 'soapserver.edit_course' on portType 'MoodleWSBinding' from namespace 'http://econ.unitbv.ro/elearning/ws/wsdl'.
- Output element soapbind:body of operation 'soapserver.edit_course' on portType 'MoodleWSBinding' from namespace 'http://econ.unitbv.ro/elearning/ws/wsdl'.

- Input element soapbind:body of operation 'soapserver.get_course' on portType 'MoodleWSBinding' from namespace 'http://econ.unitbv.ro/elearning/ws/wsdl'.
- Output element soapbind:body of operation 'soapserver.get_course' on portType 'MoodleWSBinding' from namespace 'http://econ.unitbv.ro/elearning/ws/wsdl'.
- Input element soapbind:body of operation 'soapserver.get_grades' on portType 'MoodleWSBinding' from namespace 'http://econ.unitbv.ro/elearning/ws/wsdl'.
- Output element soapbind:body of operation 'soapserver.get_grades' on portType 'MoodleWSBinding' from namespace 'http://econ.unitbv.ro/elearning/ws/wsdl'.
- Input element soapbind:body of operation 'soapserver.enrol_students' on portType 'MoodleWSBinding' from namespace 'http://econ.unitbv.ro/elearning/ws/wsdl'.
- Output element soapbind:body of operation 'soapserver.enrol_students' on portType 'MoodleWSBinding' from namespace 'http://econ.unitbv.ro/elearning/ws/wsdl'.

For more details on the WS-I Basic Profile v1.1, see the specification
at http://www.ws-i.org/Profiles/BasicProfile-1.1.html.

Error: Initialization failure. Please review input options and documents for val
idity.
- Invalid wsd:arrayType syntax: 'http://www.w3.org/2001/XMLSchema:string'.

If you would like more help, please type "wsdl /?".
In reply to Catalin Maican

Re: ASP.NET/Web services error

by Justin Filip -
Catalin,

I read this before your post in the other discussion and came to the same conclusion.

I'll e-mail you the code to try out. I know the client we initially wrote this for was using one of the MS Studio apps (maybe .NET?) to try and connect to this and couldn't do it with the class structure.
In reply to Justin Filip

Re: ASP.NET/Web services error

by Mahesh Thoppae -

I am new user and trying to use the web service in Visual studio 2005 and I got the same error. Do we have a solution for this issue. If do please post it.

Thanks,

Mahesh

In reply to Mahesh Thoppae

Re: ASP.NET/Web services error

by Catalin Maican -
Hi,

sorry for responding so late... I didn't get the messages for a week from this Developer forum and now I was just curious to see why...

so, to solve this issue I replaced the "xsd:add" construct in the WSDL file with "xsd:all"... I do not know the differences between the two but it works smile

Also, see this thread.

I'm interested in integrating asp.net/dotnetnuke with moodle so i'll be needing some methods like GetUserByUsername, GetRolesByUser, GetModulesByUser, GetCourserByUser/GetEnroledCoursesByUser (see this); these methods do not exist yet in the Moodle WS.

What are the methods that would you need to use ? How are your skills with PHP ?

Catalin