How to use Zend_Soap_Client to run the query at a known WSDL schema?

0 like 0 dislike
A Zend_Soap_Client object. Connect and execute a query like this:

$client = new Zend_Soap_Client($uri, array( 'login' => $login, 'password' => $password, 'soapVersion' => SOAP_1_1) ); /* * GetIdentityInfo * */ $params = array('Profile' => $profile); $result = $client->GetIdentityInfo($params); print($result->GetIdentityInfoResult->any); print($client->getLastRequest()); /* * SubmitXml * */ $request = simplexml_load_file('./request.xml'); $filter = simplexml_load_file('./filter.xml'); $request = xml2array($request); $filter = xml2array($filter); $params = array( 'Profile' => $profile, 'Request' => $request, 'Filter' => $filter); $result1 = $client->SubmitXml($params); function xml2array($xml) { $arXML=array(); $arXML['name']=trim($xml->getName()); $arXML['value']=trim((string)$xml); $t=array(); foreach($xml->attributes() as $name => $value) $t[$name]=trim($value); $arXML['attr']=$t; $t=array(); foreach($xml->children() as $name => $xmlchild) $t[$name]=xml2array($xmlchild); $arXML['children']=$t; return($arXML); } 

where $request, $filter — XML data (first as object, then converted into an array).

A WSDL schema. A significant piece of the quote below:

In the first query GetIdentityInfo Profile is fine, get a normal response.

In the second query SubmitXml Profile also eats normally, because it is type="s:string". Swears on Request and Filter for that XML in an array (or object?).


PHP Fatal error: SOAP-ERROR: Encoding: object hasn't 'any' property in /usr/share/php/libzend-framework-php/Zend/Soap/Client.php on line 1113
PHP Fatal error: Uncaught SoapFault exception: [Client] SOAP-ERROR: Encoding: object hasn't 'any' property in /usr/share/php/libzend-framework-php/Zend/Soap/Client.php:1113

Question: what about the Request parameters and Filter? How can I pass them correctly? If the object, in what form?
I now see that "any" and close...
In what form to give the option that matches this description?

by | 6 views

2 Answers

0 like 0 dislike
You found the answer, it would be nice then too to write.
0 like 0 dislike
The correct response if someone was looking for similar:
$client = new Zend_Soap_Client($uri, array( 'login' => $login, 'password' => $password, 'soapVersion' => SOAP_1_1) ); $r_xml = simplexml_load_file('./request.xml'); $f_xml = simplexml_load_file('./filter.xml'); $p_obj = new SoapVar($profile, XSD_STRING); $r_obj = new SoapVar($r_xml, SOAP_ENC_OBJECT); $f_obj = new SoapVar($f_xml, SOAP_ENC_OBJECT); $params = array( 'Profile' => $p_obj, 'Request' => $r_obj, 'Filter' => $f_obj ); $result = $client->SubmitXml($params); 

Content request.xml and filter.xml must be enclosed in and tags, respectively.

Related questions

110,608 questions
257,186 answers
32,737 users