3 Replies Latest reply on Dec 18, 2006 1:40 PM by insuractive

    Invoking web services from coldfusion page

      Hi there...

      Could someone please help?
      I am trying to invoke a webservice with .wdsl file which contains many methods. Does anybody know how to invoke this...This is my current code:

      webservice = " http://localhost/callcredit.wsdl"
      method1 ="Job5300"
      <cfinvokeargument name="title" value="#form.title#"/>
      <cfinvokeargument name= "forename" value="#form.forename#"/>
      <cfinvokeargument name="surname" value="#form.surname#"/>
      <cfinvokeargument name="DOB" value="#form.DOB#"/>
      <cfinvokeargument name="buildingNumber" value="#form.buildingNumber#"/>
      <cfinvokeargument name="postCode" value="#form.postCode#"/>

      This is the error message I am getting at the moment:

      [Web service operation "Job5300" with parameters {} could not be found]

      Hoping this is understandable....could someone tell me what I am doing wrong...


        • 1. Re: Invoking web services from coldfusion page
          insuractive Level 3
          First off, all of your <cfinvokeargument> tags have to be nested within a <cfinvoke></cfinvoke> tag pair. It looks like you close the <cfinvoke> tag after you specify your return variable.

          Secone, I think you may be restricted to calling only 1 method per <cfinvoke>. For example, you could use the following code to call your Job5300 method:

          webservice = " http://localhost/callcredit.wsdl"
          method="Job5300" returnvariable="VarName">

          <cfinvokeargument name="foo" value="boo"/>

          and then another <cfinvoke> call for method Job5301.

          If you want to avoid multiple <cfinvoke> calls, you could always create the webservice using CFOBJECT:

          <cfobject webservice=" http://localhost/something.wsdl" name="objWS">
          <cfset job5300result = objWS.job5300(var1, var2, etc)>
          <cfset job5301result = objWS.job5301(var1, var2, etc)>
          <cfset objWS = "">
          • 2. Re: Invoking web services from coldfusion page
            critical5 Level 1
            Thanks Insuractive,

            As you can tell I am new to the whole idea of web services and coldfusion....anyway here goes...

            I have the following code in my .wdsl code which I guess tells me what parameters and methods it is expecting from me
            [<message name="SOAP_webcr">
            <part name="io" element="nsp:webcr"/>
            <message name="SOAP_apicr">
            <part name="io" element="nsp:apicr"/>
            <message name="SOAP_apipwc">
            <part name="io" element="nsp:apipwc"/>
            <message name="SOAP_apiucml">
            <part name="io" element="nsp:apiucml"/>
            <message name="header">
            <part name="credentials" element="nsp:credentials"/>
            <part name="action" element="nsp:action"/>
            <portType name="soap_port">...] then methods

            [<operation name="Job5300">
            <input message="nsp:SOAP_webcr"/>
            <output message="nsp:SOAP_webcr"/>
            <operation name="Job5301">
            My problem is: do i need just one parameter["io"] for all of my methods?.....how abt [<part name="credentials" element="nsp:credentials"/>
            <part name="action" element="nsp:action"/>]............What are they??

            Sorry if this sounds silly

            • 3. Re: Invoking web services from coldfusion page
              insuractive Level 3
              Look to see if you have a <wsdl:types> or <types> element in the WSDL. that should be where it defines the type of parameters the different element types (i.e. nsp:webcr,nsp:apicr, etc) take. An easier way would be to load the webservice in Dreamweaver or .NET studio (if you have either of them), and it should give you a visual interface where you can take a look at the inputs for the webservice methods.