Skip to main content
Inspiring
February 19, 2009
Answered

Consuming a web service

  • February 19, 2009
  • 4 replies
  • 541 views
I am not sure how to get to a web service. The web service is written in Perl and from a browser I pass it a string, and the service passes back my results:

I enter to the browser:
http://server/chkuser.pl?ID=12345

and either a 0 or a longer string is returned.

How do I call this web service from a CF page?

How do I reference what is returned?
    This topic has been closed for replies.
    Correct answer Newsgroup_User
    spacehog wrote:
    > So then the webservice as we currently have it is not useable?
    >
    > Is there any way then to pass a URL like:
    >
    > http://servername/filename.pl?ID=12345
    >
    > and be able to use the string that is passed back?
    >

    Well that does not seem to be a web service. If you just want to
    request an HTTP url, the <cfhttp...> tag is pretty useful for this.

    <cfhttp url=" http://servername/filename.pl?id=12345">

    OR

    <cfhttp url=" http://servername/filename.pl">
    <cfhttpparam name="id" value="12345" type="url">
    </cfhttp>

    and then

    <cfoutput>#len(cfhttp.filecontent)#</cfoutput>
    OR
    <cfoutput>#httpCodeFormat(cfhttp.filecontent)#</cfoutput>

    4 replies

    Newsgroup_UserCorrect answer
    Inspiring
    February 19, 2009
    spacehog wrote:
    > So then the webservice as we currently have it is not useable?
    >
    > Is there any way then to pass a URL like:
    >
    > http://servername/filename.pl?ID=12345
    >
    > and be able to use the string that is passed back?
    >

    Well that does not seem to be a web service. If you just want to
    request an HTTP url, the <cfhttp...> tag is pretty useful for this.

    <cfhttp url=" http://servername/filename.pl?id=12345">

    OR

    <cfhttp url=" http://servername/filename.pl">
    <cfhttpparam name="id" value="12345" type="url">
    </cfhttp>

    and then

    <cfoutput>#len(cfhttp.filecontent)#</cfoutput>
    OR
    <cfoutput>#httpCodeFormat(cfhttp.filecontent)#</cfoutput>
    spacehogAuthor
    Inspiring
    February 19, 2009
    So then the webservice as we currently have it is not useable?

    Is there any way then to pass a URL like:

    http://servername/filename.pl?ID=12345

    and be able to use the string that is passed back?
    spacehogAuthor
    Inspiring
    February 19, 2009
    So I have to know the URL of the WSDL and the method?

    Inspiring
    February 19, 2009
    quote:

    Originally posted by: spacehog
    So I have to know the URL of the WSDL and the method?



    yes
    BKBK
    Community Expert
    Community Expert
    February 19, 2009
    <cfset wsObject=createobject("webservice", "url_of_web_service_wsdl")>
    <cfset x = wsObject.wsMethodCall(arguments_if_any).