我正在使用nusoap v 1.123,我正在尝试在我生成的nusoap请求中添加前缀 urn
这就是我所期待的
<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>
这就是代码生成的内容
<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');
缺少urn前缀,SOAP-ENV:需要用soapenv替换:请告诉我解决此问题。
由于
答案 0 :(得分:2)
这就是我解决这个问题的方法
$bodyParam = array('urn:operationName'=>array(
'urn:amount'=>'23232',
'urn:automati'=>'monUrl',
'urn:context'=>'',
'urn:currencyCode'=>'978',
'urn:customerId'=>'',
'urn:customerIpAddress'=>'',
'urn:customerLanguage'=>'fr',
));
答案 1 :(得分:0)
解决了这个问题,必须配置nusoap参数
添加全局名称空间
$client->namespaces['tem'] = "http://tempuri.org/";
并为元素添加本地名称空间
$responseService = $client->call(
'CAV_GET_DATA',
$param,
$namespace = 'tem'
);
解决
<?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>