[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Attempt at a UPS PLD posting





Hello Nicholas,

>    I had issues with my UPS PLD posting where no UPS response was given
>    due to my limited knowledge of HTTP and SOCKET calls.

My apologies, but... I have never set up UPS PLD, so I'm not certain how 
it's supposed to work.  I can make guesses based on your code, but 
that's all they are: guesses!

I see this:

Data = 'POST /hapld/tos/kdwhapltos HTTP/1.1' + CRLF;
Data = Data + 'Host: www.pld-certify.ups.com' + CRLF;
Data = Data + 'Content-type: multipart/mixed; boundary=BOUNDARY' +CRLF;
         Data = Data + 'Content-length: 1261' + CRLF + CRLF;

This is almost certainly wrong.  HTTPAPI takes care of the HTTP protocol 
for you.  You don't have to code your own HTTP protocol in your program! 
   You're writing your code as someone would if they were writing their 
own HTTP tool instead of using mine.

Please remove all of the above from your 'Data'.  HTTPAPI will 
automatically fill all of that stuff in for you.

However, *do* pass the peContentType parameter to http_url_post() and 
set it to 'multipart/mixed; boundary=BOUNDARY'  That will make your call 
to http_url_post look like this:

      C                   Eval      rc   = http_url_post(
      C                             'https://www.pld-certify.ups.com/'
      C                                        : %Addr(Data)
      C                                        : %Len(%TrimR(Data))
      C                                        : '/tmp/httptest.html'
      C                                        : *OMIT
      C                                        : *OMIT
      C                                        : 'multipart/mixed; +
      C                                        boundary=BOUNDARY')


>                Subject Problem with HTTP POST REQUEST
>                From Bruno Souche
>                Date Wednesday, January 24^th, 2007  10:22:29 +0100

You'll note that Michael Ryan replied to Bruno Souche and told him 
pretty much exactly what I just told you!

> According to UPS Host Access Support, the code that I am currently
> using appears to be sending data as a HTTP form submit (this is the
> same as loading a page in an Internet browser) and clicking the
> "Submit" button on a displayed page.  UPS is requesting an HTTP POST
> using a socket program that will stream the body of a request in the
> UPS required format.  If I understand UPSs remarks correctly, I need
> to submit and receive the UPS data in a behind-the-scenes manner.

Part of your data is indeed being sent the way a form would be 
submitted.  Specifically, this part:

     --BOUNDARY
     Content-type: application/x-www-form-urlencoded
     Content-length: 131

     AppVersion=1.0&AcceptUPSLicenseAgreement=Yes
     &ResponseType=application/x-ups-pld&VersionNumber=V4R1
     &UserId=LOG001CA&Password=LOGICOR

The 'content-type' of x-www-form-urlencoded specifically mean "www form" 
that has been "URL encoded".  The data that follows it (AppVersion=1.0, 
AcceptUPSLicenseAgreement=Yes, etc) is indeed URL encoded form data.

( Also, please note that you just sent your userid/password to a public 
mailing list. This seems to be a popular day for that!! )

However, knowing that you're currently sending data that's URL encoded 
form data doesn't tell me what the data SHOULD be.

You say it should be 'HTTP POST'.  Well, you're ALREADY using HTTP POST. 
  HTTP POST has nothing whatsoever to do with the format of the data. 
HTTP POST basically says "I want to upload a stream of data".  IT has 
nothing to do with what data is in that stream.

In your case, you appear to be sending a multi-part MIME data, where 
part of it is an HTTP form, the other part is a proprietary UPS format 
that I'm not familiar with.

If that is wrong, then you're going to have to find out what the right 
format is.

You say it has to be a "behind the scenes manner".  What the heck does 
that mean?

In order to even make an attempt at helping you, I'd need to know what 
UPS is expecting to receive.  Didn't they give you any sort of 
documentation or instructions??
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------