Having issues making php soap request -
i'm having hard time understanding how create soap request properly, , receive info server.
here's link docs service need connect to. shows soap request , response format.
https://www.team-intro.com/ws/distributorws.asmx?op=getreplicatedsite
looking @ request format, i'm not sure how i'm suppossed pass server. i've googled around , found several ways send requests, keep getting soap falut errors. below latest attempt.
<?php //error_reporting(e_all); //soap connect $client = new soapclient("http://www.team-intro.com/ws/distributorws.asmx?wsdl"); $params = new soapvar("<soap12:header><authheader domain='thedomain' xmlns='http://www.prodogix.com/'><authorizationkey>myauthkey</authorizationkey></authheader></soap12:header><soap12:body><getreplicatedsite xmlns='http://www.prodogix.com/'><website>username</website></getreplicatedsite></soap12:body>", xsd_anyxml); //$info[ try { $result = $client->getreplicatedsite($params); } catch (soapfault $exception) { echo $exception; } print_r($result); ?>
i've stripped out input values , replaced them caps.
i've seen people building array send soap server, can't seem figure out how pass info domain , xmlns in authheader.
can point me in right direction.
this tutorial ended having function needed:
http://www.xillent.com/blog/codesharing/php-soap-call-for-wsdl-envelope-and-payload/
here's how code worked in action incase else has issues mine.
<?php //error_reporting(e_all); class feedsoap extends soapclient { var $xmlstr = ""; function setxmlstr ($value){$this->xmlstr = $value; } function getxmlstr(){return $this->xmlstr; } function __dorequest($request, $location, $action, $version) { $request = $this -> xmlstr; $dom = new domdocument('1.0'); try { $dom->loadxml($request); } catch (domexception $e) { die($e->code); } $request = $dom->savexml(); //dorequest return parent::__dorequest($request, $location, $action, $version); } function soapclientcall($soapxml) { return $this -> setxmlstr ($soapxml); } } function soapcall($wsdlurl, $callfunction="", $xmlstring) { $client = new feedsoap($wsdlurl, array('trace' => true)); $reply = $client-> soapclientcall($xmlstring); $client->__call("$callfunction", array(), array()); return $client -> __getlastresponse(); } //i copied soap request provided , dropped in values (removed stackoverflow $xmlstring= '<soap:envelope xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:header> <authheader domain="thedomain" xmlns="http://www.prodogix.com/"> <authorizationkey>mykey</authorizationkey> </authheader> </soap:header> <soap:body> <getreplicatedsite xmlns="http://www.prodogix.com/"> <website>usersnamee</website> </getreplicatedsite> </soap:body> </soap:envelope>'; //set url post soap request $wsdlurl = 'https://www.team-intro.com/ws/distributorws.asmx?wsdl'; //make call, , set soap function i'll using $result = soapcall($wsdlurl, $callfunction="getreplicatedsite", $xmlstring); print_r($result); ?>
Comments
Post a Comment