1

我的 SOAP WSDL 请求如下所示,

<?xml version="1.0" encoding="UTF-8"?> 
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body><unit>3452</unit>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

但我已在 SOAP 标头上发送 HTTP 身份验证参数并从 SOAP 服务器捕获。

$client = new SoapClient("call.wsdl",array(
"trace"      => 1,
"exceptions" => 0,
"login" => 'xxxxx',
"password" => 'xxxx'));

$result = $client->getCALL($unit);

我的 SOAP 身份验证参数已发送到服务器,但未显示在 SOAP 请求文本上。我需要在请求消息中看到它们。

我需要在 WSDL 文件中添加哪些类型的代码来获取请求文本,如下所示。

<?xml version="1.0" encoding="UTF-8"?> 
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP-ENV:Header>
    <Login>BonZ</Login>
    <Password>xxxx</Password>
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <unit>3452</unit>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
4

1 回答 1

2
$CREDENTIALS = 'Login:Password';
        $auth = base64_encode($CREDENTIALS);
        $context = array('http' =>
            array(
                'header'  => "Authorization: Basic ".$auth
            )
        );

$trac["stream_context"]=stream_context_create($context);
$client = new SoapClient("call.wsdl",array(
"trace"      => 1,
"exceptions" => 0,
"login" => 'xxxxx',
"password" => 'xxxx'
"stream_context"=>stream_context_create($context)
));
于 2013-02-11T19:16:18.620 回答