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

Re: MIME Header



Hello Charles,

Please understand that all web services are different.  If I'm following 
your messages correctly (and I'm struggling a bit) you need to add some 
custom HTTP headers to what HTTPAPI sends.  This is a non-standard thing 
(no web browser, for example, would ever do that) but HTTPAPI does have 
a mechanism for providing additional HTTP headers.

The mechanism is the http_xproc() routine that lets you register 
callback handlers for certain events.  In this case, the 
HTTP_POINT_ADDL_HEADER callback is the one you want to use.

PLEASE don't use this for the standard headers like content-type, 
user-agent or content-length.  HTTPAPI will do this for you as would any 
standard HTTP client.

However for custom headers that aren't part of the HTTP standard, like 
auth-mid, auth-tid, merchant-id, et al, you can use this callback.




On 3/4/2010 9:55 AM, Versfelt, Charles wrote:
>
> Okay, I'm back full circle on this one.  I was given the specs for the "MIME Header" and added it to my XML document, but I'm still getting the same error.
>
> I was told, additional to the MIME header was an HTTP header, which is the following line:
>
> POST /AUTHORIZE HTTP/1.0
>
> Here's the contents, in part, of the file I'm sending (I also tried it without the "POST/AUTHORIZE" line, same results)
>
> POST /AUTHORIZE HTTP/1.0
> MIME-Version: 1.1
> Content-type: PTI47
> Content-transfer-encoding: text
> Request-number:1
> Document-type: Request
> Content-length: 709
>
> <?xml version="1.0" encoding="UTF-8"?>
> <Request>
>    <NewOrder>
>       <IndustryType>MO</IndustryType>
>       <MessageType>A</MessageType>
>       <BIN>000001</BIN>
>       <MerchantID>041756</MerchantID>
>
> According to Paymentech, my data is correct, my header is correct, but, in their words, "the issue seems to be how the program is setting this data."  I'm not sure what they mean by "setting" the data.
>
> Here's a copy/paste of the e-mail I was sent.
>
> It also contains a flowchart image of "SOAP" on an iSeries, first time SOAP has been mentioned in this project.
> For some reason my Outlook doesn't want to let me copy/paste the image into the e-mail.
>
> -----
> The e-mail Payment tech sent me:
>
> Charlie,
>
> I have checked with the Product Manager on this and what has been provided is correct however the issue seems to be how the program is setting this data.  When using a true HTTP client, it is doing the lifting to set these data sets correctly.  This first line, 'POST...' defines the message as an HTTP Post versus a 'Get' and it set by the HTTP client automatically.
>
> Is there anyone from your team that can assist you with this or look into a HTTP client that can be run from the AS400 to set the data correctly?  We have provided everything to help you on this.
>
> He did send along this information as well and he provided a picture of a SOAP interface on an AS/400.
>
> Here is a sample header from a payload.  Notice first that the Post part is not there, because again it is not technically part of the MIME.  It is simply prerequisite data on all HTTP requests and the format is consistent regardless of which interface is used.
>
> auth-mid:999999
> auth-tid:001
> connection:Keep-Alive
> content-length:1349
> content-transfer-encoding:text
> content-type:application/PTI47
> document-type:Request
> merchant-id:999999
> mime-version:1.0
> request-number:1
> trace-number:709954891
> user-agent:RPT-HTTPClient/0.3-3E
>
> Here is a picture of how to do SOAP on an AS/400
>
> I hope this helps.
>
> Dawn
>
> -------
> Here's my program...
>
> Because the MIME header needed a byte count (not including the MIME header) I made two templates,
> One containing the MIME header and one excluding it.  OCLEN is a variable for length used in my MIME header.
>
> callp http_debug(*ON);
>
> // 1. Get initial variable values.
>
> read dmgtopfl;
>
> // 2. Load Basic Template (without MIME header)
>
> DocName = 'OPBXML10';
> exsr $LoadTemplate;
>
> // 3.  Get Buffer length.
>
> Len = getHtmlBytesBuffered();
> OcLen = %char(Len);
>
> // 4. Load Complete Template (including MIME header)
>
> clear DocName;
> DocName = 'OPBXML1';
> exsr $LoadTemplate;
>
> // 5. Write to Stream File and Post.
> //    a.  Try 1st URL.
>
> rc = WrtHtmlToStmf(XML_Output:CodePage);
> ContentType = 'text/xml';
> rc = http_url_post_stmf('https://xxxx.xxxx.xxx' +
>                          '/xxxx/'
>                        : '/home/MYFOLDER/MYFILE1.xml'
>                        : '/home/MYFOLDER/MYREPLY1.xml'
>                        : HTTP_TIMEOUT
>                        : HTTP_USERAGENT
>                        : ContentType );
>
> //    b.  Try 2nd URL.
>
> if (rc<>  1);
>     scmsg = http_error();
>     rc = http_url_post_stmf('https://xxxx.xxxx2.xxx' +
>                          '/xxxx/'
>                        : '/home/MYFOLDER/MYFILE1.xml'
>                        : '/home/MYFOLDER/MYREPLY1.xml'
>                        : HTTP_TIMEOUT
>                        : HTTP_USERAGENT
>                        : ContentType );
>
>   //    c.  If both error, log error
>
>      if (rc<>  1);
>        if rc = 302;
>          url = http_redir_loc;
>        endif;
>       scmsg = http_error();
>       *inlr = *on;
>       return;
>      endif;
>   endif;
>
>   // 6. End job.
>
> *inlr = *on;
> return;
>
> //********************************************************
> // Subroutine $LoadTemplate
> //   Load Template Data.
> //********************************************************
> begsr $LoadTemplate;
>
> // 1. Clear Buffer.
>
>    callp ClrHtmlBuffer();
>
> // 2. Get HTML for Document.
>
>    callp gethtml('HTMLSRC':'MYLIB': DocName:
>    '<as400>');
>
> // 3. Load Variables.
>
>     callp UpdHtmlVar('OCUSER':OCUSER);
>     .
>     .
>     .  (list of these)
>
>     CodePage = 819;
>     XML_Output = 'TestFile1.xml';
>
>     // 4.  Write Section
>
>     callp wrtsection('NEWORD');
>
>   endsr;
> -----Original Message-----
> From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Scott Klement
> Sent: Friday, February 26, 2010 5:23 PM
> To: HTTPAPI and FTPAPI Projects
> Subject: Re: MIME Header
>
> Charlie,
>
> According to what you just said, it should be a part of the XML document
> that you submit to HTTPAPI.   Not something that HTTPAPI should do
> (which would make it part of the request)
>
>
> On 2/26/2010 3:02 PM, Versfelt, Charles wrote:
>>
>> Good news:  I made it successfully past my HTTP/1.1 412 Precondition Failed error.  Turns out our network manager gave Paymentech an incorrect IP address, so they were failing the file on IP Authorization check.
>>
>> Now I'm receiving a Reply file and have the following error in that file.
>>
>> <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE Response SYSTEM
>> "Response_PTIx.dtd"><Response><QuickResponse HcsTcsInd="T"
>> MessageType="U" LangInd=""
>> TzCode=""Version="2"><ProcStatus>05</ProcStatus><StatusMsg
>> StatusMsgLth="51">The following mime-header was missing:
>> MIME_VERSION</StatusMsg></QuickResponse></Response>
>>
>> What is a "Mime header"?
>> It talks about the Mime header in Paymentech's documentation.  I asked our Paymentech rep about it, she said it's "part of the XML document but not part of the request itself."
>>
>> Does this have something to do with the post command?
>> I notice one of their fields is "Content Type" which is also part of the post command, not sure if there's a connection, nor where the Mime Version is.
>>
>> Thanks,
>> Charlie
>>
>>
> -----------------------------------------------------------------------
> 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
> -----------------------------------------------------------------------
>

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