php - unable to trace XML API error -
i trying integrate shipping api not working , not returning erro either. trying achieve is, sending customer shipping data in xml format api url , create shipment , return me shipping tracking number. not working , unable trace error, if there any. can please review code , tell me if there issue.
info: piece of code, working integrate magento shipment methods.
here code..
$xmlns = [ 'soap' => 'http://www.w3.org/2003/05/soap-envelope', 't' => 'http://tempuri.org/' ]; $xml = new simplexmlelement( '<?xml version = "1.0" encoding="utf-8"?><soap:envelope xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:soap="http://www.w3.org/2003/05/soap-envelope" />' ); $body = $xml->addchild("soap:body", null, $xmlns['soap']); $shipinfo = $body->addchild('insertdata', null, $xmlns['t']); $shipinfo->addchild('ausername', "testuser"); $shipinfo->addchild('apassword', "testpass"); $shipinfo->addchild('acostcentercode', "cc001"); $shipinfo->addchild('aconsigneename', "shipping testing"); $shipinfo->addchild('aconsigneeaddress', "ship demo address"); $shipinfo->addchild('aconsigneemobno', "01801234577"); $shipinfo->addchild('aconsigneeemail', "shiptesting@testing.com"); $shipinfo->addchild('aorigincityname', "ny"); $shipinfo->addchild('adestinationcityname', "ca"); $shipinfo->addchild('apieces', "1"); $shipinfo->addchild('aweight', "1"); $shipinfo->addchild('acodamount', "0"); $shipinfo->addchild('acustrefno', "webw"); $shipinfo->addchild('aproductdetails', "test product"); $shipinfo->addchild('afragile', "0"); $shipinfo->addchild('aservices', "0"); $shipinfo->addchild('aremarks', "testing api services"); $shipinfo->addchild('ainsurancevalue', "0"); $xmlrequest = $xml->asxml(); try { //header('content-type: text/xml'); $testurl = "http://255.255.255.255:3232"; $ch = curl_init(); curl_setopt($ch, curlopt_url, $testurl); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_header, 0); curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_postfields, $xmlrequest); curl_setopt($ch, curlopt_timeout, 30); curl_setopt($ch, curlopt_ssl_verifypeer,0); $xmlresponse = curl_exec ($ch); $debugdata['result'] = $xmlresponse; } catch (exctption $e){ $debugdata['result'] = array('error' => $e->getmessage(), 'code' => curl_errno($ch)); $xmlresponse = ''; } print($debugdata['result']); curl_close($ch);
thanks,
Comments
Post a Comment