Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Simple Web Service fails

Guest
Feb 24, 2010 Feb 24, 2010

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!

TOPICS
Advanced techniques
557
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , Feb 24, 2010 Feb 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.

Translate
Advocate ,
Feb 24, 2010 Feb 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 25, 2010 Feb 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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 26, 2010 Feb 26, 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 27, 2010 Feb 27, 2010
LATEST

Al Baker wrote:

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!

Nil desperandum. This will refresh the web service programmatically:

<cfobject action="create" type="java" name="serviceFactory" class="coldfusion.server.ServiceFactory"> 
<cfset rpcService = serviceFactory.XmlRpcService>
<cfset rpcService.refreshWebService("http://localhost/DropShip.cfc?wsdl")>

ws refreshed!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources