Socket communication is one way (ugly, but certainly works), but I
believe a majority of the HTTP problems were fixed with 6.1, as we've
implemented the UPS rate service and selection tool with CFHTTP with no
problems. The following code works fine for us -

<!--- Build UPS XML Packet --->

<cfsavecontent variable="XMLPacket"><cfoutput>

<?xml version="1.0"?>

<AccessRequest>

<AccessLicenseNumber>#AccessLicenseNumber#</AccessLicenseNumber>

            <UserId>#UserID#</UserId>

            <Password>#Password#</Password>

</AccessRequest>

<?xml version="1.0"?>

<RatingServiceSelectionRequest xml:lang="en-US">

<Request>

            <TransactionReference>

                        <CustomerContext>Rating and
Service</CustomerContext>

                        <XpciVersion>1.0001</XpciVersion>

            </TransactionReference>

            <RequestAction>Rate</RequestAction>

            <RequestOption>shop</RequestOption>

</Request>

<PickupType>

            <Code>01</Code>

</PickupType>

<Shipment>

            <Shipper>

            <Address>

<PostalCode>#attributes.originPostCode#</PostalCode>

                        <CountryCode>US</CountryCode>

            </Address>

            </Shipper>        

            <ShipTo>

                        <Address>

<PostalCode>#safePostalCode#</PostalCode>

                                    <City>#cityName#</City>

                                    <cfif Len(Trim(stateProvince)) GT
0><StateProvinceCode># stateProvince #</StateProvinceCode></cfif>

<CountryCode>#countryName#</CountryCode>

                        </Address>

            </ShipTo>         

            <Package>

                        <PackagingType>

                                    <Code>02</Code>

                                    <Description>Package</Description>

                        </PackagingType>

                        <Description>Rate Shopping</Description>

                        <PackageWeight>

                                    <Weight>#weight#</Weight>

                        </PackageWeight>

            </Package>

            <ShipmentServiceOptions/>

</Shipment>

</RatingServiceSelectionRequest></cfoutput></cfsavecontent>

<cfhttp   

            url = "">
            port = "443"   

            method = "POST"

            throwonerror="yes">

<cfhttpparam type="XML" value="#XMLPacket#">

</cfhttp>

<cfset XMLResponse = XmlParse(CFHTTP.FileContent)>

Erik Yowell

[EMAIL PROTECTED]

http://www.shortfusemedia.com

-----Original Message-----
From: Igor Ilyinsky [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 04, 2003 1:31 PM
To: CF-Talk
Subject: UPS XML Rates w/ DRK5 Socket Component

Hi Yall,

For a long time I've been looking for a good way to implement the usage
of UPS's XML based rates & service program to calculate shipping costs.
In the past, there were so many ways to do this, but they were all too
messy or tedious... i.e, not worth the simple functionality I required.
There were the custom tags that my host wouldn't let me use, the XML
hacks, or writing my own java method to do it. Everyone kept expecting
that CFMX would provide a cure but it hasn't.

The bottom line was that CF did not provide a developer with usage of a
Raw XML socket over HTTP as CFHTTP would f-up the buffer with all of its
headers. Well, now there is a component on the latest DRK that promises
to allow the raw XML Socket via the underlying java.net.Socket object.
It is called the socket component, and may just be the saving grace
here.

So has anyone used it to implement the UPS Rates & Services API? I'd be
curious to know if it works, the performance, and how it is implemented.
I think if this really does work, it will provide any developer using
CFMX 6.1 with a means to easily get real-time shipping rates with very
little programming, and for Macromedia, I think this component alone
will make buying DRK5 a great value. Furthermore, it promotes using the
underlying J2EE functionality to empower your CF app...

-Igor
-cccfug.org


  _____  


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to