我正在尝试使用PHP的soapClient类进行SOAP请求,以下是我的代码:
有一些方法可以删除/禁用那些额外的文本吗?换句话说,是否有办法只发送我的XML?
$xmlstr = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://localhost:8090/mockCustomerManagement/types">
<soapenv:Header>
<typ:customerManagementHeader>
<typ:userId>42</typ:userId>
<typ:requestId>1500</typ:requestId>
<typ:messageTimestamp>2013-09-25T14:31:21+00:00</typ:messageTimestamp>
</typ:customerManagementHeader>
</soapenv:Header>
<soapenv:Body>
<typ:getCustomerInfoData>
<useremail>sargentoarensivia@nobody.es</useremail>
</typ:getCustomerInfoData>
</soapenv:Body>
</soapenv:Envelope>
XML;
$wsdl = 'http://localhost:8090/mockCustomerManagementSoapHttpBinding?WSDL';
$client = new SoapClient($wsdl, array(
'cache_wsdl' => WSDL_CACHE_NONE,
'cache_ttl' => 86400,
'trace' => true,
'exceptions' => true,
));
$xmlVar = new SoapVar($xmlstr, XSD_ANYXML);
$client->getCustomerInfo($xmlstr);
但是当我发送请求时,它会抛出一个异常。当我询问客户端最后一次的请求时,它显示了一些额外的文本,你可以看到它在我的 XML 开头和结尾:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://localhost:8090/mockCustomerManagement/types">
<SOAP-ENV:Body>
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://localhost:8090/mockCustomerManagement/types">
<soapenv:Header>
<typ:customerManagementHeader>
<typ:userId>42</typ:userId>
<typ:requestId>1500</typ:requestId>
<typ:messageTimestamp>2013-09-25T14:31:21+00:00</typ:messageTimestamp>
</typ:customerManagementHeader>
</soapenv:Header>
<soapenv:Body>
<typ:getCustomerInfoData>
<useremail>sargentoarensivia@nobody.es</useremail>
</typ:getCustomerInfoData>
</soapenv:Body>
</soapenv:Envelope>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
有一些方法可以删除/禁用那些额外的文本吗?换句话说,是否有办法只发送我的XML?