Re: [SOAP] soapClient not creating XML request correctly

[email protected] (Bilig Ordos) Wed, 8 Aug 2012 14:10:53 -0700 (PDT)
Newsgroups php.soap
Message-ID <[email protected]>
--2094167247-1531039990-1344460253=:62812
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Naveen,=0A=A0=0AThanks for the reply. I thought I don't need to use SoapPar=
am if I use the soapClient with a WSDL, which is what I am doing. What's yo=
ur thought on that? =0A=A0=0AThanks,=0A=A0=0ABilig=0A =0A=0A_______________=
_________________=0A From: NAVEEN <[email protected]>=0ATo: Bilig Ordo=
s <[email protected]>; "[email protected]" <[email protected]> =0ASen=
t: Wednesday, August 8, 2012 2:10 AM=0ASubject: Re: [SOAP] soapClient not c=
reating XML request correctly=0A  =0A=0AHi Bilig,=0A=0AUse SoapParam object=
 to create params for soap function.=0APlease see php online documentation =
for the same.=0A=0ABest,=0ANaveen=0A=0A=0A=0A----- Original Message -----=
=0AFrom: Bilig Ordos <[email protected]>=0ATo: "[email protected]" <so=
[email protected]>=0ACc: =0ASent: Tuesday, 7 August 2012, 22:09=0ASubject: [=
SOAP] soapClient not creating XML request correctly=0A=0AHi,=0A=A0=0A=A0=0A=
I'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 appre=
ciated!=0A=A0=0A=A0=0AI need the soapClient to send the following XML reque=
st. I tested=0A this request with a=A0third-party tool and=A0made sure it w=
orks fine:=0A=A0=0A<soapenv:Envelope xmlns:soapenv=3D"http://schemas.xmlsoa=
p.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=0A <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:grou=
p>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 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</deviceName>=0A=A0=
=A0=A0=A0=A0=A0=A0=A0 </con:orderPlanFilter>=0A=A0=A0=A0=A0=A0 </con:getCon=
fig>=0A=A0=A0 </soapenv:Body>=0A</soapenv:Envelope>=0A=A0=0A=A0=0A=A0=0AThe=
 "credential" is used for=0A authentication and the "orderPanFilter" is use=
d for filtering the data by available fields in the WS/DB.=0A=A0=0AMy probl=
em is that I was only able to have the soapClient send the following reques=
t:=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/envelope/" xmlns:ns1=3D"=
http://www.xyz.com/product/schema/common" xmlns:ns2=3D"http://www.xyz.com/p=
roduct/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:u=
ser>=0A=A0=A0=A0=A0=A0=A0=A0=A0=0A <ns1:password>pass</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:Envel=
ope>=0A=A0=0A=A0=0AAs you can see, the soapClient does not send the "orderP=
lanFilter" part. I tried a few variations of the code, but it basically goe=
s 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$results =3D $x-=
>getOrderPlanConfig(array('credential'=3D>array('user'=3D>'user', 'password=
'=3D>'pass', 'group'=3D>'group')=0A, array('orderPlanFilter'=3D>array('devi=
ceName'=3D>'abc'))));=0Aecho=0A "REQUEST:<br />" . htmlentities($x->__getLa=
stRequest()) . "<br />";=0Aecho "<br /><br />";=0Avar_dump_pre($results);=
=0Aecho "<br /><br />";=0A=0A=A0=0AAnd the response I received is (line bre=
ak 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://s=
chemas.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<S=
OAP-ENV:Body>=0A<ns2:getConfig>=0A<ns1:credential>=0A<ns1:user>user</ns1:us=
er>=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 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 orderPlanFilter but since t=
he request does not contain the "orderPlanFilter" part, I'm not getting any=
 data back. =0A=A0=0AFollowing is the result of "getFunctions()" and "getTy=
pes()" from the WSDL:=0A=A0=0AAvailable Functions: =0Areply editorderPlanCo=
nfig(editConfig $orderPlanConfigEditRequest)=0Areply getorderPlanConfig(get=
Config=0A $orderPlanConfigGetRequest)=0A=A0=0AAvailable Types: =0Astruct cr=
edentialsType { string user; string password; string group; }=0Astring Erro=
rTypes=0Astring ErrorTag=0Astruct dataErrorInfo { short sequenceNumber; str=
ing message; }=0Astruct errorInfoType { dataErrorInfo badAttribute; dataErr=
orInfo badElement; dataErrorInfo okElement; dataErrorInfo errElement; dataE=
rrorInfo noopElement; }=0Astring ErrorSeverity=0Astring errorOptionType=0As=
truct errorType { ErrorTypes errorTtype; ErrorTag errorTag; ErrorSeverity e=
rrorSeverity; string erroAppTag; string errorPath; int errorNumber; string =
errorMessage; errorInfoType errorInfo; }=0Astring IP=0Astring filterType=0A=
struct filter { filterType type; positiveInteger pageIndex; positiveInteger=
 pageSize; }=0Astring mediaRoutingType=0Astruct webServiceFilter { webServi=
ceFilterType type; positiveInteger pageIndex; positiveInteger pageSize; sho=
rt sequenceNumber; }=0Astring=0A webServiceFilterType=0Astruct intFilter { =
intOperator operator; string value; }=0Astring intOperator=0Astruct dateFil=
ter { dateOperator operator; string value; }=0Astring dateOperator=0Astruct=
 dateTimeType { dateTime dummy; }=0Astruct config { credentialsType credent=
ial; orderPlanConfigType orderPlanConfig; }=0Astruct dataType { orderPlanCo=
nfigType orderPlanConfig; }=0Astruct reply { string ok; errorType error; da=
taType data; }=0Astruct editConfig { config config; errorOptionType errorOp=
tion; }=0Astruct getConfig { credentialsType credential; orderPlanFilterTyp=
e orderPlanFilter; }=0Astruct orderPlanFilterType { string deviceName; stri=
ng group; string planName; dateFilter created; dateFilter lastModified; }=
=0Astruct orderPlanType { deviceName deviceName; group group; planName plan=
Name; dateTime created; dateTime lastModified; }=0Astring deviceName=0Astri=
ng group=0Astring planName=0Astruct orderPlanConfigType { orderPlanType ord=
erPlan;=0A orderPlanConfigCommand command; short sequenceNumber; }=0Astring=
 orderPlanConfigCommand=0A=A0=0A=A0=0AThanks,=0A=A0=0ABilig=0A=0A--=0APHP S=
oap Mailing List (http://www.php.net/)=0ATo unsubscribe, visit: http://www.=
php.net/unsub.php
--2094167247-1531039990-1344460253=:62812--