How to use SOAP in ColdFusion

Hi All,
The code set am using as follows
index.cfm
<cfsavecontent variable="soap">
<?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"
        xmlns="http://one.dileep.com/soaptest/"><!---1 this is the cfc location--->
    <soapenv:Header>
    <setInit>1</setInit>
    <!--- 2 header param --->
    </soapenv:Header>
    <soapenv:Body>
        <addNumbers soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" >
        <!---3 cfc method name --->
            <firstNumber>1000</firstNumber>
            <secondNumber>10</secondNumber>
        </addNumbers>
       </soapenv:Body>
</soapenv:Envelope>
</cfsavecontent>
<cfhttp url="http://one.dileep.com/soaptest/soaptest.cfc" method="post">
    <cfhttpparam type="header" name="content-type" value="text/xml">
    <cfhttpparam type="header" name="SOAPAction" value="">
    <cfhttpparam type="header" name="content-length" value="#len(soap)#">
    <cfhttpparam type="header" name="charset" value="utf-8">
    <cfhttpparam type="xml" name="message" value="#trim(soap)#">
</cfhttp>
<cfdump var="#xmlparse(cfhttp.FileContent)#">
soaptest.cfc
<cfcomponent output="false" >
    <cffunction name="addNumbers" access="remote" returntype="any" output="false">
        <cfargument name="firstNumber" type="string" required="true"/>
        <cfargument name="secondNumber" type="string" required="true"/>
        <cfset retunVal="NO">
        <cfset username=0>
        <cfif isSOAPRequest()>           
            <cfset username = getSOAPRequestHeader("http://one.dileep.com/soaptest/", "setInit")>
            <!---4 retrieving  SOAP header value --->
        </cfif>
        <cfreturn arguments.firstNumber + arguments.secondNumber & username   />
    </cffunction>
</cfcomponent>
This is the right way for implimenting SOAP in COLDFUSION webservice ?
More Questios
1- <!---1 this is the cfc url--->
What is the relevance of the cfc URL ? I am using sub domains
eg : one.dileep.com, two.dileep.com,yyy.dileep.com, in this case the cfc url 'http://<<subdomain>>.dileep.com/soaptest/' should changed accordingly?
2-<!--- 2 header param --->
We have to give any tag name as Header?
3- <!---3 cfc method name --->
SOAP body  tag must be the method name that we need to exicute?
Here, I have to execute method 'addNumbers'
4- <!---4 retrieving  SOAP header value --->
While retrieving the header value should we need to specify the cfc url?('http://<<subdomain>>.dileep.com/soaptest/')
Please help.

Have you read the chapter in CFWACK vol 3 on working with webservices?  It's not very in-depth, but has some pointers and the usual lame-a** code example.
Depending on the complexity of what you are trying to do, you might be better off building a RESTful service instead of a SOAP service.  Despite it's name, SOAP tends to be overkill if all you are doing is passing a couple of args to the webservice, but is good if the request is complex.  REST is easiest if you are just sending a couple of args, but a pain in the a** if you are trying to do something complex in a single operation (works better to break down into individual state-changing calls to individual webservices).
A couple of comments on what you are doing in your code:
It's a lot simpler to use CFINVOKE than to roll your own webservice HTTP call.  If you're writing your own webservice this should be especially true.  I've ended up using CFHTTP to call vendor's webservices that I had no control over and wouldn't work with CFINVOKE, but that is the case where I've seen that to be true.  Check out the example in CFWACK.
If you continue on the CFHTTP route, you might find it easier to use the CFXML tag instead of using CFSAVECONTENT to create the XML variable - this will allow CF to validate the xml document and ns references.  It also allows you to use the CFDUMP tag to get a formatted view of the xml doc to help with debugging.
Most of the CFHTTPPARAMS you have included in your call are not really needed, at least that's been my experience.  For example, this is all I ever use in my SOAP calls:
   <cfhttp url="https://adwords.google.com/api/adwords/cm/v200909/AdGroupAdService" method="post">
    <cfhttpparam name="SOAPAction" type="header" value=""/>
    <cfhttpparam type="xml" value="#ToString(variables.adAd)#"/>
   </cfhttp>
