Skip to main content
February 24, 2010
Answered

Simple Web Service fails

  • February 24, 2010
  • 1 reply
  • 621 views

This one is clearly me doing something stupid.

in c:\inetpub\wwwroot I have these two files:

DropShip.cfc

------------------

<cfcomponent>
  <cffunction name="NewOrder" returnType="string" access="remote" output="false">
    <cfargument name="Version" type="string" required="yes">
    <cfreturn "Ack">
  </cffunction>
</cfcomponent>

TestShip.cfm

------------------

<cfinvoke 
  webservice = "http://localhost/DropShip.cfc?WSDL"
  method = "NewOrder"
  timeout="10"
  returnVariable = "request.WebOrder">
  <cfinvokeargument name="Version" value="1.0" />
  </cfinvoke>
<cfoutput>[#request.WebOrder#]</cfoutput>

and the result I get back is:

Web service operation NewOrder with parameters {Version={1.0}} cannot be found.

If I remove the <cfargument> and <cfinvokeargument> it works.

So what silly thing am I doing wrong?  Pile on, I can take it!

This topic has been closed for replies.
Correct answer insuractive

2 things to check -

1) Pull up the WSDL in the browser that make sure the methods and arguments listed there are what you expect.

2) If you make changes to your web service, you need to open up the CF administrator, navigate to the Web Services section and hit the refresh icon next to your DropShop.cfc?wsdl entry.  CF server doesn't automatically detect when a web service's interface has changed. I suspect that may be what's going on with your problem here.

1 reply

insuractiveCorrect answer
Inspiring
February 24, 2010

2 things to check -

1) Pull up the WSDL in the browser that make sure the methods and arguments listed there are what you expect.

2) If you make changes to your web service, you need to open up the CF administrator, navigate to the Web Services section and hit the refresh icon next to your DropShop.cfc?wsdl entry.  CF server doesn't automatically detect when a web service's interface has changed. I suspect that may be what's going on with your problem here.

February 25, 2010

Refreshing the Web Service in Admin worked perfectly.

That leads to another problem-- the developers do not have access to CF Admin, so they cannot do a refresh when they make changes.

I suspect that this is a problem that I will have to learn to live with.  Too bad the invokation of a web service is tied to CFAdmin.  Seems like a bad idea, but then I probably don't understand all the ramifications.  Wouldn't be the first time!

Thanks!

February 27, 2010

Not sure where I found this but I think its designed to accomplish what you're after...

hth,

D.

<cfcomponent displayname="BaseWebService" output="false" hint="This handles core web service features.">

    <cffunction name="Init" access="public" returntype="any" output="false" hint="Returns an initialized web service instance.">

        <cfreturn THIS />

    </cffunction>

    <cffunction name="RebuildStubFile" access="remote" returntype="void" output="false" hint="Rebuilds the WSDL file at the given url.">

        <cfargument name="Password" type="string" required="true" />

        <cfif NOT Compare( ARGUMENTS.Password, "sweetlegs!" )>

            <cfset CreateObject

                    (

                        "java",

                        "coldfusion.server.ServiceFactory"

                    ).XmlRpcService.RefreshWebService

                        (

                            GetPageContext().GetRequest().GetRequestUrl().Append( "?wsdl" ).ToString()

                        )

            />

        </cfif>

        <cfreturn />

    </cffunction>

</cfcomponent>

AND then to use it ...

<cfcomponent displayname="Essence_WebServices" output="false" hint="Interactivity is handled exclusively in this CFC." extends="BaseWebService">

    <cffunction name="RebuildStubFile" access="remote" returntype="void" output="false" hint="Returns an initialized web service instance.">

        <CFSet super.RebuildStubFile('sweetlegs!') />

    </cffunction>

</CFComponent>

Message was edited by: GrandNagel