Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Getting Started / April 2009



Tip: Looking for answers? Try searching our database.

how to call this webservice

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
shafiur - 19 Mar 2009 23:15 GMT
How do I call this webservice?
I am trying to call using this code but it displays an error:?
Please help me.....

ACtual webservice
<cffunction name="getWebProfileHTML" access="remote" output="false"
returntype="string" displayname="getWebProfileHTML">
    <cfargument name="passedStruct" required="false">
    <cfset var return = "">
    <cfif structKeyExists(arguments.passedStruct,"submit")>
        <cfset request.credentials.username = arguments.passedStruct.username>
        <cfset request.credentials.applicationToLogin =
arguments.passedStruct.applicationToLogin>
-----------
-------------
</cffunction

--------------------------------------------------------------------------------
----
Code to call webservice:

<cfset passedStruct = StructNew()>
<cfset a = StructInsert(passedStruct, "submit", "submit", 1)>
<cfset a = StructInsert(passedStruct, "username", "muddu_shafi@yahoo.com", 1)>
<cfset a = StructInsert(passedStruct, "applicationToLogin", "atccWeb", 1)>
<!---<cfset passedStruct.username ="muddu_shafi@yahoo.com">
<cfset passedStruct.applicationToLogin="atccWeb">--->
<cfoutput>#passedStruct["submit"]#</cfoutput>
<cfinvoke webservice="http://localhost:8500/library/BaseConsole.cfc?wsdl"
        method="getWebProfileHTML"
        argumentcollection="#passedStruct#"
        returnvariable="profilehtml">
        </cfinvoke>
<cfoutput>#profilehtml#</cfoutput>
-------------------------------------------------------------------

Error displayed

Web service operation getWebProfileHTML with parameters
{username={muddu_shafi@yahoo.com},submit={submit},applicationToLogin={atccWeb}}
cannot be found.  
 
 
The error occurred in C:\ColdFusion8\wwwroot\selfprojects\webservices1.cfm:
line 19
 
17 :         method="getWebProfileHTML"
18 :         argumentcollection="#passedStruct#"
19 :         returnvariable="profilehtml">
20 :         </cfinvoke>
21 : <cfoutput>#profilehtml#</cfoutput>
GArlington - 20 Mar 2009 15:24 GMT
> How do I call this webservice?
>  I am trying to call using this code but it displays an error:?
[quoted text clipped - 4 lines]
> returntype="string" displayname="getWebProfileHTML">
>         <cfargument name="passedStruct" required="false">
Here you define your webservice as accepting 1 (ONE) argument of
UNKNOWN type...
>         <cfset var return = "">
>         <cfif structKeyExists(arguments.passedStruct,"submit")>
[quoted text clipped - 21 lines]
>                 returnvariable="profilehtml">
>                  </cfinvoke>
Here you attempt to call the method with MULTIPLE arguments...
What did you expect? Obviously it can NOT find such method...
Remove <cfargument name="passedStruct" required="false"> statement
from method definition or call it with ONE parameter...
>  <cfoutput>#profilehtml#</cfoutput>
>  -------------------------------------------------------------------
[quoted text clipped - 13 lines]
>  20 :            </cfinvoke>
>  21 : <cfoutput>#profilehtml#</cfoutput>
BKBK - 28 Mar 2009 10:27 GMT
For a start, add attribute [i]type="Struct"[/i] to the cfargument tag.
byron1021 - 02 Apr 2009 01:29 GMT
Argument is a structure containing all the parameters.  Easiest thing to change
is

<cfinvoke webservice="http://localhost:8500/library/BaseConsole.cfc?wsdl"
        method="getWebProfileHTML"
        returnvariable="profilehtml">
<cfinvokeargument name='passedStruct' value="#passedStruct#">
        </cfinvoke>

Alternately, you could do the cfinvoke as is, and change the function with
cfarguments of username, applicationToLogin, and submit.

<cffunction name="getWebProfileHTML" access="remote" output="false"
returntype="string" displayname="getWebProfileHTML">
    <cfargument name="username" required="false">
    <cfargument name="submit" required="false">
.. but you'd have to edit the rest of the function.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.