php - SOAP error application/soap+msbin1 -
does knew how correct or there solution error?>
http/1.1 415 cannot process message because content type 'application/soap+xml;charset=utf-8;action="urn:healthcareservicewcf/getclaimslist"' not 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 here's code.
<?php //--> class localsoapclient extends soapclient { protected $_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); } thank give answer, help, suggestion or point of view.
most ob_end_clean(); causing trouble. can see in code, don't need @ all.
just this:
public function __dorequest($request, $location, $action, $version, $one_way = 0) { $request = $this->_xml; return parent::__dorequest($request, $location, $action, $version, $one_way); } if need it, @ least use ob_end_clean before return otherwise has no effect :p
Comments
Post a Comment