Brad,

I tried passing the authentication stuff via the addSOAPRequestHeader, but
there's something else going on here.

What I've learned in the last couple of hours is that when using
CreateObject to call a web service you can pass it a portname. I know from
looking at the wsdl itself, that there are several portnames associated with
this particular web service.

The author of the web service suggested that I start by using the
getIPAddress() method as it requires NO AUTHENTICATION. So I do this:

<cfscript>
    wsurl = "https://www.blackbookws.com/UsedCarWS.asmx?WSDL";;
    portname = "UsedCarWSSoap12";
    ws = CreateObject("webservice", wsurl, portname);
</cfscript>

<cfdump var = "#ws#">
<cfdump var = "#ws.getIPAddress()#">

Try the code above. You'll see that dumping ws *does indeed* show you the
available methods. There is exactly one available method: getIPAddress().
I've verified this also using SOAPUI (http://www.soapui.org/).

when I run the code above the last dump statement causes the error:
*Web service operation getIPAddress with parameters *{}* cannot be found.*

So, as an experiment I searched the web for some other free soap web service
that wouldn't require some sort of login. I found geocoder.us (
http://geocoder.us/dist/eg/clients/GeoCoderPHP.wsdl). I looked at some
sample php code, and could easily see how it translated over to ColdFusion.
My code became:

<cfscript>
    address = "1600 Pennsylvania Av, Washington, DC";
    wsurl = "http://geocoder.us/dist/eg/clients/GeoCoderPHP.wsdl";;
    ws = CreateObject("webservice", wsurl);
    //I found the geocode_address() method by looking at the dump
    //of the ws object returned by the previous line...
    geo = ws.geocode_address(address);
</cfscript>

<cfdump var = "#ws#">
<cfdump var = "#geo[1].getLat()# , #geo[1].get_long()#">

This web service worked like a champ for me! :o) So, I'm not sure what's up
with the other one.
As far as the dumping thing goes, I will admit that there are a few things
I'm not seeing, like the UserCredentials thing (which is a complexType...
maybe that has something to do with it).

You're right that the Stub functions in the parent class have nothing to do
with the web service itself. Those are functions that CF uses under the hood
I think to deal with the web services... I think.

Anyway, I'm still stumped as to why my example using geocoder.us worked
while my very similar example with blackbookusa.com isn't working...

I've contacted the developer at blackbook, but probably won't hear from him
until Monday. I would love to figure this out this weekend if I could.

Thanks for sticking with me and for continuing to offer suggestions. :o)

Chris


On Fri, Jan 23, 2009 at 7:10 PM, Brad Wood <[email protected]> wrote:

> A web service is not like a CFC where you can cfdump it out and get all the
> methods.  Those underlying methods you are seeing aren't going to help you
> at all.
>
> The actual methods you can call are documented in the WSDL itself.  I
> glanced through it and holy cow it is long.  Didn't the web service vendor
> provide some documentation on calling it?
> I must say I've never really passed authentication info via the header
> before.  Chances are, you will need to use the AddSOAPRequestHeader
> function
> (http://livedocs.adobe.com/coldfusion/8/htmldocs/functions_a-b_03.html)
>
> I would try to fool around and get a working example, but I'm not too good
> at deciphering WSDL's and I don't have a username/pass anyway.
>
> ~Brad
>
> ----- Original Message -----
> From: "Chris Jordan" <[email protected]>
> To: "cf-talk" <[email protected]>
> Sent: Friday, January 23, 2009 5:36 PM
> Subject: Re: How do I traverse XML using ColdFusion?
>
>
> > John,
> >
> > The stub methods I'm referring to are part of apache Axis which are part
> > of
> > some parent class that get's created when I do:
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:318473
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to