Thanks for the code Erik. It works well. We will keep playing with all this new knowledge we have and see if we can come up with a nice solid solution.
> -----Original Message----- > From: Erik Yowell [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, November 19, 2002 10:18 PM > To: CF-Talk > Subject: RE: MX and UPS XML > > Here's a UDF I adapted from an amalgamation of Jon's code and Ben > Forta's HTTPGet UDF for Posting of UPS XML Posts - just append together > the XML request packet and the tracking or service selection packet > using cfsavecontent to build the materials. Unless of course there's > some sort of toString() method for converting XML structures to string > for later appending, dunno - I just got lazy and used the savecontent > tag. Oh, and it needs JRE 1.4 (SSL improvements) or I suppose you can > load JSSE into the UDF, but once again - lazy. > > function RawPost(urlString,messageString) { > // Variables > var oURL = ""; > var oPage = ""; > var oInputStream = ""; > var oOutputStream = ""; > var oConnection = ""; > var oReader = ""; > var oWriter = ""; > var oBuffer = ""; > var sLine = ""; > var sOutput = ""; > > // Init class > oURL = CreateObject("java", "java.net.URL"); > oWriter = CreateObject("java", "java.io.OutputStreamWriter"); > oReader = CreateObject("java", "java.io.InputStreamReader"); > oBuffer = CreateObject("java", "java.io.BufferedReader"); > > // Create URL Instance > oInstance = oURL.init(urlString); > > // Open URL Connection > oConnection = oInstance.openConnection(); > oConnection.setDoInput(true); > oConnection.setDoOutput(true); > oConnection.setUseCaches(false); > oConnection.setAllowUserInteraction("false"); > oConnection.setFollowRedirects("false"); > oConnection.setRequestMethod("POST"); > > nContentLength = JavaCast("string",Len(messageString)); > > oConnection.setRequestProperty("HOST",CGI.REMOTE_HOST & ":80"); > oConnection.setRequestProperty("CONTENT-LENGTH",nContentLength); > oConnection.setRequestProperty("ACCEPT","*/*"); > oConnection.setRequestProperty("USER_AGENT",CGI.HTTP_REFERER); > > oOutputStream = oConnection.getOutputStream(); > > oWriter.init(oOutputStream); > oWriter.write(messageString); > oWriter.flush(); > oWriter.close(); > > // Get stream > oInputStream = oConnection.getInputStream(); > oReader.init(oInputStream); > oBufferStream = oBuffer.init(oReader); > > sLine = oBuffer.readLine(); > > while (IsDefined("sLine")) { > sOutput = sOutput & sLine; > sLine = oBuffer.readLine(); > } > > // Close stream (Close method doesn't seem to work too well here?) > // Don't know if setting to nothing closes it or not, figure that out > later... > oInputStream = ""; > oConnection.disconnect(); > > // Parse Response > sOutput = XMLParse(sOutput); > > return sOutput; > } > > Erik Yowell > [EMAIL PROTECTED] > http://www.shortfusemedia.com > > > -----Original Message----- > From: Jon Hall [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, November 19, 2002 3:07 PM > To: CF-Talk > Subject: Re: MX and UPS XML > > I should write up a CF/UPS XML FAQ or something, seeing as how often > this question comes up. > > CFHTTP can not be used to POST XML because CFHTTP encodes all > POSTS, unless the receiver specifically takes steps to decode the XML. > These companies are in the minority in my experience though. UPS > expects non-encoded XML. That's why it doesn't work. The type=xml does > not construct the HTTP commands. It just opens a socket and sends xml. > > cfx_rawsocket probably works with the 1.4 JRE, because the 1.4 JRE > integrates SSL (JSSE), which the 1.3 JRE does not. CFHTTP with a > default CF install will not work with SSL either. UPS requires SSL. > > I posted some MX/Java code to do http posts, and the source for a > java cfx tag was posted within the last few weeks. A raw socket tag > will work as well, but you will need to construct the http posts > yourself...not difficult, just another step. If you are using MX > enterprise, you can use the Jakarta JSP Taglibs also, which are pretty > neat imo. > > > -- > jon > mailto:[EMAIL PROTECTED] > > Tuesday, November 19, 2002, 4:14:48 PM, you wrote: > > C> We actually got MX to talk to UPS for tracking. We had to use > C> CFX_RawSocket http://www.iexp.com/ > > C> Of course according to all of CFX_RawSocket's documentation it should > C> not work under MX. We upgraded the JRE to 1.4 and it appears to work > C> for UPS tracking numbers. > > C> I have no idea what we will run into by upgrading to 1.4, but we will > C> keep playing with it and see if there are any downsides. > > > > > > >> -----Original Message----- > >> From: Chad [mailto:[EMAIL PROTECTED]] > >> Sent: Tuesday, November 19, 2002 2:52 PM > >> To: CF-Talk > >> Subject: RE: MX and UPS XML > >> > >> I hate to beat this into the ground, but why won't this type of XML > >> passing work with UPS? We started looking at the Java example they > >> sent. It works, but it sure is complicated! > >> > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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 Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm

