OK Tech Web Services with parameters ?

OK Tech Web Services with parameters ?

ໂດຍ marcel maillet -
ຈຳນວນການຕອບກັບ: 6

How do you pass parameter values.

Ex:

http://mymoodle/wspp/service_pp2.php?wsusername=xxxx&wspassword=xxxx&wsfunction=get_course_byidnumber&wsformatout=json

It is expecting some ID value, how do I do this ?

ການຈັດອັນດັບສະເລ່ຍ: -
ໃນການຕອບກັບຫາ marcel maillet

Re: OK Tech Web Services with parameters ?

ໂດຍ Patrick Pollet -

Hello,

  Calling OK Tech WS in REST mode using a browser is not meant at all to be the official way. This can be done only to 'test' some operations.

In your case, this operation requires an extra string parameter named info so it should be 

http://mymoodle/wspp/service_pp2.php?wsusername=xxxx&wspassword=xxxx&wsfunction=get_course_byidnumber&wsformatout=json&info=xxxxx

to get the name and types of parameters see http://prope.insa-lyon.fr/wshelper/service.php?project=moodlews2  or consult the phpdocs comments at the top of all public functions in wspp/mdl_baseserver.php file.  (names are the same in SOAP mode, so they can also be discovered using SoapUI ).

In case or more complex parameters such as arrays, this method is awfull, so you should turn to some extra classes that will wrap this input/output  depending of your langage 

In wspp/clients/testsrest directory, you should find php sample code for all current operations. 

If you use java you should turn to moodlews json project,  https://github.com/patrickpollet/moodlews_gson  that facilitate client's writing. See for example https://github.com/patrickpollet/moodlews_gson/blob/master/src/net/patrickpollet/moodlews_gson/Test1.java

Cheers.

ການຈັດອັນດັບສະເລ່ຍ: -
ໃນການຕອບກັບຫາ Patrick Pollet

Re: OK Tech Web Services with parameters ?

ໂດຍ Jocelyn Ireson-Paine -

Hi Patrick. When I go to the URL http://prope.insa-lyon.fr/wshelper/service.php?project=moodlews2  that you direct us at for the names and types of parameters, I get this error:

Parse error: syntax error, unexpected T_NAMESPACE, expecting T_STRING in /var/www/wshelper/lib/IPXSLTemplate.class.php on line 20

Regards, Jocelyn

ການຈັດອັນດັບສະເລ່ຍ: -
ໃນການຕອບກັບຫາ Jocelyn Ireson-Paine

Re: OK Tech Web Services with parameters ?

ໂດຍ Jocelyn Ireson-Paine -

The same happens for the URL http://prope.insa-lyon.fr/wshelper/service.php?project=moodlews2&class=mdl_soapserver that's referenced at the end of the section "Writing a client in PHP" in http://docs.moodle.org/dev/Web_Services:OK_Tech_Web_Services . Where you say "Documentation for operations and samples codes in PHP are available here". The "here" links to that URL. So where can I find the documentation and some sample code? I want to use the Web services in the same way as I did Moodle's built-in ones in my example at http://moodle.org/mod/forum/discuss.php?d=193295 . If I succeed, I'll post an example written in the same style.

Jocelyn

ການຈັດອັນດັບສະເລ່ຍ: -
ໃນການຕອບກັບຫາ Jocelyn Ireson-Paine

Re: OK Tech Web Services with parameters ?

ໂດຍ Patrick Pollet -

Hi Jocelyn,

  It is fixed. One of the used library IPXSLTemplate was not compatible with recently upgraded PHP 5.3

Thks for the report.

Cheers

ການຈັດອັນດັບສະເລ່ຍ: -
ໃນການຕອບກັບຫາ Patrick Pollet

Re: OK Tech Web Services with parameters ?

ໂດຍ David Serrano -

Hi Patrick,

With respect to case to use Java, i have a problem using your library moodlews_gson, the problem is when I test function "forum_add_discussion", my code is this,

ForumDiscussionDatum discussion = new ForumDiscussionDatum();
discussion.setMessage(body);
discussion.setSubject(title);
ForumDiscussionRecord[] a=moodle.forum_add_discussion(client, sessionkey, forumId, discussion);

But the parameter "a" is always null, i don't know why, i test other methods and i detect that the function "forum_add_reply" doesn't work.

The errors are this,

02-28 16:34:22.181: E/dalvikvm(8236): Could not find class 'com.google.gson.GsonBuilder', referenced from method net.patrickpollet.gson.GsonObject.fromJSON

java.lang.NoClassDefFoundError: net.patrickpollet.moodlews_gson.core.Mdl_soapserverBindingStub$34

But the jar's are are properly loaded.

I tried with SOAPUi with same values, and the function works well, and the post is added. But on my application it doesn't work, even with correct hardcoded values.

Thanks



ການຈັດອັນດັບສະເລ່ຍ: -
ໃນການຕອບກັບຫາ David Serrano

Re: OK Tech Web Services with parameters ?

ໂດຍ Aldina Pljaskovic -

Hi. Can anyone write me sipmle php code calling one soap function (login, creating user, anything (using OK tech services)) that could be execute in browser? I will appreciate that so much.

Regards,

Aldina Pljaskovic

ການຈັດອັນດັບສະເລ່ຍ: -