Quantcast
Channel: Discussion Forum > Connect Data Services
Viewing all articles
Browse latest Browse all 2504

SOAP Envelope element not found - Exception thrown from php custom script (1 Comment)

$
0
0

Topic by Nivedhitha Sundaramurthi

Hi,

I have written a php script which does a SOAP based webservice call. Testing the script in Process Designer throws an error - soapenv:ClientSOAP message does not contain a SOAP envelope element . Could you please let me know what may be going wrong here.

Here is the snippet which includes the SOAP request –

                                
              $url = "<<WSDL_URL>>";
       
            $username = "xxxxxx";
            $password = "yyyyy";
            
            $headers = array(
                'Content-Type: text/xml; charset="utf-8"',
                'Content-Length: '.strlen($body),
                'Accept: text/xml',
                'Cache-Control: no-cache',
                'Pragma: no-cache',
                'SOAPAction: "Get"'
            );   
            
            
            $body ='<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
                    <soapenv:Header>
                        <ns7:ClientInfoHeader xmlns:ns7="urn:messages.ws.rightnow.com/v1_3" soapenv:mustUnderstand="0">
                            <ns7:AppID>Basic Get</ns7:AppID>
                        </ns7:ClientInfoHeader>
                        <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" mustUnderstand="1">
                            <wsse:UsernameToken>
                                <wsse:Username>xxxxx</wsse:Username>
                                <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">yyyyy</wsse:Password>
                            </wsse:UsernameToken>
                        </wsse:Security>
                    </soapenv:Header>
                    <soapenv:Body>
                        <ns7:Get xmlns:ns7="urn:messages.ws.rightnow.com/v1_3">
                            <ns7:RNObjects xmlns:ns4="urn:objects.ws.rightnow.com/v1_3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns4:Incident">
                                <ID xmlns="urn:base.ws.rightnow.com/v1_3" id="1" />
                                <ns4:Severity />
                            </ns7:RNObjects>
                            <ns7:ProcessingOptions>
                                <ns7:FetchAllNames>false</ns7:FetchAllNames>
                            </ns7:ProcessingOptions>
                        </ns7:Get>
                    </soapenv:Body>
                    </soapenv:Envelope>';

            load_curl();
            $curl = curl_init();

            static::$url_used = $url;

            curl_setopt_array($curl,array(
              CURLOPT_URL => $url,             
              CURLOPT_HEADER => 0,
              CURLOPT_POST   => 1,
              CURLOPT_HTTPHEADER => $headers,
              CURLOPT_POSTFIELDS => $body,
              CURLOPT_FOLLOWLOCATION => 1,  
              CURLOPT_SSL_VERIFYPEER => 0,
              CURLOPT_RETURNTRANSFER => 1,
              CURLOPT_CONNECTTIMEOUT => 20,
              CURLOPT_HTTPAUTH         => CURLAUTH_ANY,
              CURLOPT_USERPWD         => "$username:$password"
            ));
       
            $content = curl_exec($curl);

            echo "\n HTTP Code is : " . curl_getinfo($curl, CURLINFO_HTTP_CODE); //Returns 500
            echo "\n Content is : " . $content; //Returns SOAP Fault : SOAP Message does not contain a SOAP Envelope element
                               
            curl_close($curl);
       

Thanks.


Viewing all articles
Browse latest Browse all 2504

Trending Articles