Php SOAP错误应用程序/SOAP+msbin1
是否有人知道如何更正此错误,或者是否有解决此错误的方法?>Php SOAP错误应用程序/SOAP+msbin1,php,soap,Php,Soap,是否有人知道如何更正此错误,或者是否有解决此错误的方法?> HTTP/1.1 415 Cannot process the message because the content type 'application/soap+xml;charset=UTF-8;action="urn:HealthCareServiceWCF/GetClaimsList"' was not the expected type 'application/soap+msbin1'. Cache-Control: pr
HTTP/1.1 415 Cannot process the message because the content type 'application/soap+xml;charset=UTF-8;action="urn:HealthCareServiceWCF/GetClaimsList"' was not the expected type 'application/soap+msbin1'. Cache-Control: private Server: Microsoft-IIS/7.5 Set-Cookie: ASP.NET_SessionId=ilvagsgvofc2r5jclkvjtysv; path=/; HttpOnly X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET Date: Fri, 27 Jun 2014 22:26:03 GMT Content-Length: 0
这是我的密码
<?php //-->
类LocalSoapClient扩展了SoapClient{
受保护的$\u xml=null
public function __construct($wsdl, $options, $xml)
{
$this->_xml = $xml;
parent::__construct($wsdl, $options);
}
public function __doRequest($request, $location, $action, $version, $one_way = 0)
{
ob_start();
$request = $this->_xml;
return parent::__doRequest($request, $location, $action, $version, $one_way);
ob_end_clean();
}
}
function mcrypts_encrypt($encrypted)
{
//Padding 6/25/2014
$pad = 16 - (strlen($encrypted) % 16);
$encrypted = $encrypted . str_repeat(chr($pad), $pad);
//Encrypt//Decode
$iv = base64_decode('...');
$key = base64_decode('...');
$plaintext = mcrypt_encrypt( MCRYPT_RIJNDAEL_128, $key, $encrypted, MCRYPT_MODE_CBC, $iv );
//Return encrypted Data
return base64_encode($plaintext);
}
$portal = 'CaregiverPortalService';
$userName = '...';
$password = '...';
$passwordnew = '...';
$url = "https://webapp.healthcaresynergy.com:8002/demoalpha/HealthCareServiceWCF.svc?singleWsdl";
$option = array('trace' => 1 );
$xml = '<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">'.
'<soap:Header/>'.
'<soap:Body>'.
'<Login>'.
'<userName>'.$userName.'</userName>'.
'<password>'.$password.'</password>'.
'<newPassword>'.$passwordnew.'</newPassword>'.
'</Login>'.
'</soap:Body>'.
'</soap:Envelope>';
$client = new LocalSoapClient($url, $option, $xml);
try
{
$client->Login();
$response = $client->__getLastResponse();
echo 'result';
echo "<br/>";
echo htmlspecialchars($response);
$p = xml_parser_create();
xml_parse_into_struct($p, $response, $vals, $index);
xml_parser_free($p);
echo "Index array\n";
echo('<pre>');
print_r($index);
echo('<pre/>');
echo "\nVals array\n";
//print_r($vals);
//echo $vals[114]['value'];
//$sessiontoken = $vals[114]['value'];
}
catch (SoapFault $fault)
{
echo $client->__getLastRequestHeaders();
echo 'Request : <br/><xmp>',
$client->__getLastRequest(),
'</xmp><br/><br/> Error Message : <br/>',
$fault->getMessage();
echo '<pre>';
print_r ($client);
}
感谢所有愿意给出答案、帮助、建议或观点的人。很可能是ob\u end\u clean;造成了麻烦。从我在您的代码中看到的情况来看,您根本不需要它
就这样做吧:
如果您确实需要它,至少在返回之前使用ob_end_clean,否则它没有任何效果:p从服务器或客户端的角度?发布代码,查看错误,客户端和服务器似乎希望/使用不同的内容类型。@mattheninja-Post根据请求进行更新。谢谢。始终指向此行返回父项::\u doRequest$request、$location、$action、$version、$one_-way;这就是错误总是显示的地方有人找到了解决方案我也有同样的问题?
public function __doRequest($request, $location, $action, $version, $one_way = 0) {
$request = $this->_xml;
return parent::__doRequest($request, $location, $action, $version, $one_way);
}