【发布时间】:2018-07-18 19:29:50
【问题描述】:
所以我试图从 wsdl API 获得适当的响应,但我一直收到同样的错误
“不支持的媒体类型”
$opts = array(
'http' => array(
'user_agent' => 'PHPSoapClient',
'Content-Type' => 'application/soap+xml'
)
);
$ctx = stream_context_create($ctx_opts);
$options = array(
'soap_version'=>'SOAP_1_1',
'stream_context' => $ctx,
'keep_alive' => true
);
$params = array(
'UserId'=>'xxxx',
'Password'=>'xxxx',
'PassKey'=>'xxxxx'
);
$client = new SoapClient('http://bsestarmfdemo.bseindia.com/MFOrderEntry/MFOrder.svc?wsdl',$options);
$response = $client->getPassword($params);
我尝试将 SOAP 版本同时更改为 SOAP 1.1 和 SOAP 1.2,甚至使用 text/xml 作为我的 Content-type,但这似乎确实有效,要么抛出相同的错误。 有什么建议吗?
【问题讨论】:
-
我之前没有使用过
stream_context选项。你试过没有这些选项吗?
标签: php soap soap-client