Re: [SOAP] soapClient not creating XML request correctly
[email protected] (NAVEEN) Tue, 7 Aug 2012 23:10:59 -0700 (PDT)
| Newsgroups | php.soap |
|---|---|
| Message-ID | <[email protected]> |
---748019302-127006105-1344406259=:9883 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Hi Bilig,=0A=0AUse SoapParam object to create params for soap function.=0AP= lease see php online documentation for the same.=0A=0ABest,=0ANaveen=0A=0A= =0A=0A=0A----- Original Message -----=0AFrom: Bilig Ordos <bilig.ordos@yaho= o.com>=0ATo: "[email protected]" <[email protected]>=0ACc: =0ASent: Tuesd= ay, 7 August 2012, 22:09=0ASubject: [SOAP] soapClient not creating XML requ= est correctly=0A=0AHi,=0A=A0=0A=A0=0AI'm trying to work with=A0an existing = SOAP/XML web services that is working fine with clients written in Java and= .Net. Any help/idea is greatly appreciated!=0A=A0=0A=A0=0AI need the soapC= lient to send the following XML request. I tested this request with a=A0thi= rd-party tool and=A0made sure it works fine:=0A=A0=0A<soapenv:Envelope xmln= s:soapenv=3D"http://schemas.xmlsoap.org/soap/envelope/" xmlns:con=3D"http:/= /www.xyz.com/product/schema/config" xmlns:com=3D"http://www.xyz.com/product= /schema/common">=0A=A0=A0 <soapenv:Header>=0A=A0=A0 </soapenv:Header>=0A=A0= =A0 <soapenv:Body>=0A=A0=A0=A0=A0=A0 <con:getConfig>=0A=A0=A0=A0=A0=A0=A0= =A0=A0 <com:credential>=0A=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <com:user>user<= /com:user>=0A=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <com:password>pass</com:pass= word>=0A=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <!--Optional:-->=0A=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0 <com:group>group</com:group>=0A=A0=A0=A0=A0=A0=A0=A0= =A0 </com:credential>=0A=A0=A0=A0=A0=A0=A0=A0=A0 <!--Zero or more repetitio= ns:-->=0A=A0=A0=A0=A0=A0=A0=A0=A0 <con:orderPlanFilter>=0A=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0 <!--Optional:-->=0A=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <de= viceName>abc</deviceName>=0A=A0=A0=A0=A0=A0=A0=A0=A0 </con:orderPlanFilter>= =0A=A0=A0=A0=A0=A0 </con:getConfig>=0A=A0=A0 </soapenv:Body>=0A</soapenv:En= velope>=0A=A0=0A=A0=0A=A0=0AThe "credential" is used for authentication and= the "orderPanFilter" is used for filtering the data by available fields in= the WS/DB.=0A=A0=0AMy problem is that I was only able to have the soapClie= nt send the following request:=0A=A0=0A<?xml version=3D"1.0" encoding=3D"UT= F-8"?> =0A<SOAP-ENV:Envelope xmlns:SOAP-ENV=3D"http://schemas.xmlsoap.org/s= oap/envelope/" xmlns:ns1=3D"http://www.xyz.com/product/schema/common" xmlns= :ns2=3D"http://www.xyz.com/product/schema/config">=0A<SOAP-ENV:Body>=0A=A0= =A0 <ns2:getConfig>=0A=A0=A0=A0=A0=A0 <ns1:credential>=0A=A0=A0=A0=A0=A0=A0= =A0=A0 <ns1:user>user</ns1:user>=0A=A0=A0=A0=A0=A0=A0=A0=A0 <ns1:password>p= ass</ns1:password>=0A=A0=A0=A0=A0=A0=A0=A0=A0 <ns1:group>group</ns1:group>= =0A=A0=A0=A0=A0=A0 </ns1:credential>=0A=A0=A0 </ns2:getConfig>=0A</SOAP-ENV= :Body>=0A</SOAP-ENV:Envelope>=0A=A0=0A=A0=0AAs you can see, the soapClient = does not send the "orderPlanFilter" part. I tried a few variations of the c= ode, but it basically goes like the following:=0A=A0=0A$op =3D "http locati= on to URL";=0Atry {=0A=A0=A0=A0 $x =3D @new SoapClient($op, array('local_ce= rt'=3D>file_get_contents('./client.trustore'),'passphrase'=3D>abcdef, 'trac= e=0A'=3D>1));=0A} catch (SoapFault $E) {=0A=A0=A0=A0 echo $E->faultstring;= =0A}=0A=0A$results =3D $x->getOrderPlanConfig(array('credential'=3D>array('= user'=3D>'user', 'password'=3D>'pass', 'group'=3D>'group')=0A, array('order= PlanFilter'=3D>array('deviceName'=3D>'abc'))));=0Aecho "REQUEST:<br />" . h= tmlentities($x->__getLastRequest()) . "<br />";=0Aecho "<br /><br />";=0Ava= r_dump_pre($results);=0Aecho "<br /><br />";=0A=0A=A0=0AAnd the response I = received is (line break inserted manually for convenience): =0A=A0=0AREQUES= T:=0A<?xml version=3D"1.0" encoding=3D"UTF-8"?> =0A<SOAP-ENV:Envelope xmlns= :SOAP-ENV=3D"http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1=3D"http:/= /www.xyz.com/product/schema/common" xmlns:ns2=3D"http://www.xyz.com/product= /schema/config">=0A<SOAP-ENV:Body>=0A<ns2:getConfig>=0A<ns1:credential>=0A<= ns1:user>user</ns1:user>=0A<ns1:password>pass</ns1:password>=0A<ns1:group>g= roup</ns1:group>=0A</ns1:credential>=0A</ns2:getConfig>=0A</SOAP-ENV:Body>= =0A</SOAP-ENV:Envelope>=0A=0A=A0=0Aobject(stdClass)#2 (3) {=0A=A0 ["ok"]=3D= >=0A=A0 string(2) "ok"=0A=A0 ["error"]=3D>=0A=A0 NULL=0A=A0 ["data"]=3D>=0A= =A0 NULL=0A}=0A=0A=A0=0AI expected to receive some data based on the orderP= lanFilter but since the request does not contain the "orderPlanFilter" part= , I'm not getting any data back. =0A=A0=0AFollowing is the result of "getFu= nctions()" and "getTypes()" from the WSDL:=0A=A0=0AAvailable Functions: =0A= reply editorderPlanConfig(editConfig $orderPlanConfigEditRequest)=0Areply g= etorderPlanConfig(getConfig $orderPlanConfigGetRequest)=0A=A0=0AAvailable T= ypes: =0Astruct credentialsType { string user; string password; string grou= p; }=0Astring ErrorTypes=0Astring ErrorTag=0Astruct dataErrorInfo { short s= equenceNumber; string message; }=0Astruct errorInfoType { dataErrorInfo bad= Attribute; dataErrorInfo badElement; dataErrorInfo okElement; dataErrorInfo= errElement; dataErrorInfo noopElement; }=0Astring ErrorSeverity=0Astring e= rrorOptionType=0Astruct errorType { ErrorTypes errorTtype; ErrorTag errorTa= g; ErrorSeverity errorSeverity; string erroAppTag; string errorPath; int er= rorNumber; string errorMessage; errorInfoType errorInfo; }=0Astring IP=0Ast= ring filterType=0Astruct filter { filterType type; positiveInteger pageInde= x; positiveInteger pageSize; }=0Astring mediaRoutingType=0Astruct webServic= eFilter { webServiceFilterType type; positiveInteger pageIndex; positiveInt= eger pageSize; short sequenceNumber; }=0Astring webServiceFilterType=0Astru= ct intFilter { intOperator operator; string value; }=0Astring intOperator= =0Astruct dateFilter { dateOperator operator; string value; }=0Astring date= Operator=0Astruct dateTimeType { dateTime dummy; }=0Astruct config { creden= tialsType credential; orderPlanConfigType orderPlanConfig; }=0Astruct dataT= ype { orderPlanConfigType orderPlanConfig; }=0Astruct reply { string ok; er= rorType error; dataType data; }=0Astruct editConfig { config config; errorO= ptionType errorOption; }=0Astruct getConfig { credentialsType credential; o= rderPlanFilterType orderPlanFilter; }=0Astruct orderPlanFilterType { string= deviceName; string group; string planName; dateFilter created; dateFilter = lastModified; }=0Astruct orderPlanType { deviceName deviceName; group group= ; planName planName; dateTime created; dateTime lastModified; }=0Astring de= viceName=0Astring group=0Astring planName=0Astruct orderPlanConfigType { or= derPlanType orderPlan; orderPlanConfigCommand command; short sequenceNumber= ; }=0Astring orderPlanConfigCommand=0A=A0=0A=A0=0AThanks,=0A=A0=0ABilig=0A= =0A--=0APHP Soap Mailing List (http://www.php.net/)=0ATo unsubscribe, visit= : http://www.php.net/unsub.php ---748019302-127006105-1344406259=:9883--