"variables.adAd" is the xml doc created by this code:
   <cfxml variable="adAd">
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v20="https://adwords.google.com/api/adwords/cm/v200909" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
       <soapenv:Header>
          <v20:RequestHeader>
               authorization data goes here
          </v20:RequestHeader>
       </soapenv:Header>
       <soapenv:Body>
               magic happens here
       </soapenv:Body>
    </soapenv:Envelope>
   </cfxml>
Hope this helps.  My experience in this is that it requires some trial and error and lots of CFDUMPs to get it right the first time, but after you get over that initial hurdle it all suddenly "makes sense" from then on.
Reed

Similar Messages

  • How to use Soap with Netweaver?

    Hi,
    I am new to SAP Netweaver, I was wondering how to use SOAP messaging with SAP Netweaver?
    Thanks
    Falak

    I want to secure the message between my web service and a Automated activity in SAP Netweaver BPM (Process
    development). I think in this case the usage of of SOAP adapter may not be useful.
    Security parameters (settings) can be defined for Sender SOAP Adapter (as in your case it is)......to know more check this help section: http://help.sap.com/saphelp_nwpi71/helpdata/EN/fc/5ad93f130f9215e10000000a155106/content.htm
    Check the section: Define Security Parameters.
    Regards,
    Abhishek.

  • How to use SOAP, how do i create the WSDL?

    Hi
    Im have a website that accepts SOAP messages, and all I was trying to do was to POST a canned SOAP message that i copied from using soapUI, which is an awesome tool,  but using c#
    one of the first problems is the page of SOAP data.  what i CANNOT do is create a new string then paste the SOAP page within quotes and end with a semicolon;  instantly it gets hundreds of errors.  the SOAP page has quotes and slashes and
    chars that mess up the string literal.  even trying the @ symbol?  does not help.  @"  bunch of string characters  ";  no.
    i can create a new item, an html page.  paste that soap info? save it, no problem.  did the same, new text item/page.  
    in the project i can say    string s = HTMLPage1.ToString():  no, HTMLPage1 is unknown.  its in the project but cannot be seen, 
    Another idea besides just trying to send it by force was to use SOAP methods.  i need this to work fast, just a big learning curve for SOAP.  what i did notice in some example was that if i have a WSDL then i can individually address the member
    variables, set them, then somehow form the SOAP message.  this would be great, but how?   I have the page of SOAP data i want to send, and i should be able to find some definition for it that has the xs: and xsl? tags in there.
    i will have maybe 2 different SOAP messages to send out, and need to hear back what the result is.  thanks in advance for any suggestions!

    Hi SDBrad5678,
    This forum is to discuss problems of C# development. Your question is not related to the topic of this forum.
    You'll need to post it in the dedicated ASP.Net Forum
    http://forums.asp.net for more efficient responses, where you can contact ASP.NET experts.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to use SOAP with JSP (New to SOAP)

    Hi,
    i had a sch assignment(a set of JSPs)............anyone know how i can go about using soap for the encoding of data ? cos i had read up some books but i'm not sure how to go about implementing it !!!!! Anyone can help me?
    Regards,
    khim

    Hey,
    Just trying to understand the assignment objective:
    You have a SOAP message or some web-service that replies with SOAP messages?
    You have been asked to write a JSP that (queries this web-service and) retrieves the SOAP encoded data and transform it into XHTML (by whatever method you want) using XSLT?
    Is this the situation?
    If it is you will need to get the DTD or XSD of the SOAP message you will be displaying. This will tell you what elements to expect, what attributes they have and their sequencing.
    Then your problem is just the XSL style sheet. Here is a link if you do not kow much about XSL:
    http://www.w3schools.com/xsl/default.asp
    To perform the transform you can either use JSTL tags or you can use a Bean... I would suggest the JSTL tags.
    I hope the advice is not too late.
    Warm regards,
    Darren

  • How to use soap with IDAP

    Hi,
    The documentation states that the namespace of the IDAP envelope
    can be changed from oracle specific to 'soap' It also states that
    this is only possible with iAS9i? Does this mean I cannot use
    soap as the envelope when running on anything other then iAS
    (e.g. Bea WLS, JBoss etc...) ?
    Kind regards,
    Ronald van Kuijk

    Hi,
    The servlet currently shipped with 9i understands only IDAP
    messages. In 9.0.1.2 patch release, the servlet has been changed
    to understand SOAP envelope as well. This change is also
    available with iASv2.
    So when 9.0.1.2 is available you can use the AQ servlet and
    deploy it with any Servlet 2.x compatible engine (not necessarily
    iAS).

  • What is best method for learning how to use mySQL with Coldfusion?

    I have been using access databases for years with Coldfusion. I have a client that wants me to build an online classroom. I figure it's time to finally start using mySQL, but there is so much info out there, I don't know which way to turn.
    Where do you experts recommend I get started?
    Also, I am using coldfusion entrprise on my system at home. My machine is a 64-bit, 3.30Ghz AMD FX - 6100 six-core processor with 8gig of ram. Can I install mySQL on the machine and run CF8 without any problems?

    How much RAM left on your system? If the computer is strictly for development, then you have more than enough to run ColdFusion, MySQL, browsers, and other development tools.
    For MySQL download the MySQL Community Server and MySQL Workbench. There is also all-in-one package for Windows, http://dev.mysql.com/downloads/windows/installer/ that you don't need to download the server and workbench separately. The installation should be straight forward.
    By the way, other CF users may suggest you to use MariaDB (https://mariadb.org/), which is a branch of MySQL.

  • How to use SOAP sender adapter

    Hi all
    i have configured the SOAP sender adapter. Now my 3rd party needs to send me a soap message. 
    I have checked that the status at the following URL is OK:
    http://host:port/XISOAPAdapter/MessageServlet?channel=:MXII_Web_Service:SOAP_MXII_Sender.
    This is fine, however
    I am unsure of the following:
    1. Does XI make a wsdl available to the 3rd party?
    2. Where does my 3rd party send the soap message to?
    3. Is the SOAP message sent via a query string?
    4. Do I need to create a web service?
    Thanks for all your help in advance
    Clinton

    Hi Moorthy
    Thanks for your answer.
    The problem was solved, we used .Net to write a webservice to our wsdl.
    I have now another problem.... When the message comes into XI it shows that no receiver found(RCVR_DETERMINATION">NO_RECEIVER_CASE_ASYNC). If I just test the scenario with a file adpter as Sender, and Receiver it is fine, but when using the SOAP adapter as Sender, it gives me the no receiver found message.
    Any help with this issue will be appreciated.
    Thanks again
    Clinton

  • How to use SOAP over JMS with Glassfish

    Hi
    Is it possible to use JMS with JAX-WS2.0 ?
    Any answer welcome
    Andre

    I want to secure the message between my web service and a Automated activity in SAP Netweaver BPM (Process
    development). I think in this case the usage of of SOAP adapter may not be useful.
    Security parameters (settings) can be defined for Sender SOAP Adapter (as in your case it is)......to know more check this help section: http://help.sap.com/saphelp_nwpi71/helpdata/EN/fc/5ad93f130f9215e10000000a155106/content.htm
    Check the section: Define Security Parameters.
    Regards,
    Abhishek.

  • File download and Upload using SOAP in Oracle ADF

    Hi Gurus,
    I have a requirement of Uploading and downloading a file on a location. It is for uploading and downloading an Attachments for a user. I have a table in my jspx page for showing the current attachments and an option to upload a new attachment. When I click on attachment name, the file should be downloaded.
    The current implementation does this using SOAP web service. Now, i need to do it with ADF now.
    For Uploading and downloading, i have used FileDownloadActionListner on my page. I am not able to figure out how to use SOAP service in ADF to download or upload a file. what i have done is
    1. Create WebService Data Control with the exposed wsdl.
    2. Created .jspx page and binded the fuctions to the button.
    3. In managed bean class, i have written code to get reference to that web service and invoke it. I am assuming of making the currect call as the response object is not coming as null.
    Now i need to know:
    1. How to verify for the success response from a SOAP web service in the managed bean code.
    2. how to go ahead with the implementation.
    For Upload: I have filename, content and mimetype in the managed bean code function. but how to use those to make a soap call and upload a file at the location.
    For Download: I have DocumentId in the managed bean code function, and how to use it to download a file. How to get the SOAP response in managed bean code and how to handle it.
    Thanks in Advance,
    regards,
    Rajan

    Hi,
    don't have an example, but I suggest to use a JAX-WS proxy client and access it from the POJO DC (instead the WS DC) so you have access to the service responses
    Frank

  • How to Use SOAPArray to Exchanged Data with a Web Service

    The method of a prototype Web service I created is defined to take many parameters
    and return an object of a user defined class. Furthermore, the user defined class
    includes data elements of another user defined class and the Java ArrayList class.
    This works with a Java client referencing the WebLogic created client.jar file
    but I don't know how well it will work with a non-Java client. In particular,
    with Perl which is the language that will be used by the developer who first will
    test with the prototype.
    In posts to this newsgroup use of "language-specific, generic containers" has
    been discouraged and the "language-agnostic" SOAPArray recommended. I have searched
    this newgsroup and the Web for examples of how to use a SOAPArray in a Web service
    EJB to receive parameters and return results but found none.
    Will someone refer me to an example or give an overview of how a Java Web service
    EJB running in WebLogic 6.1 would use SOAPArray to get parameter values and return
    results?
    Also, I would like confirmation that it is best to use SOAPArray to exchange data
    with a Web service to achieve the goal of a service accessible by any language.
    Thank you.

    Replies in-line:
    How are the structures, e.g. gltrans-workType, defined in the Web service?The structure is made up of nested Java Beans, but this does not mean that the
    client for your web service has to be written in Java. The WSDL that I sent contains
    everything that a .NET-based (or Perl-based, or Python-based, or VB-based, or
    C++ based) Web Service Stack needs to correctly create all the data types in the
    web services' signature! That's the beauty of XML Schema! It's programming language
    independent :-)
    In
    other words, what definition in Java resulted in the WSDL statements?The WSDL wasn't produced by WLS 6.1, but it (WLS 6.1) can consume it.
    What is the signature of method submitGLTransWorkAsJavaBean() in the
    Web service?public void submitGLTransWorkAsJavaBean(GlTransactionsCpyType glTransactionsCpyType)
    GlTransactionsCpyType is the outer-most Java Bean. WLS 6.1 does not generate
    Java Beans for you, but it will use ones that you defined. See the Java Bean tutorial
    on the Javasoft sitem for details on how to create a Java Bean.
    Was the WSDL generated using the WL tools for creating a Web service?No.
    Conclusion:
    You asked for someone to provide you with an example of how to use SOAP array
    in a WSDL, which is what the attached file contained :-) What you want to do now
    is find a tool that can generate Java Bean code from this WSDL (Apache Axis has
    a wsdl2java tool that should work), or create the Java Beans yourself. Afterwards,
    create a WLS 6.1 Web Service a expose it for a Perl or .NET client.
    Regards,
    Mike Wooten
    "Jeff Carey" <[email protected]> wrote:
    >
    Please elaborate.
    How are the structures, e.g. gltrans-workType, defined in the Web service?
    In
    other words, what definition in Java resulted in the WSDL statements?
    What is the signature of method submitGLTransWorkAsJavaBean() in the
    Web service?
    Was the WSDL generated using the WL tools for creating a Web service?
    Thank you.
    "Michael Wooten" <[email protected]> wrote:
    Hi Jeff,
    Sounds like a pretty cool prototype :-)
    I have attached a WSDL (at the bottom of this post) that contains a<schema>
    that
    uses a SOAPArray to create an array of a <complexType>.
    HTH,
    Mike Wooten
    "Jeff Carey" <[email protected]> wrote:
    The method of a prototype Web service I created is defined to take
    many
    parameters
    and return an object of a user defined class. Furthermore, the user
    defined class
    includes data elements of another user defined class and the Java ArrayList
    class.
    This works with a Java client referencing the WebLogic created client.jar
    file
    but I don't know how well it will work with a non-Java client. Inparticular,
    with Perl which is the language that will be used by the developerwho
    first will
    test with the prototype.
    In posts to this newsgroup use of "language-specific, generic containers"
    has
    been discouraged and the "language-agnostic" SOAPArray recommended.
    I have searched
    this newgsroup and the Web for examples of how to use a SOAPArray in
    a Web service
    EJB to receive parameters and return results but found none.
    Will someone refer me to an example or give an overview of how a Java
    Web service
    EJB running in WebLogic 6.1 would use SOAPArray to get parameter values
    and return
    results?
    Also, I would like confirmation that it is best to use SOAPArray toexchange
    data
    with a Web service to achieve the goal of a service accessible by any
    language.
    Thank you.

  • I can't figure out how to use coldfusion debugging on a remote server

    I can't figure out how to use coldfusion debugging on a CF
    installation on a remote server. Has anyone got experiance, I can't
    find any step by step instructions on how to do this using FLEX
    BUILDER 3

    Look at Chapter 13 of the iPad iOS4.3 User Guide

  • How to test SOAP request using XML SPY

    Hi,
    1. I am new to WebServices concept, I have downloaded the wsdl file and now I need to test the SOAP requests using XML Spy. However, when I try to test the SOAP request generated by XML Spy I receive an error "Internal Error: Session is not available. Aborting" , How do I go ahead to generate the session, Is there a way I can provide the Username and password in the XML Spy to generate something like session.
    2. The second problem that I am facing is when I import the WSDL in XML Spy and generate the SOAP request, for all the fields xml tags gets populated with "aaaaaaaaaaaa" kind of data through out. Am i doing something wrong ? Is there some step while creating a SOAP request that I am missing becasue of which the gibbrish data is being populated as default ?
    Please Help !
    Thanks .

    I got my SOAP Requests tested using SOAP UI .. However I am still looking for ways to test it using XML SPY.
    In the SOAP UI Tool just do right click and select Add WS Security Token ..
    Thanks :)

  • Any one knows how to use Axis Framework in the SOAP Adapter Modules

    How to use Axis Framework in the SOAP Adapter?
    How to add custom handler modules?
    http://help.sap.com/saphelp_nw04/helpdata/en/45/a4f8bbdfdc0d36e10000000a114a6b/frameset.htm
    I went through the above link on help.sap.com. But still could not create a working example.
    I have created a wc on some 3ed party app server using apaches axis. I am trying to call that web service from XI using SOAP receiver? I need to add some security related headers to the soap message, SO I am trying to use a handler.  I want to know how to configure this handler in SOAP axis adapter module.
    Thank you
    Moni

    Ravi ,
    I am trying exactly the same. Hers is the scenario.
    ABAP Proxy --> PI (7.0) SP 12 ---> WebService.
    Since This is service is secured, means it is using OASIS web servie securyty user name token,
    I am trying to use AXIS adapter. and I want to configure HandlerBean in which I want to use apache wss4j api to add the userNameToken. I am looking for some documentation on this.
    I need to add SOAP action element too as I can not configure this one on the communication channel.
    Thanks for any inputs in this regard.
    Moni

  • How do I save a file to a server using flex and coldfusion?

    How do I save a file to a server using flex and coldfusion?
    On the CF side I might need to use this:
    <cffile action="UPLOAD" filefield="Filedata"
    destination="#expandpath('..\somepath)#"
    nameconflict="overwrite">
    And on the flex side I might need to use something like this:
    var sendVars:URLVariables = new URLVariables();
    sendVars.action = "upload";
    var request:URLRequest = new URLRequest();
    request.data = sendVars;
    request.url = _strUploadScript;
    request.method = URLRequestMethod.POST;
    _refUploadFile = new FileReference();
    _refUploadFile = _arrUploadFiles[_numCurrentUpload].data;
    _refUploadFile.addEventListener(ProgressEvent.PROGRESS,
    onUploadProgress);
    _refUploadFile.addEventListener(Event.COMPLETE,
    onUploadComplete);
    _refUploadFile.addEventListener(IOErrorEvent.IO_ERROR,
    onUploadIoError);
    _refUploadFile.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
    onUploadSecurityError);
    _refUploadFile.upload(request, "file", false);
    I just don't know how to put it all together in Coldfusion.

    try this...
    http://cf-creations.co.uk/blog/index.cfm/2008/9/20/Flex--File-Upload-Form--Part-One--Build ing-The-Initial-Form

  • How to capture SOAP fault when using "Do not use SOAP envelope" parameter

    Hi,
    we have a synchronous  RFC -> XI -> Web Service scenario. The Web Service requires some custom SOAP header elements for user authorization which forced us create the entire SOAP message in a message mapping and to set the "Do not use SOAP envelope" parameter in the receiving SOAP adapter.
    In order to capture the SOAP fault message from the Web Service we have created a message interface with a fault message and also created an interface mapping with a fault message mapping.
    Our problem is that the fault message is not populated when we get a SOAP fault message back from the Web Service. Is this due to the fact that we have set the  "Do not use SOAP envelope" parameter?
    Thanks in advance!
    Stefan
    Message was edited by:
            Stefan Nilsson

    Hi Bhavesh,
    I have exaactly same scenario. But the only difference is that the Successful payload is also not coming into PI.
    The request is successfully hittng the webservice.
    Please guide me on how to capture the paylod.
    I am using the WSDL provided by the thirdparty but sill the message is not coming into PI.

