[英]SoapFault exception: [HTTP] Unsupported Media Type when accessing Java web-service from PHP
[英]Uncaught SoapFault exception: [HTTP] Unsupported Media Type when i use SoapClient
所以我正在嘗試從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 SOAP 1.1
和SOAP 1.2
,甚至將text/xml
用作我的Content-type
但這似乎確實有效,或者拋出了相同的錯誤。 有什么建議么?
發現錯誤。 這是因為實際上它是預定義的常量時,我在引號中設置了SOAP 1_2。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.