Thread: Soap request !

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2011
    Posts
    58
    Rep Power
    3

    Soap request !


    I have to get the following response(In the code section) using coldfusion. Can I do it in this way:

    I have a html page where inside a form field , I have a Phone number text field and when a user clicks on submit button I have to pass this information to the WSDL(Web Service) and get the information in the format mentioned below.
    This is my first time dealing with SOAP Request, any good information source from where I can learn doing such things?

    I found some materials online like: http://www.bennadel.com/blog/1809-Making-SOAP-Web-Service-Requests-With-ColdFusion-And-CFHTTP.htm

    but I think it's not exactly what I want. Any suggestions would be helpful.

    Thanks
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
        <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
            <SOAP-ENV:Body>
                <ns1:infoLookupResponse xmlns:ns1="urn:vtsPhoneNumberLookup">
                        <phoneNumber xsi:type="xsd:string">4444444444</phoneNumber>
                        <Type xsi:type="xsd:string">Landline</Type>
                        <OCN xsi:type="xsd:string">2222</OCN>
                        <OVERALLOCN xsi:type="xsd:string">2103</OVERALLOCN>
                        <COMPANY xsi:type="xsd:string">ABC Inc</COMPANY>
                        <DBA xsi:type="xsd:string">ABC Inc</DBA>
                        <CommonName xsi:type="xsd:string">ABC</CommonName>
                        <HOLDINGCOMPANY xsi:type="xsd:string">ABC Communications Inc</HOLDINGCOMPANY>
                        <MANAGEMENT xsi:type="xsd:string"></MANAGEMENT>
                        <SMS xsi:type="xsd:string"></SMS>
                </ns1:infoLookupResponse>
            </SOAP-ENV:Body>
        </SOAP-ENV:Envelope>
    Last edited by Jack_Tauson_Sr; October 14th, 2013 at 03:33 PM.
  2. #2
  3. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,263
    Rep Power
    968
    The docs are always a good place to start. Note that web services are notoriously difficult to use, which is why JSON is far more prevalent now.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2011
    Posts
    58
    Rep Power
    3
    Originally Posted by kiteless
    The docs are always a good place to start. Note that web services are notoriously difficult to use, which is why JSON is far more prevalent now.

    Thanks for your reply. I'm trying to invoke a webservice using cfinvoke which is as follows:

    Code:
    <cfinvoke  
    webservice="https://xyz/infoLookup.php?wsdl" 
    method="infoLookup" 
    
    returnVariable="info"> 
    <cfinvokeargument name="phoneNumber" value="7182973186"/>
    <cfinvokeargument name="userName" value="12345"/>
    <cfinvokeargument name="password" value="password"/> 
    </cfinvoke> 
     
    <cfdump var="#info#">

    And here is a part of the message name from the WSDL :

    Code:
    <message name="infoLookupRequest">
      <part name="phoneNumber" type="xsd:string" /> 
      <part name="userName" type="xsd:string" /> 
      <part name="password" type="xsd:string" /> 
      </message>
    And here is a part of Operation name from WSDL:

    Code:
    <portType name="vtsInfoLookupPortType">
    - <operation name="infoLookup">
      <documentation>Get phone number information.</documentation> 
      <input message="tns:infoLookupRequest" /> 
      <output message="tns:infoLookupResponse" /> 
      </operation>
      </portType>
    I'm getting the following error:



    Unable to read WSDL from URL: https://xyz/infoLookup.php?wsdl.
    Error: javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated.

    The error occurred in C:\XYZ\A\Soap\soapreq.cfm: line 37

    Code:
    35 : <cfinvokeargument name="phoneNumber" value="7182973186"/>
    36 : <cfinvokeargument name="userName" value="12345"/>
    37 : <cfinvokeargument name="password" value="password"/> 
    38 : </cfinvoke> 
    39 :
  6. #4
  7. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,263
    Rep Power
    968
    Looks like the WSDL requires an SSL connection. You probably need to add the cert to the Java keystore. This may help.

IMN logo majestic logo threadwatch logo seochat tools logo