Skip to main content
Inspiring
January 21, 2011
Question

SOAP envelope missing some info

  • January 21, 2011
  • 2 replies
  • 2302 views

Hello

I have been struggling with a web service request for some time and i need some assistance.

I have to insert subscriber info into someone elses db.They created a web service for me.

My code looks like this:

<cfinvoke  webservice="http://41.208.61.35/legacyfallback/ws/legacyLifeWS.php?wsdl" method="register1" returnVariable="somereturn">
    <cfinvokeargument name="name" value="steve" />
    <cfinvokeargument name="mobilenumber" value="123456" />
</cfinvoke>

The person who created the web service uses php.


He checked my return and he saw this:

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><register1 soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><mobileNumber xsi:type="xsd:string">123456</mobileNumber></register1></soapenv:Body></soapenv:Envelope>


He tried the same from his side using php to do the call and he got this return:

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://www.callagain.co.za/soap/legacyLifeWS" xmlns:types="http://www.callagain.co.za/soap/legacyLifeWS/encodedTypes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><register1><mobileNumber xsi:type="xsd:string">0824566072</mobileNumber><name xsi:type="xsd:string">Pieter</name></register1></soap:Body></soap:Envelope>

I am missing this in my envelope:

xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://www.callagain.co.za/soap/legacyLifeWS" xmlns:types="http://www.callagain.co.za/soap/legacyLifeWS/encodedTypes"

Please can you explain how i can get the same info my soap envlope?

Thank you

This topic has been closed for replies.

2 replies

BKBK
Community Expert
Community Expert
January 30, 2011


<!--- WSDL --->
<cfset wsdl_url="http://41.208.61.35/legacyfallback/ws/legacyLifeWS.php?wsdl">
        
<cftry>
    <!--- SOAP message to send to Web Service--->
    <cfsavecontent variable="msg"><?xml version="1.0" encoding="UTF-8" ?>
        <cfoutput><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <soapenv:Body>
         <ns1:query soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://41.208.61.35/soap/legacyLifeWS">
         <wsUserName xsi:type="xsd:string">Steve</wsUserName>
          <wsUserPass xsi:type="xsd:string">a1b2c3</wsUserPass>
          <mobilenumber xsi:type="xsd:string">12345678</mobilenumber>
          </ns1:query>
          </soapenv:Body>
          </soapenv:Envelope></cfoutput>
    </cfsavecontent>
   
    <!--- All the 4 possible values of SOAPAction, obtained from the WSDL --->
    <!---
    http://41.208.61.35/legacyfallback/ws/legacyLifeWS.php/register
    http://41.208.61.35/legacyfallback/ws/legacyLifeWS.php/transaction
    http://41.208.61.35/legacyfallback/ws/legacyLifeWS.php/query
    http://41.208.61.35/legacyfallback/ws/legacyLifeWS.php/history
     --->
    
    <!--- Invoke web service to send message--->
    <cfhttp url="#wsdl_url#" method="post" <!--- proxyport="3128" proxyserver="193.78.83.131"--->>
        <cfhttpparam type="header" name="content-type" value="text/xml">
        <cfhttpparam type="header" name="SOAPAction" value="http://41.208.61.35/legacyfallback/ws/legacyLifeWS.php/query">
        <cfhttpparam type="header" name="content-length" value="#len(msg)#">
        <cfhttpparam type="header" name="charset" value="utf-8">
        <cfhttpparam type="xml" name="registerRequest" value="#trim(msg)#">
    </cfhttp>
   
    <!--- Web service SOAP response --->
    <p><cfoutput>#xmlFormat(cfhttp.fileContent)#</cfoutput> </p>
       
<cfcatch type="any">
    <cfdump var="#cfcatch#">
</cfcatch>
</cftry>

Inspiring
January 30, 2011

Thanks.

Worked perfectly.

--

This message has been scanned for viruses and

dangerous content by Pinpoint, and is

believed to be clean.

BKBK
Community Expert
Community Expert
January 30, 2011

Any time. Good luck!

Inspiring
January 21, 2011

You could use CFHTTP to make the web service calls instead of using the web service features built in to CF.

See this blog post for an example: http://www.bennadel.com/blog/1809-Making-SOAP-Web-Service-Requests-With-ColdFusion-And-CFHTTP.htm

Inspiring
January 21, 2011

Thanks for the reply.

Is there any way to manipulate it to work using the WS?

I'm just curious.

If so, how could I do it?

Inspiring
January 21, 2011

There are some CF functions that will allow you manipulate the soap header (these can be found under XML functions topic in the CF documentation). I am not aware of a way to manipulate the soap body that CF's built in web service components generate.