Hi Maxim,  I can confirm it  works  through  REST  and your official OM  moodle plugin.  Would it be possible for  you to check that  it can be done through  SOAP ?

We are struggling to make it  work  but  have  been successful with several of the other SOAP API  calls.

Best Regards,


Dan

On 2/13/2020 3:23 PM, Maxim Solodovnik wrote:
Please check working example here https://github.com/openmeetings/openmeetings-moodle-plugin/blob/master/api/OmGateway.php#L290

On Thu, 13 Feb 2020 at 22:13, moodle dman <moodled...@gmail.com <mailto:moodled...@gmail.com>> wrote:

    Hi Guys,
    I am trying to use the SOAP ws API to upload a file in open
    meetings, but no matter what I do I always get a :

    Unmarshalling Error: Unable to create an instance of java.io.InputStream
    error.

    I am using php as web-service client. I tried sending a stream to the 
web-service, i tried to hardcode the file into web-service parameters, i tried 
using get_contents without stream nothing seems to be working.

    This is a sample of code:
    ========
    try {
         $response = $userserviceclient->login($loginobject);
         if ($response->return->type == "SUCCESS") {
             $handle = fopen('big_file.txt', 'r');
             //handle = fopen('zimbru.jpg', 'r');
             print_object(fgets($handle));
             $fileuploadobject = new add();
             $fileuploadobject->sid = $response->return->message;
             //$fileuploadobject->stream = stream_get_contents($handle);
             $fileuploadobject->stream = $handle;
             $fileuploadresponse = $fileserviceclient->add($fileuploadobject);

             var_dump($fileuploadresponse);
         }
    } catch (SoapFault $e) {
         var_dump($e);
    }
    =========================

    Just as a mention I used a lot of other web-services from the API and all 
are working as expected.

    Any clue about this one?

    Thanks!



--
WBR
Maxim aka solomax

Reply via email to