[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
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
-----------------------------------------------------------------------