3

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

MZH
  • 1,414
  • 4
  • 29
  • 57
  • someone pls reply to this thread? – MZH Jan 11 '12 at 13:06
  • Hey @MZH, I am having a similar issue as you experienced but your implementation is different to mine. Is there any chance you still have the code you wrote? P.S. Thank you for posting your answer, much appreciated. – Ali Feb 21 '18 at 14:21

2 Answers2

2

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',
));
MZH
  • 1,414
  • 4
  • 29
  • 57
0

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>