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

Re: HTTPAPI log in errors



Hi Jimmy,

I think you're confused between the HTML form that you used to test vs. 
what you actually need to send to the vendor.  Looking at your TEST.HTM, 
it shows an HTML form that would send an XML document to a web page.

But, looking at your trace file, you are sending the HTML and the XML 
(instead of just the XML, like the form does.)

Or, to put it another way:  The HTML in TEST.HTM is instructions to your 
web browser.  The XML in TEST.HTM is the data to send to the vendor. 
The browser doesn't send the HTML, it only sends the XML part.

To replicate that behavior with HTTPAPI, you'd do something like this:


      H DFTACTGRP(*NO) BNDDIR('HTTPAPI')

       /define WEBFORMS
       /copy httpapi_h

      D form            s                   like(WEBFORM)

       /free

        DR1ST_XML =
           '<?xml version="1.0" encoding="UTF-8"?>+
            <RCExtRequest>+
             <Caller>+
              <VendorName>vvendor2</VendorName>+
              <VendorPassword>xxxxxxxx</VendorPassword>+
              <PracticeName>yyyyyy</PracticeName>+
              <Application>EMR</Application>+
              <Version>1</Version>+
            		<Station>Station A</Station>+
             </Caller>+
                <RcopiaPracticeUsername>yyyyyy</RcopiaPracticeUsername>+
             <Request>+
              <Command>get_url</Command>+
             </Request>+
            </RCExtRequest>';

        form = webform_open();
        webform_setPtr( form
                      : 'xml'
                      : %addr(DR1ST_XML) + VARYINGDATAOFFSET
                      : %len(DR1ST_XML) );

        webform_postData( form
                        : p_postData
                        : postDataLen );

        rc = http_post_xml( 'https://anscert.drfirst.com/getURL'
                          : p_postData
                          : postDataLen
                          : *NULL
                          : %paddr(MapXmlData)
                          : %addr(EngineUpload)
                          : HTTP_TIMEOUT
                          : *omit
                          : 'application/x-www-form-urlencoded'
                          );

As you can see, I'm building a web form, just as the HTML was with it's 
<form> tag.  The form has one input -- (the textarea from the html) 
named 'xml'.  All of the XML data is submitted in that one field.

So I'm doing the same thing in HTTPAPI, above...

Also, this has absolutely NOTHING to do with Apache or IIS.  You are 
comparing your browser (Firefox? Chrome? IE? Safari? Not sure what 
you're using) to HTTPAPI.  No Apache or IIS is involved.

Good luck.


On 1/14/2011 3:50 PM, Jimmy Butterfield wrote:
>
>     Scott,
>
>
>     I am trying to consume a web service from a new vendor using the
>     HTTPAPI.  I have been able to get your examples to work successfully,
>     but I am having problems getting this new application to work.
>
>
>     The vendor has supplied a test html document that runs just fine when
>     run from a browser.  It is attached.
>
>
>     My RPG program issues the call to HTTPAPI using the following line:
>
>
>     rc = http_post_xml(
>
>     'https://anscert.drfirst.com/getURL'
>
>                       : %addr(DR1ST_XML) + VARYINGDATAOFFSET
>
>                       : %len(DR1ST_XML)
>
>                       : *NULL
>
>                       : %paddr(MapXmlData)
>
>                       : %addr(EngineUpload) );
>
>
>     This code is a slightly modified version of the GEOIP example that you
>     supplied.
>
>
>     When I execute the program, the attached debug log is generated.  It
>     appears that my request string is passed as requested, the server is
>     apparently contacted and receives the request.  However, based on the
>     response received something is wrong with the logon string and I
>     cannot be authenticated.
>
>
>     The test html works when sent from windows (IIS) but my request from
>     the iSeries (Apache) doesn't seem to work.  Any ideas???
>
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------