未捕获的 SoapFault 异常:[HTTP] 使用 SoapClient 时不支持的媒体类型
Uncaught SoapFault exception: [HTTP] Unsupported Media Type when i use SoapClient
所以我试图从 wsdl 获得适当的响应 API 但我一直收到相同的错误
"Unsupported Media type"
$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
但这似乎确实有效,要么抛出同样的错误。 有什么建议吗?
发现错误。这是因为我在引号中设置了 SOAP 1_2 而实际上它是一个预定义的常量。
所以我试图从 wsdl 获得适当的响应 API 但我一直收到相同的错误
"Unsupported Media type"
$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
但这似乎确实有效,要么抛出同样的错误。 有什么建议吗?
发现错误。这是因为我在引号中设置了 SOAP 1_2 而实际上它是一个预定义的常量。