[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: HTTPS XML - Help Needed on New App
Hi Don,
> 1. Initial attempt to execute pgm after signing onto 400 generates
> error at the "https_init"<>0 statement:
>
> Application not registered with DCM
You're correct that DCM stands for "Digital Certificate Manager".
What version of HTTPAPI are you using? (Look for the HTTP_VERSION
constant in the HTTPAPI_H member to find out)
If you're using version 1.10 or earlier, then you must register your
application with the DCM. It won't work otherwise. To do that, go into
the DCM, select the *SYSTEM certificate store, and use the "manage
applications" link (on the left-hand navigation menu) to add a new client
application definition. Make sure the application ID in the DCM matches
the one you supplied on the call to https_init().
In version 1.11 and later of HTTPAPI, you do not need to call https_init()
at all. HTTPAPI will automatically use default settings if you don't
create an application definition in the DCM. Just comment-out the call to
https_init (and the error checking that follows it) and you should be
good.
> 2. Second attempt to execute (in same session), does not get the
> DCM error, but gets error after the POSTDATA defined:
>
> XML parse failed at line 1 col 0: no element found
Sounds like you called it a second time without reclaiming the activation
group in between. In other words, the program is still in memory and is
attempting to resume where it left off.
If you sign off and back on again, you should get the "application not
registered with DCM" error again instead of this one.
> 2. Is something potentially missing with EXPAT?
Maybe... you haven't gotten far enough to tell :)
> 3. What is HTTTPAPIR4? (saw it in libhttp) Is it relevant to the
> '/copy' which points at httpapi_h? Any steps needed to compile, link
> this, etc?
HTTPAPIR4 is the main service program. When you call a routine like
https_init() or http_url_post_xml(), you're calling code that resides in
the HTTPAPIR4 service program.
A service program is what you'd call a "shared library" or "shared DLL" on
a Unix or PC environment.
You've already "linked" (or "bound" in ILE terminology) the UPSTRACK
program to the HTTPAPIR4 service program. If you hadn't, you would not
have been able to get as far as you already have. I typically
handle binding (or "linking" in PC/Unix terminology) by placing a BNDDIR
keyword on the program's H-spec. Assuming that your UPSTRACK program is
the one that I use in my HTTPAPI presentations, then that should already
be there...
> 4. Future application for invoicing uses <?xml version="1.0"
> encoding="UTF-8" ?> Are there any special considerations for this
> encoding?
Keep in mind that your RPG code is probably using an EBCDIC encoding. It
has to be translated from EBCDIC to ASCII or Unicode or whatever the
server expects it to be in. By default, HTTPAPI translates it to the CCSID
that's set in the CONFIG_H member, which IIRC, is 819. 819 is equivalent
to ISO-8859-1, so that's what you should identify your XML document as.
If you want it to be UTF-8, then you should tell HTTPAPI to translate the
document to UTF-8 instead of ISO-8859-1. You can do that by calling the
http_setCCSIDs() function of HTTPAPI. Example:
http_setCCSIDs(1208: 0);
This tells HTTPAPI to translate from 0 (the job's default CCSID) to 1208
(UTF-8 Unicode) when it uses the POST method to send a document.
Also, remember that UTF-8 supports many, many, many more characters than
EBCDIC does. If you find yourself unable to code the special characters
in EBCDIC, how can you possibly translate them to UTF-8? In that
situation, it might make sense to use RPG's built-in support for UCS-2 to
code the XML document in your program -- thus providing the full range of
Unicode characters available to UCS2 -- and then translate THAT to UTF-8
as follows:
http_setCCSIDs(1208: 13488);
Those are the considerations that come to mind. Not sure if there are
additional ones.
> POSTDATA =
> '<?XML VERSION="1.0"?>' +
> '<ACCESSREQUEST XML:LANG="EN-US">' +
> '<ACCESSLICENSENUMBER>' + UPS_LICENSE +
> '</ACCESSLICENSENUMBER>' +
> '<USERID>' + UPS_USERID + '</USERID>' +
> '<PASSWORD>' + UPS_PASSWD + '</PASSWORD>' +
> '</ACCESSREQUEST>' +
[SNIP]
This code is completely wrong. Somehow all of your XML got translated to
uppercase! Since XML is a case-sensitive medium, you'll want to fix that
before you go much further.
How did it get translated to all-uppercase?
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------