简体   繁体   English

如何将内容类型设置为'application / soap + xml; SOAP请求中,PHP中的charset = utf-8'

[英]How to set content type to 'application/soap+xml; charset=utf-8' in PHP while SOAP request

When I try to send a request to the WSDL I got this error Cannot process the message because the content type text/xml; charset=utf-8 当我尝试向WSDL发送请求时,出现此错误,因为内容类型为text/xml; charset=utf-8所以无法处理消息text/xml; charset=utf-8 text/xml; charset=utf-8 was not the expected type application/soap+xml; charset=utf-8 text/xml; charset=utf-8不是预期的类型application/soap+xml; charset=utf-8 application/soap+xml; charset=utf-8

Here is my code 这是我的代码

$client = new SoapClient("http://bsestarmfdemo.bseindia.com/MFOrderEntry/MFOrder.svc?singleWsdl");
 $parameter = array(
    'User ID' => '0123',
    'Password' => 'mf@abc',
    'Pass Key' => 'abcdef1234',     
 );
$result = $client->getPassword($parameter);

I tried passing content type like this 我尝试传递这样的内容类型

$client = new SoapClient("http://bsestarmfdemo.bseindia.com/MFOrderEntry/MFOrder.svc?wsdl",array('content type'=>'application/soap+xml')); 

but didnot work. 但是没有用。

Here is the WSDL Link : WSDL Source Link 这是WSDL链接: WSDL源链接

Please share some solutions. 请分享一些解决方案。 Thanks in advance. 提前致谢。

只需将您请求中的SOAP版本更改为1.2

  $client = new SoapClient("http://bsestarmfdemo.bseindia.com/MFOrderEntry/MFOrder.svc?wsdl",array('soap_version' => SOAP_1_2)); 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM