Reputation: 1534
I'm using nusoap v 1.123, I'm trying to add the prefixes urn in my generated request of nusoap
This is what I am expecting
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="urn:mnop:acceptor:contract">
<soapenv:Header>
<urn:authenticationHeader>
<urn:name>abctest</urn:name>
<urn:userid>dddd</urn:userid>
<urn:pass>errerere</urn:pass>
</urn:authenticationHeader>
</soapenv:Header>
and this is what the code is generating
<SOAP-ENV:Header>
<authenticationHeader>
<name>abctest</urn:name>
<userid>dddd</urn:userid>
<pass>errerere</urn:pass>
</authenticationHeader>
</SOAP-ENV:Header>
$header = new SoapHeader($wsdl, 'authenticationHeader',$headerParam);
$soapAction='urn:mnop:acceptor:contract';
$client = new nusoap_client($wsdl);
$client->setHeaders($headerParam);
$data=$client->call('myoperation',$bodyParam,$namespace,$soapAction,null,null,'document', 'literal');
the urn prefix is missing and SOAP-ENV: need to be replaced with soapenv: , kindly tell me to resolve this issue.
Thanks
Upvotes: 3
Views: 7393
Reputation: 186
Solved this problem, nusoap parameters must be configured
add global name space
$client->namespaces['tem'] = "http://tempuri.org/";
and add local namespace for elements
$responseService = $client->call(
'CAV_GET_DATA',
$param,
$namespace = 'tem'
);
Resolve
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tem="http://tempuri.org/" xmlns:ns6704="tem"><SOAP-ENV:Body><tem:CAV_GET_DATA><tem:UsuarioID>example</tem:UsuarioID><tem:Password>example</tem:Password><tem:idEmpleado>000000</tem:idEmpleado></tem:CAV_GET_DATA></SOAP-ENV:Body></SOAP-ENV:Envelope>
Upvotes: 0
Reputation: 1534
this is how I solved this problem
$bodyParam = array('urn:operationName'=>array(
'urn:amount'=>'23232',
'urn:automati'=>'monUrl',
'urn:context'=>'',
'urn:currencyCode'=>'978',
'urn:customerId'=>'',
'urn:customerIpAddress'=>'',
'urn:customerLanguage'=>'fr',
));
Upvotes: 2