soapClient not creating XML request correctly
[email protected] (Bilig Ordos) Tue, 7 Aug 2012 09:39:47 -0700 (PDT)
| Newsgroups | php.soap |
|---|---|
| Message-ID | <[email protected]> |
Hi,=0A=A0=0A=A0=0AI'm trying to work with=A0an existing SOAP/XML web servic=
es that is working fine with clients written in Java and .Net. Any help/ide=
a is greatly appreciated!=0A=A0=0A=A0=0AI need the soapClient to send the f=
ollowing XML request. I tested this request with a=A0third-party tool and=
=A0made sure it works fine:=0A=A0=0A<soapenv:Envelope xmlns:soapenv=3D"http=
://schemas.xmlsoap.org/soap/envelope/" xmlns:con=3D"http://www.xyz.com/prod=
uct/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:Bod=
y>=0A=A0=A0=A0=A0=A0 <con:getConfig>=0A=A0=A0=A0=A0=A0=A0=A0=A0 <com:creden=
tial>=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:password>=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:creden=
tial>=0A=A0=A0=A0=A0=A0=A0=A0=A0 <!--Zero or more repetitions:-->=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 <deviceName>abc</d=
eviceName>=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:Envelope>=0A=A0=
=0A=A0=0A=A0=0AThe "credential" is used for authentication and the "orderPa=
nFilter" 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 soapClient send the=
following request:=0A=A0=0A<?xml version=3D"1.0" encoding=3D"UTF-8"?> =0A<=
SOAP-ENV:Envelope xmlns:SOAP-ENV=3D"http://schemas.xmlsoap.org/soap/envelop=
e/" xmlns:ns1=3D"http://www.xyz.com/product/schema/common" xmlns:ns2=3D"htt=
p://www.xyz.com/product/schema/config">=0A<SOAP-ENV:Body>=0A=A0=A0 <ns2:get=
Config>=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>pass</ns1:pas=
sword>=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</S=
OAP-ENV:Envelope>=0A=A0=0A=A0=0AAs you can see, the soapClient does not sen=
d the "orderPlanFilter" part. I tried a few variations of the code, but it =
basically goes like the following:=0A=A0=0A$op =3D "http location to URL";=
=0Atry {=0A=A0=A0=A0 $x =3D @new SoapClient($op, array('local_cert'=3D>file=
_get_contents('./client.trustore'),'passphrase'=3D>abcdef, 'trace=0A'=3D>1)=
);=0A} catch (SoapFault $E) {=0A=A0=A0=A0 echo $E->faultstring;=0A}=0A=0A$r=
esults =3D $x->getOrderPlanConfig(array('credential'=3D>array('user'=3D>'us=
er', 'password'=3D>'pass', 'group'=3D>'group')=0A, array('orderPlanFilter'=
=3D>array('deviceName'=3D>'abc'))));=0Aecho "REQUEST:<br />" . htmlentities=
($x->__getLastRequest()) . "<br />";=0Aecho "<br /><br />";=0Avar_dump_pre(=
$results);=0Aecho "<br /><br />";=0A=0A=A0=0AAnd the response I received is=
(line break inserted manually for convenience): =0A=A0=0AREQUEST:=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/c=
onfig">=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>group</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 st=
ring(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 orderPlanFilte=
r but since the request does not contain the "orderPlanFilter" part, I'm no=
t getting any data back. =0A=A0=0AFollowing is the result of "getFunctions(=
)" and "getTypes()" from the WSDL:=0A=A0=0AAvailable Functions: =0Areply ed=
itorderPlanConfig(editConfig $orderPlanConfigEditRequest)=0Areply getorderP=
lanConfig(getConfig $orderPlanConfigGetRequest)=0A=A0=0AAvailable Types: =
=0Astruct credentialsType { string user; string password; string group; }=
=0Astring ErrorTypes=0Astring ErrorTag=0Astruct dataErrorInfo { short seque=
nceNumber; string message; }=0Astruct errorInfoType { dataErrorInfo badAttr=
ibute; dataErrorInfo badElement; dataErrorInfo okElement; dataErrorInfo err=
Element; dataErrorInfo noopElement; }=0Astring ErrorSeverity=0Astring error=
OptionType=0Astruct errorType { ErrorTypes errorTtype; ErrorTag errorTag; E=
rrorSeverity errorSeverity; string erroAppTag; string errorPath; int errorN=
umber; string errorMessage; errorInfoType errorInfo; }=0Astring IP=0Astring=
filterType=0Astruct filter { filterType type; positiveInteger pageIndex; p=
ositiveInteger pageSize; }=0Astring mediaRoutingType=0Astruct webServiceFil=
ter { webServiceFilterType type; positiveInteger pageIndex; positiveInteger=
pageSize; short sequenceNumber; }=0Astring webServiceFilterType=0Astruct i=
ntFilter { intOperator operator; string value; }=0Astring intOperator=0Astr=
uct dateFilter { dateOperator operator; string value; }=0Astring dateOperat=
or=0Astruct dateTimeType { dateTime dummy; }=0Astruct config { credentialsT=
ype credential; orderPlanConfigType orderPlanConfig; }=0Astruct dataType { =
orderPlanConfigType orderPlanConfig; }=0Astruct reply { string ok; errorTyp=
e error; dataType data; }=0Astruct editConfig { config config; errorOptionT=
ype errorOption; }=0Astruct getConfig { credentialsType credential; orderPl=
anFilterType orderPlanFilter; }=0Astruct orderPlanFilterType { string devic=
eName; string group; string planName; dateFilter created; dateFilter lastMo=
dified; }=0Astruct orderPlanType { deviceName deviceName; group group; plan=
Name planName; dateTime created; dateTime lastModified; }=0Astring deviceNa=
me=0Astring group=0Astring planName=0Astruct orderPlanConfigType { orderPla=
nType orderPlan; orderPlanConfigCommand command; short sequenceNumber; }=0A=
string orderPlanConfigCommand=0A=A0=0A=A0=0AThanks,=0A=A0=0ABilig