XML : SOAP request in codeigniter with xml

I need to perform soap request in codeigniter,i am using curl but i am struggling in request, Is there any alternate available

Here are my request details

       $output='<?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>  <opertaion xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">        <foo xmlns="http://www.w3schools.com">12</foo>        <boo xmlns="http://www.w3schools.com">15</boo>       <bar xmlns="http://www.w3schools.com">test value</bar>     </opertaion>   </soap:Body>   </soap:Envelope>';        $url='http://www.url.com';  $headers = array(                  "Content-type: text/xml;charset=\"utf-8\"",                  "Accept: text/xml",                  "Cache-Control: no-cache",                  "Pragma: no-cache",                  "Content-length: ".strlen($output),              ); //SOAPAction: your op URL      // PHP cURL  for https connection with auth      $ch = curl_init();      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);      curl_setopt($ch, CURLOPT_URL, $url);      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);      curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);      curl_setopt($ch, CURLOPT_TIMEOUT, 10);      curl_setopt($ch, CURLOPT_POST, true);       curl_setopt($ch, CURLOPT_USERPWD, $soapUser.":".$soapPassword);      curl_setopt($ch, CURLOPT_POSTFIELDS, $output); // the SOAP request      curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);        // converting      $response = curl_exec($ch);       curl_close($ch);       echo $response;    

but i am getting error as below

soap:ClientSystem.Web.Services.Protocols.SoapException: Unable to handle request without a valid action parameter. Please supply a valid soap action. at System.Web.Services.Protocols.Soap12ServerProtocolHelper.RouteRequest() at System.Web.Services.Protocols.SoapServerProtocol.Initialize() at System.Web.Services.Protocols.ServerProtocol.SetContext(Type type, HttpContext context, HttpRequest request, HttpResponse response) at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)

No comments:

Post a Comment