Ketan,
I used cfx_rawsocket for talking with UPS to implement the XMLTrack feature on the website for my old employer. Here is the chunk of code I used to do it. This was for CF 4.5 so I had to use the cf_SOXML tag to get at the XML that was returned. Hope this helps you.

Ben

<!--- Build XML Access and Tracking Request Files to send to UPS --->
      <cfset sendAccessRequest = '
  <?xml version="1.0"?>
       <AccessRequest xml:lang="en-US">
         <AccessLicenseNumber>#AccessLicenseNumber#</AccessLicenseNumber>
           <UserId>#UserId#</UserId>
           <Password>#Password#</Password>
         </AccessRequest>
  <?xml version="1.0"?>
        <TrackRequest xml:lang="en-US">
         <Request>
          <TransactionReference>
            <CustomerContext>Example 1</CustomerContext>
            <XpciVersion>1.0001</XpciVersion>
          </TransactionReference>
            <RequestAction>Track</RequestAction>
            <RequestOption>activity</RequestOption>
          </Request>
          <TrackingNumber>#getTrackingInfo.trackingNum#</TrackingNumber>
       </TrackRequest>'>
   
   <!--- Build Post Message to send to UPS --->
   <cfset postmessage = "POST /ups.app/xml/Track HTTP/1.1#newline#">
       <cfset postmessage = postmessage & "Host: www.ups.com:80#newline#">
       <cfset postmessage = postmessage & "Content-type: application/x-www-form-urlencoded#newline#">
       <cfset postmessage = postmessage & "Content-Length: #Len(sendAccessRequest)##newline#">
       <cfset postmessage = postmessage & "Accept: */*#newline##newline#">
       <cfset postmessage = postmessage & sendAccessRequest>
   
   <!--- CFX_Rawsocket Custom Tag --->
   <CFX_RAWSOCKET
   server="www.ups.com"
   port="443"
   protocol="HTTPS"
   message="#postmessage#"
   responsevar="SocketOutput">
   <!--- cfoutput>#SocketOutput#</cfoutput --->
   <!--- Raw Socket tag returns Header Info that breaks the cf_SOXML tag, So we must look for the starting
         Element <?xml version="1.0"?> before we write the xml file --->
       <cfset StartingPosition = Find('<?xml version="1.0" encoding="UTF-8"?>',SocketOutput)>
       <cfset XMLResponse = Mid(SocketOutput,StartingPosition,Len(SocketOutput) - StartingPosition)>
       <cflock name="writeUPSXML" timeout="20" throwontimeout="no" type="exclusive">
   <cffile action="" file="#path#tracking\xmlups\response.xml" output="#XMLResponse#" addnewline="no">
       </cflock>
   <!--- cf_SOXML Custom tag to read in the XML file --->
       <cf_SOXML
        action="">         input="#path#tracking\xmlups\response.xml"
        output="trackingResponse"
        type="file">
     </cfif>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to