3

I'm doing a simple request like this

        $wsdl = "http://.../wsdl/FileArchive";
        $client = new SoapClient($wsdl);


        $parameters= array(
                        "FileName" => "file.jpg"
                       );

        $values = $client->GetFileInfo($parameters);

I'm getting "Array to string conversion" where the GetFileInfo method is being called.

The method is defined in wsdl like this :

<message name="GetFileInfo0Request">
<part name="FileName" type="xs:string"/>
</message>

I've searched for it, and found out it could occur when there is some complex type, but here is just a string. What could be the problem?

2 Answers 2

10

Rather than this $values = $client->GetFileInfo($parameters);

Try this instead: $values = $client->__soapCall('GetFileInfo', $parameters);

4
  • Thank you for response, now it doesn't show that error, but "Could not connect to host"...but it should be available. Mar 22, 2015 at 0:22
  • Does the host require some sort of authentication scheme, like a username and password? Mar 22, 2015 at 19:22
  • I had the same problem. Does anyone know the reason? Why does it work with __soapCall? Apr 26, 2017 at 20:27
  • I changed this code: $response = call_user_func_array( array( $this->client, $action ), array( $request ) ); Into this code: $response = $this->client->__soapCall( $action, array( $request ) ); But it did not help, I still get the Notice. $request contains an object! Jul 20, 2018 at 20:15
-2

You must send a simple array.

 $parameters= array("file.jpg");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.