我收到以下方法的请求,但肥皂消息似乎不包含 UsernameToken 元素:
$policy = new WSPolicy(
array(
'useUsernameToken'=>true
)
);
$security = new WSSecurityToken(
array(
'user'=>$username,
'passwordType'=>'PlainText',
'password'=>$password
)
);
// create client in WSDL mode
$client = new WSClient(
array (
'wsdl'=>$service_wsdl,
'to'=>$service_url,
'policy'=>$policy,
'securityToken'=>$security,
'trace'=>1
)
);
$proxy = $client->getProxy();
$proxy->Ping();
生成的请求如下所示:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soapenv:mustUnderstand="1">
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<ns1:Ping xmlns:ns1="http://streamlinedsalestax.org/efile"/>
</soapenv:Body>
</soapenv:Envelope>
您会注意到 UsernameToken 元素完全丢失了。