小弟最近在做跟外部项目接口时需要调用对方提供的webservice,Fault occurred while processing报这样一个错,谷姐之后说是传入的字符为空导致的,下面是传入的xml数据<?xml version="1.0" encoding="UTF-8"?>
<processSP><wmsSecurityInfo><username>40222</username><password>flux22</password></wmsSecurityInfo><wmsParam><customerid>GXG</customerid><messageid>106D</messageid><stdno>SO</stdno><warehouseid>GXG_WMS</warehouseid><param>1209200001346</param></wmsParam></processSP>,按说没有空值呀。。又想是不是xml的UTF-8格式导致的,顺便问下这样一个UTF-8格式的xml字符串,如何改变编码?($iconv_str = iconv('UTF-8', 'GBK', $str);php的这个函数不行)但这或许不是根本原因,还请大神指点,下面是我调用的代码以及webservice提供的说明$str = array2xml($data,'processSP');
$iconv_str = iconv("UTF-8", "GBK", $str);
$soap_client = new SoapClient('http://192.168.1.9:8081/datahubWeb/WMSSOAP2/WSERPService/ERP/Service3?wsdl');
$soap_result = $soap_client->processSP($iconv_str);
,<wsdl:operation name="processSP">
<wsdl:input message="tns:processSP" name="processSP"></wsdl:input>
<wsdl:output message="tns:processSPResponse" name="processSPResponse"></wsdl:output>
</wsdl:operation>
<processSP><wmsSecurityInfo><username>40222</username><password>flux22</password></wmsSecurityInfo><wmsParam><customerid>GXG</customerid><messageid>106D</messageid><stdno>SO</stdno><warehouseid>GXG_WMS</warehouseid><param>1209200001346</param></wmsParam></processSP>,按说没有空值呀。。又想是不是xml的UTF-8格式导致的,顺便问下这样一个UTF-8格式的xml字符串,如何改变编码?($iconv_str = iconv('UTF-8', 'GBK', $str);php的这个函数不行)但这或许不是根本原因,还请大神指点,下面是我调用的代码以及webservice提供的说明$str = array2xml($data,'processSP');
$iconv_str = iconv("UTF-8", "GBK", $str);
$soap_client = new SoapClient('http://192.168.1.9:8081/datahubWeb/WMSSOAP2/WSERPService/ERP/Service3?wsdl');
$soap_result = $soap_client->processSP($iconv_str);
,<wsdl:operation name="processSP">
<wsdl:input message="tns:processSP" name="processSP"></wsdl:input>
<wsdl:output message="tns:processSPResponse" name="processSPResponse"></wsdl:output>
</wsdl:operation>
WSDL 并没有说 processSP 是 XML 串你最好先与对方沟通一下
<soapenv:Header/>
<soapenv:Body>
<ws:processSP>
<!--Optional:-->
<wmsSecurityInfo>
<!--Optional:-->
<password>PWD</password>
<!--Optional:-->
<username>USER</username>
</wmsSecurityInfo>
<!--Optional:-->
<wmsParam>
<!--Optional:-->
<customerid>XXXXX</customerid>
<!--Optional:-->
<messageid>8888</messageid>
<!--Zero or more repetitions:-->
<param>1234534</param>
<!--Optional:-->
<stdno>SO</stdno>
<!--Optional:-->
<warehouseid>XXXX</warehouseid>
</wmsParam>
</ws:processSP>
</soapenv:Body>
</soapenv:Envelope>我现在已经按他的格式拼了一个完整的格式过去,还是在调用那一行报错$soap_result = $soap_client->processSP($req_data);//Fault occurred while processing.