I'm trying to call a SOAP Adonix X3 web service by using a php client.
For testing, I used SOAP UI and it worked well ; this is the xml request :
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:a="http://www.adonix.com/WSS"
xmlns:XS="http://www.w3.org/2001/XMLSchema"
xmlns:XI="http://www.w3.org/2001/XMLSchema-instance">
<S:Header>
<a:CAdxCallingContext>
<a:codeLang XI:type="XS:string">FRA</a:codeLang>
<a:codeUser XI:type="XS:string">ADM</a:codeUser>
<a:password XI:type="XS:string">XXX</a:password>
<a:poolAlias XI:type="XS:string">TEST</a:poolAlias>
<a:requestConfig XI:type="XS:string">trace</a:requestConfig>
</a:CAdxCallingContext>
</S:Header>
<S:Body>
<a:runXml S:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<publicName XI:type="XS:string">RECH_OF</publicName>
<inputXml XI:type="XS:string">
<![CDATA[
<PARAM>
<GRP ID="GRP1">
<FLD NAME="XITMREF">PSFIN00153</FLD>
<FLD NAME="XFLUX">recycle</FLD>
<FLD NAME="XOPENUM">15</FLD>
</GRP>
</PARAM>
]]>
</inputXml>
</a:runXml>
</S:Body>
</S:Envelope>
but trying to do the same call in php :
$sh_param = array(
'codeLang' => 'FRA',
'codeUser' => 'ADM',
'password' => 'XXX',
'poolAlias' => 'TEST',
'requestConfig ' => 'trace'
);
$ns = 'http://www.adonix.com/WSS';
$headers = new SoapHeader($ns, 'CAdxCallingContext', $sh_param, false);
// Prepare Soap Client
$soapClient->__setSoapHeaders(array($headers));
$at_param2 = array(
'XITMREF' => 'PSFIN00153',
'XFLUX' => 'recycle',
'XOPEN开发者_开发技巧UM' => '15');
// Setup the RemoteFunction parameters
$ap_param = array(
'publicName' => 'RECH_OF',
'inputXml' => array($at_param2));
$info = $soapClient->__call("runXml", array($ap_param));
I get the following error :
3 - Le Header element [http://www.adonix.com/WSS][CAdxCallingContext] du message Soap n'a pas de fils [codeLang].
this means
The Header element [http://www.adonix.com/WSS][CAdxCallingContext] of the Soap message has no son [codeLang]
It seems the server doesn't find the subnode of the header...
any idea ?
Thanks
The problem you're having is because the X3 Web Service is unable to identify header parameters without the namespace reference
Moreover, you should use a SoapVar instead of the basic array to build a correct header
So you should try something like this
$ns = 'http://www.adonix.com/WSS';
$headerParams = array('ns1:codeLang' => 'FRA',
'ns1:codeUser' => 'ADM',
'ns1:password' => 'XXX',
'ns1:poolAlias' => 'TEST',
'ns1:requestConfig' => 'trace');
$soapStruct = new SoapVar($headerParams, SOAP_ENC_OBJECT);
$header = new SoapHeader($ns, 'CAdxCallingContext', $soapStruct, false);
Good Luck
Al.
精彩评论