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

RE: Post to aspx



Thanks for your thorough response.  You hit all the nails on the head:  I am building a pipe-delimited file, writing to a physical file, converting with a CPYTOSTMF operation, and calling http_url_post to send it.  You are also correct about the incorrect use of (x'0a') - I have changed it to x'25'.  I tried your http-url-post-stmf example but kept getting 'The type of the parameter specified for the call does not match the prototype', so I backed off that change for now.   (But I will definitely try sending without creating a file next time - that is obviously more efficient.)   
  In answer to your point #3:  I am getting a zero-length file but as another of your mailing list subscribers pointed out, that empty file may be getting created on my side in anticipation of the returned data.  I thought I was expecting text data in return but I need to verify with the author of the aspx program.  Back to my side, after the post rc is equal to '1'.  
I am attaching the streamfile I create for the post along with a print of the httpapi_debug listing.  At this point in my http education I am not understanding what I am seeing on the debug listing.  


Julie Nichols| Summit Group
Programmer/Analyst
1100 Circle 75 Pkwy., Suite 1200 | Atlanta, GA 30339-3081
Direct line: 770-303-0432 | julie.nichols@xxxxxxxxxxxx
Fax: 770-303-0408


-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Wednesday, May 02, 2012 5:07 PM
To: HTTPAPI and FTPAPI Projects
Subject: Re: Post to aspx

Hiya Julie,

Thanks for all the info (including the Word doc with code snippets and
screenshots.)  And thanks for joining the mailing list!  That helps me a lot!

Let me see if I understand your situation correctly:

1) You are building a pipe-delimited file in your RPG program.
2) You are writing that file to a physical file.
3) You are somehow (not shown in the sample) converting that physical file to a stream file.
4) You are calling http_url_post_stmf() to send it.

There are things you are doing in this process that I don't understand:

1) You are adding an ASCII LF character (x'0a') between each record of the data before writing it to the PF.  Although the LF is in ASCII, the remainder of your record is in EBCDIC.  Presumably your stream file conversion program is taking care of an EBCDIC->ASCII translation.  Does it know that your LF characters are already ASCII and shouldn't be translated a second time?

Usually when I see folks use a PF as an intermediary, they simply write one record per line of the text file, and let the conversion program take care of inserting the linefeeds to denote where the records end. 
It's strange to see that done manually.  But, even if you do want to do it manually (like you would if writing to the IFS directly) I would've expected you to use x'25', the EBCDIC linefeed character.  So your situation surprised me.  But, perhaps you're handling that in the "conversion" program, so I'm worried about nothing :-)


2) I don't know if you need your data to also be stored in a file, but if not, I wanted to let you know that you can send the string from your program directly with HTTPAPI.  For example:

Tlin = 'T|0|' + XFaddz + '|US|' + XSmth; Vlin = 'V|' + WKvend + '|' + XTaddz + '|US'; Ilin = 'I|' + Wkvend + '|' + IBlitm +'|' + Xlngt + '|' + Xwdth +
     '|' + Xhgt + '|' + Xwgt + '|' + XDqty + '|' + Xeprc + '|pan'; Clin = 'C|1'; Data = Tlin + LF + Vlin + LF + Ilin + LF + Clin + LF;


filenm = '/ShippingCosts/httpShipRsp.txt';

rc=http_url_post_stmf('https://services.pm.summitmg.com:8443' +
                       '/FreightCosting/ProcessFreight.aspx'
                      : %addr(data:*data)
                      : %len(data)
                      : filenm
                      : HTTP_TIMEOUT
                      : HTTP_USERAGENT
                      : 'text/plain' );

(NOTE: You may have to change 'text/plain' to something else... I don't know what MIME type corresponds to the format you're sending, as I haven't seen that format before.)

This does the same thing as the post_stmf example you posted, but without the need for the PF or the STMF.

If you do it this way, I'd definitely change the definition of LF from to x'25', which is the EBCDIC equivalent of x'0a'.


3) You say you're getting a zero-length file. I'm unfamiliar with your 
application, so I don't know what sort of file you're expecting?  My 
question is:  Is HTTPAPI reporting an error?  Do you get rc=1, or 
something else?  Have you called http_error() to get an error message?


4) Have you tried creating a debug/trace file and looking at what gets 
sent/received?  If you don't know how to do that, there's a description 
under the heading "Creating Debug Logs" on the following page:

http://www.scottklement.com/httpapi/beta


Hope that helps provide some insight.



On 5/2/2012 2:51 PM, Nichols, Julie wrote:
>
>     I am trying to post package data to an aspx program and receive a
>     response (with shipping costs, etc) via a text file.  I am receiving a
>     file, but the file is empty.  Windows explorer shows the file with a
>     size but looking at the files' properties shows a 0 file size.  Am I
>     missing something major?  We have your HTTPAPI samples and I have
>     looked through them (albeit - with less than full understanding).  Can
>     one of the samples provide some illumination?
>
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------