Hi Chris,

I have been following this thread out of curiosity, and I think I
might be able to help in pointing you in the right direction.

The key bit here is the fact that the getIPAddress method has an input
parameter, identified in the dump of the stub as:

localhost.webservices.UsedCarWS.IPAddress

In the WSDL, this is defined as:

<s:element name="IPAddress">
    <s:complexType/>
</s:element>

So it's a complex type, but has no child elements, which corresponds
to an empty CF structure. Therefore, if you change your code snippet
to:

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

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

The second dump will display the object returned by the method call,
which in turn has a getIPAddressResult() method that returns the IP of
the CF server calling the web service:

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

<cfdump var = "#response.getIPAddressResult()#">

Hope that helps.

--
Ezra Parker



On Fri, Jan 23, 2009 at 5:54 PM, Chris Jordan <[email protected]> wrote:
> 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

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:318475
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to