Maybe you are looking for

  • Over shipment delivery out of 100 PO qty 1104 qty is done

    Hi Every one, In our company we have a STPO process which will be done in NB standard document type and its consider as sale there will be not be any item category involved and for one of my  user STPO  PO qty is 100kg and committed is 1104kg and del

  • Printing in Acrobat X gives an extra unwanted line in the bottom margin

    Printing in Acrobat Reader X gives an extra unwanted line in the bottom margin. This margin should normally be blank. The line pattern follows the pattern of the print inside the margins. How can I print without this extra line?. The problem does not

  • CALLING ALL DVD GURUS!

    Hey guys, Burning DVD's is all new to me never really had to do till now. But I'd like to ask just some general questions and clear some things up: -MPEG2 is the proper format for DVD, it contains both audio and video, right? -Will an MPEG2 play dire

  • Can we use Boolean or Validations in HFM Rules

    Hi Gurus Can we use Boolean or Validations for input cells in HFM? Example: 1. I want to restrict the user to enter only single digit (0 or 1 are valid) in to a cell for a special purpose. (in smartview or webform) 2. I want to restrict the user to e

  • Save functinality for a zcomponent (table view)

    Hi , I have created a zcomponent with a table view in it. i have include the zcomponent(table view) in BP page. Now when i press on save button of BP page ,i need to save the data entered in the custom table view. so i need to redefine the save evene