If its an actual web service that you are consuming here is what i do:

1. In CF admin register a webservice giving it the address of the WSDL.

2. on your page do

<CFSCRIPT>
ws = CreateObject("component","lib.webservice");
ws.webserviceName = "xxxxx";
myCountries = ws.getCountries();
</CFSCRIPT>

3. included file or component

<CFCOMPONENT hint="performs all webservice operations to query database
etc<BR> &nbsp; all methods require these members to be set:<BR> &nbsp;
&nbsp;  webserviceName<BR> &nbsp;  &nbsp;  contractID">
        <CFFUNCTION NAME="getCountries" access="public"
returntype="lib.objects.countryCollection" output="No">
                <CFSET var ret="">
                <CFSET var retVal="">
                <CFSET var ws="">
                <CFSET var configuratorParameters="">
                <CFSET var i=0>
                <CFSET var tmp = "">
                <CFSCRIPT>
                        if(this.webserviceName eq "")
                        {
                                utils = createObject("component",
"lib.util.wrappers");
                                utils.cfThrow("webservice not specified",
"you must set the this.webserviceName member to the name of the CF
registered webservice to use.");
                        }
                        if(this.contractID eq 0)
                        {
                                utils = createObject("component",
"lib.util.wrappers");
                                utils.cfThrow("contractID not specified",
"you must set the this.contractID member to the contractID to use.");
                        }
                        configuratorParameters = structNew();
                        configuratorParameters.contract = this.contractID;
                        ws = CreateObject("webservice",
this.webserviceName);
                        retVal = ws.getCountries(configuratorParameters);
                        
                        ret =
CreateObject("component","lib.objects.countryCollection");
                        for(i = 1; i lte ArrayLen(retVal); i=i+1)
                        {
                                tmp =
createObject("component","lib.objects.country");
                                tmp.id = retVal[i].id;
                                tmp.name = retVal[i].name;
                                ret.appendElement(tmp);
                        }
                        
                        return ret;
                </CFSCRIPT>
        </CFFUNCTION>
</CFCOMPONENT>

Hope this helps you a bit, but if you are dealing with webservices you
really should learn to read the WSDL (its not hard) and build cffunctions
from there.

If this isnt what you are looking for then maybe try to wrap the <CFHTTP> in
a <CFTRY><CFCATCH exception="any"> block and output
CFCATCH.Message and CFCATCH.Detail to find out where its going wrong.

regards,

Gunther

-----Original Message-----
From: John Stanley [mailto:[EMAIL PROTECTED]
Sent: Thursday, 31 July 2003 5:03 AM
To: CF-Talk
Subject: CF - XML Questions


All,
        I have been tasked with connecting to another companies
"webservices", and then doing some data manipluations on our end. I can
successfully connect by creating a form with their url as the action and
passing through the correct variables. In return I get an XML document.

I can successfully parse an xml document that I ALREADY have, using CF to
get to the data I need, but I cannot figuire out how to do anything with the
xml JUST sent to me. I think I need to be using CFHTTP, but am not sure
about this. Has anyone done this? 

So, I have the following HTML:

        <form name="test" method="post"
action="http://client.something.com/TESTOpenShipments/OpenShipments.dll/Open
Shipments">
                <input type="hidden" name="CarrierID" value="15">
                <input type="hidden" name="CarrierPassword"
value="password">
                <input type="hidden" name="LastServerTime">
                <input type="submit" value="Get Open Shipments">
        </form> 

This returns something like this:
        <?xml version="1.0" standalone="yes" ?>
        <OPENSHIPMENTS>
            <SERVERTIME>01/08/2002 10:00:40:430</SERVERTIME>
            <CARRIERID>????</CARRIERID>
        <SHIPMENT>
            <NLMSHIPMENTNUMBER>9656141</NLMSHIPMENTNUMBER>
            <ACCID>123456789</ACCID>
            <ACCOUNT>FORD MOTOR</ACCOUNT>
            <TIMEOUTDATETIME>12/17/2001 11:48:13</TIMEOUTDATETIME>
            <HAZMAT>NO</HAZMAT>
            <HAZMATCODE></HAZMATCODE>
            <HAZMATUN></HAZMATUN>
            <HAZMATCLASS></HAZMATCLASS>
            <CSASHIPMENT>NO</CSASHIPMENT>      
            <CRITICAL>YES</CRITICAL>
            <ASAP>NO</ASAP>
            <READY>12/17/2001 11:24:000</READY>
        </SHIPMENT>


I am assuming that because I have to parse the data WHEN it is sent to me,
then I need to use CFHTTP.
I have tried to resolve this page using cfhttp as in:
<cfhttp
url="http://client.something.com/TESTOpenShipments/OpenShipments.dll/OpenShi
pments" method="POST" resolveurl="false" proxyserver="192.168.36.999"
proxyport="80">
        <cfhttpparam type="formfield" name="CarrierID" value="15">
        <cfhttpparam type="formfield" name="CarrierPassword"
value="password">
        <cfhttpparam type="formfield" name="LastServerTime" value="">
</cfhttp>

<cfoutput>
        file content: <br> #cfhttp.filecontent#
</cfoutput>

But I keep getting the following error:
file content: 
Connection Failure 
I dont know if this is because of proxy server settings. 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to