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

proxi server problem



   Hello to all,
   i saw in the last October  that Scott Klement  wrote the GETRATE
   program example for the Italian iSeriesNews, now i want to start
   with soap and i try to use the program but i get the message: "Host
   not found".
   I asked to our  network system and he replied me that i need to use
   the proxy server.
   Now i have a question.
   I install the last version 1.18 on iSeries v530 release, can the
   httpapi project use the proxy server ?  If yes, is there an example or
   some soggestion
   to use it ?
   Thanks, in advance.  Any help would be much appreciated.

   Luigi

   Here there is the source program  GETRATE:

         *  This is an example of calling a SOAP Web service w/HTTPAPI.
         *
         *  This sample calls the Currency Exchange Rate Web service
         *  provided by WebserviceX.net. For more info, search for it
         *  at   [1]http://www.WebserviceX.net
         *
         *  To Compile (requires V5R1):
         *    ** First, download and compile HTTPAPI.  You can get it
   from
         *    **   [2]http://www.scottklement.com/httpapi
         *     ADDLIBLE LIBHTTP *LAST
         *     CRTBNDRPG PGM(GETRATE) SRCFILE(libhttp/QRPGLESRC)
         *
         *  To Run:
         *     CALL GETRATE PARM('USD' 'JPY' &RATE)
         *
        H DFTACTGRP(*NO) BNDDIR('HTTPAPI':'QC2LE')

        D GETRATE         PR                  ExtPgm('GETRATE')
        D   Country1                     3A   const
        D   Country2                     3A   const
        D   Rate                        15P 5
        D GETRATE         PI
        D   Country1                     3A   const
        D   Country2                     3A   const
        D   Rate                        15P 5

         /copy httpapi_h

        D Incoming        PR
        D   rate                         8F
        D   depth                       10I 0 value
        D   name                      1024A   varying const
        D   path                     24576A   varying const
        D   value                    32767A   varying const
        D   attrs                         *   dim(32767)
        D                                     const options(*varsize)

        D SOAP            s          32767A   varying
        D rc              s             10I 0
        D Result          s              8F

         /free
          SOAP =
           '<?xml version="1.0" encoding="US-ASCII" standalone="no"?>'
          +'<SOAP-ENV:Envelope'
          +'
   xmlns:SOAP-ENV="[3]http://schemas.xmlsoap.org/soap/envelope/";'
          +'    xmlns:tns="[4]http://www.webserviceX.NET/";>'
          +'<SOAP-ENV:Body>'
          +'  <tns:ConversionRate>'
          +'      <tns:FromCurrency>'+ %trim(Country1)
   +'</tns:FromCurrency>'
          +'      <tns:ToCurrency>'+ %trim(Country2) +
   '</tns:ToCurrency>'
          +'  </tns:ConversionRate>'
          +'</SOAP-ENV:Body>'
          +'</SOAP-ENV:Envelope>';

          http_debug(*ON);

          rc = http_url_post_xml(
                     'http://www.webservicex.net/CurrencyConvertor.asmx'
                            : %addr(SOAP) + 2
                            : %len(SOAP)
                            : *NULL
                            : %paddr(Incoming)
                            : %addr(Result)
                            : HTTP_TIMEOUT
                            : HTTP_USERAGENT
                            : 'text/xml'
                            :
   'http://www.webserviceX.NET/ConversionRate');

          if (rc <> 1);
             http_crash();
          else;
             Rate = %dech(Result: 12: 2);
          endif;

          *inlr = *on;

         /end-free

        P Incoming        B
        D Incoming        PI
        D   Result                       8F
        D   depth                       10I 0 value
        D   name                      1024A   varying const
        D   path                     24576A   varying const
        D   value                    32767A   varying const
        D   attrs                         *   dim(32767)
        D                                     const options(*varsize)

        D atof            PR             8F   extproc('atof')
        D   string                        *   value options(*string)

         /free
             if (name = 'ConversionRateResult');
                Result = atof(value);
             endif;
         /end-free
        P                 E

References

   1. http://www.webservicex.net/
   2. http://www.scottklement.com/httpapi
   3. http://schemas.xmlsoap.org/soap/envelope/";'
   4. http://www.webservicex.net/";>'
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------