Skip to content
Advertisement

Add namespace Prefix in Nusoap PHP

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

Advertisement

Answer

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',
));
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement