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

RE: HTTPAPI - character set utf-8



Sender: "Mendoza, German   \(RCIS\)" <German.Mendoza@xxxxxxxx>

I just thought that the web server is expecting the POST data to be in
UTF-8 due to the message in the httpapi_debug.txt that said: Request
format is invalid: text/xml; charset=utf-8.

I can get the data by doing an HTTP post with a string and a
content-type of application/x-www-form-urlencoded along with
http_url_post.  This writes to the IFS just fine.  I just wanted to try
and call the same web service with http_url_post_XML to see how this
works and being able to parse the received document immediately after
that post_xml.

-----Original Message-----
From: owner-ftpapi@xxxxxxxxxxxxx [mailto:owner-ftpapi@xxxxxxxxxxxxx] On
Behalf Of Scott Klement
Sent: Friday, February 10, 2006 12:07 PM
To: ftpapi@xxxxxxxxxxxxx
Subject: Re: HTTPAPI - character set utf-8

Sender: Scott Klement <sk@xxxxxxxxxxxxxxxx>


> 1) When I build the SOAP package, do I still need to convert this to
> UTF-8 (ccsid of 1208)?

Depends on how you're calling HTTPAPI.  Normally, HTTPAPI translates
data 
from your job's CCSID to US-ASCII (CCSID 367) because that's the
standard 
for the HTTP protocol.

If you think about it, that's not really correct behavior.  Yes, the
HTTP 
protocol is US-ASCII, so all of the HTTP keywords need to be in that 
CCSID, but the data that you upload isn't a part of that, so that data 
should NOT be encoded that way.

In fact, originally, HTTPAPI didn't encode the data you uploaded.  But 
this confused the heck out of people because the web server didn't
expect 
to be receiving EBCDIC data, and it seemed like a lot of extra work to 
manually re-encode everything before sending it.

So, HTTPAPI was changed to encode the POST data along with everything 
else. However, there are three exceptions to this rule:

    http_url_post_raw2()
    http_url_post_stmf()
    http_url_post_stmf_xml()

These 3 APIs do not change the data that you upload at all.  So if you 
want to upload data that's in CCSID 1208, it'd be relatively easy to use

these to do it.

Use the IFS APIs to write your data to a stream file. The IFS APIs can 
automatically translate to 1208 when the data is written.  You can then 
use http_url_post_stmf() to send the document to the server.

CCSID 1208 should be no problem at all on the receiving side.

> 2) Here's the SOAP package, does it need a CRLF (const(x'od25)) at the
> end of each line?

It doesn't matter if there's a CRLF.  In XML, that CRLF is ignored.
It's 
nice to have it because it's easier for a human being to read the data 
when it's broken into lines, but it's not required.

FWIW, I didn't see ANYTHING in that document that would require you to 
send UTF-8 data. So I don't see why it's important to get UTF-8 working.

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------