soap - PHP SOAPClient Request Issue -


i trying call web service http:// 115. 186. 182.11/csws/service.asmx?op=sendsms following php code gives me exception error mate in script: server unable process request. ---> object reference not set instance of object.

will highly appreciate on this.

try     {         $client = new soapclient("http://115.186.182.11/csws/service.asmx?wsdl");   $method = 'sendsms';  $params = array( new soapparam('xxxxx', 'src_nbr'), new soapparam('xxxxxx', 'password'), new soapparam('xxxxx', 'dst_nbr'), new soapparam('xxxxx', 'mask'), new soapparam('message test message', 'message') );  $result = $client->__call($method,$params);  } catch(soapfault $e){ echo "error mate in script: " . $e->getmessage(); }  echo "<pre>"; var_dump($result); echo "</pre>";  $xmlobj = simplexml_load_string($result); print_r($xmlobj); 

following specification...

post /csws/service.asmx http/1.1 host: 115.186.182.11 content-type: text/xml; charset=utf-8 content-length: length soapaction: "http://tempuri.org/sendbulksms"  <?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://schemas.xmlsoap.org/soap/envelope/">   <soap:body>     <sendbulksms xmlns="http://tempuri.org/">       <src_nbr>string</src_nbr>       <password>string</password>       <dst_nbr>xmlxml</dst_nbr>       <mask>string</mask>       <message>string</message>     </sendbulksms>   </soap:body> </soap:envelope> http/1.1 200 ok content-type: text/xml; charset=utf-8 content-length: length  <?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://schemas.xmlsoap.org/soap/envelope/">   <soap:body>     <sendbulksmsresponse xmlns="http://tempuri.org/">       <sendbulksmsresult>         <string>string</string>         <string>string</string>       </sendbulksmsresult>     </sendbulksmsresponse>   </soap:body> </soap:envelope> 

i followed below method , working perfect in production.

$fields = '<?xml version="1.0" encoding="utf-8"?> <soap12:envelope xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">   <soap12:body>     <sendsms xmlns="http://tempuri.org/">       <src_nbr>xxxx</src_nbr>       <password>123</password>       <dst_nbr>xxxxxxxxxx</dst_nbr>       <mask>xxxk</mask>       <message>aoa, test. xxx.</message>       <transactionid>11122276</transactionid>          </sendsms>   </soap12:body> </soap12:envelope>';  echo $fields;   $ch = curl_init(); curl_setopt($ch, curlopt_url, $posturl);  curl_setopt($ch, curlopt_post, 1);  curl_setopt($ch, curlopt_httpheader, array('content-type: text/xml')); curl_setopt($ch, curlopt_postfields, "$fields"); $response = curl_exec($ch);  curl_close ($ch); 

in production sms api using code , code exected more 20 time per seconds , performance as-well.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -