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

Re: HttpApi Question



Sorry for the bad formatting. I hate "Notes" because I do not understand why it screws up my messages that way. At the time I send messages to the mailing list, the messages look nicely formatted but then the formatting gets lost.

Thomas.

Am 09.09.2013 10:06, schrieb thomas.raddatz@xxxxxx:
    Nancy,
    By default HTTP API drops the connection after each HTTP operation.
    Therefore you may authenticate against server 1 and then try to POST to
    server 2, depending on the decision of the workload balancing server.
    In order to get around that problem you may try to use a persistent
    connection for authentication as well as for the POSTs. The following
    snippet is an example from my NTLM extenstion. So please replace
    HTTP_AUTH_NTLM with HTTP_AUTH_BASIC.
    Example: Persistent Connection
    This example demonstrates how to call a web service twice, storing the
    response SOAP messages in a single stream file. The complete source
    code is shipped with the NTLM package.
    URL = 'http://' + Job_getTcpIpAddr() + '/HelloWorld.asmx';
    IFS = '/home/raddatz/httpapi_example37.xml';
    // Open output file
    fd = open(IFS: O_WRONLY + O_TRUNC + O_CREAT + O_CCSID: 511: 1208);
    // Produce SOAP message postData =
    '<soapenv:Envelope +
        xmlns:soapenv="[1]http://schemas.xmlsoap.org/soap/envelope/"; +
        xmlns:tem="[2]http://tempuri.org/";>+
       <soapenv:Header/>+
       <soapenv:Body>+
          <tem:HelloWorld/>+
       </soapenv:Body>+
    </soapenv:Envelope>';
    // Open persistent connection
    pComm = http_persist_open(URL);
    // Set credentials http_setauth(HTTP_AUTH_NTLM: user: password);
    dou '1';
       // Call web service
       if ( http_persist_post( pComm: URL: 0: *null
                             : %addr(postData)+2: %len(postData)
                             : fd: %paddr('write')) = -1);
          leave;
       endif;
       // Call web service once more
       if ( http_persist_post( pComm: URL: 0: *null
                             : %addr(postData)+2: %len(postData)
                             : fd: %paddr('write')) = -1);
          leave;
       endif;
    enddo;
    // Close http connection
    http_persist_close(pComm);
    // Close output file
    callp close(fd);
    Regards,
    Thomas.
    ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx schrieb am 03.09.2013 14:19:09:
    > Von: naschueller@xxxxxxxxxx
    > An: ftpapi@xxxxxxxxxxxxxxxxxxxxxx,
    > Datum: 03.09.2013 16:01
    > Betreff: HttpApi Question
    > Gesendet von: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
    >
    >
    > All -
    >
    > I have taken over a project to convert a process from VB6 to the
    Iseries.
    > I downloaded the HTTPAPI source and examples.
    >
    > This is the process:
    >    Send a log-on message
    >    Send multiple data messages
    >
    > This is a snippet of source from the VB 6 applications that I am
    attempting
    > to convert.
    >
    > xmlHTTP.Open "POST", strServer, False, strUser, strPassword
    > xmlHTTP.Send (xmlData)
    >
    >
    > I have been following the recent email regarding sending the
    authentication
    > prior to each "POST". So my RPGLE source looks like the following.
    >
    > callp http_setAuth( HTTP_AUTH_BASIC:
    >                     'xxxxxx':
    >                     'xxxxxx' );
    >
    >  eval rc=http_url_post( %Trimr(server) :
    >                         %addr(data):
    >                         %len(%trimr(data)):
    >                         '/tmp/response.xml');
    >
    > The service that I am sending these messages to does load balancing.
     Some
    > of the transactions are successful and some I am receiving the
    response "1
    > Invalid authorization token".  The support for the site tells me that
    I am
    > dropping the connection and that is why I am receiving these
    messages.
    >
    > At this point I am not certain how to proceed and was looking for
    > suggestions from the group.
    >
    > Thank you in advance,
    >
    > Nancy Schueller
    > 563-584-0404 x123
    >
    >
    > This message and any attachments are for the sole use of the
    > intended recipient(s) and may contain confidential and/or privileged
    > information. Any unauthorized review, use, disclosure or
    > distribution is strictly prohibited. If you are not the intended
    > recipient, please contact the sender by reply email and destroy all
    > copies of the original message and any attachments. Thank you.
    >
    >
    -----------------------------------------------------------------------
    > This is the FTPAPI mailing list.  To unsubscribe, please go to:
    > [3]http://www.scottklement.com/mailman/listinfo/ftpapi
    >
    -----------------------------------------------------------------------

    --
    IMPORTANT NOTICE:
    This email is confidential, may be legally privileged, and is for the
    intended recipient only. Access, disclosure, copying, distribution, or
    reliance on any of it by anyone else is prohibited and may be a
    criminal
    offence. Please delete if obtained in error and email confirmation to
    the sender.

References

    1. http://schemas.xmlsoap.org/soap/envelope/
    2. http://tempuri.org/
    3. 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
-----------------------------------------------------------------------