我正在尝试使用PHP Soap调用Web服务,但我在创建请求并正确签名时遇到了问题。
我这样做:
$docRequest = new DomDocument();
$docRequest->loadXML(
'<ApplicationRequest xmlns="http://bxd.fi/xmldata/">
<CustomerId>123</CustomerId>
</ApplicationRequest>');
$doc = signXML($docRequest);
$params = array(
'RequestHeader' => array(
'SenderId' => 456,
'RequestId' => 1111
),
'ApplicationRequest' => $doc->saveXML()
);
$client = new SignSoapClient($wsdl);
$client->__soapCall($soap_function, array($params));
结果如下:
<RequestHeader>
<SenderId>456</SenderId>
<RequestId>1111</RequestId>
</RequestHeader>
<ApplicationRequest>
<ApplicationRequest xmlns="http://bxd.fi/xmldata/">
<CustomerId>123</CustomerId>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
...
</Signature>
</ApplicationRequest>
</ApplicationRequest>
所以问题是,我如何像现在一样签署$ docRequest,然后在没有第二个ApplicationRequest标签的情况下将其添加到$ params? 要么 如果我以这种方式创建它:
$params = array(
'RequestHeader' => array(
...
),
'ApplicationRequest' => '<CustomerId>123</CustomerId>'
);
我可以在签署SOAP本身之前在完整的XML中签署ApplicationRequest吗? (使用wse-php和SOAP消息已在SignSoapClient
的{{1}})中签名