[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Wunderground REST format
   Thanks.  Is there a quick way to check DNS resolution. I am able to
   resolve to other iseries on the network via the server name but not
   sure if I am set to resolve outside of network.
   I got your quick example to compile by making the below addition.
   D wundertest      PR                  ExtPgm('wundertest')
   D   State                        2a   const
   D   City                        32a   const
   D getweather      PR
   D   resp                              likeds(response)
   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 wundertest      PI
   D   State                        2a   const
   D   City                        32a   const
   However when I run it I get a pointer error.
       Pointer not set for location
   referenced.
       Function check. MCH3601 unmonitored by GETWEATH01 at statement
   0000001809,
         instruction
   X'0000'.
       Pointer or parameter error (C G D
   F).
       Pointer or parameter error (C G D
   F).
   Bill Zader
   Team Leader, Application Support
   (RAF, MRO, XMS, Irista, CribMaster, Infor, ClearOrbit)
   Exel
   260 Salem Church Road
   Mechanicsburg, PA 17050 USA
   Office: 717-901-1091
   Cell: 717-982-1001
   Fax: 717-901-1733
   www.exel.com
   -----Original Message-----
   From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Scott
   Klement
   Sent: Friday, March 13, 2015 4:10 PM
   To: HTTPAPI and FTPAPI Projects
   Subject: Re: Wunderground REST format
   The hostname lookup is probably because you have a trailing space in
   the hostname?  Either that, or you don't have DNS resolution configured
   in the network settings of your box.
   Also, I don't understand why you're doing a POST request.    Why not a
   GET request??
   Here's a really quick attempt (you'll have to fill in your own API
   key):
         H DFTACTGRP(*NO) BNDDIR('HTTPAPI')
          /copy httpapi_h
         D WUNDERTEST      PR                  ExtPgm('WUNDERTEST')
         D   State                        2a   const
         D   City                        32a   const
         D WUNDERTEST      PI
         D   State                        2a   const
         D   City                        32a   const
         D url             s           1000a   varying
         D rc              s             10i 0
         D len             s             10i 0
         D result          s          65535a   varying
         D KEY             c                   'put-your-key-here'
         D response        ds                  qualified
         D   weather                     20a   varying
         D   temp                        20a   varying
          /free
            url = 'http://api.wunderground.com/api/'
               + KEY + '/conditions/q/'
               + %trim(State) + '/'
               + %trim(City) + '.xml';
            result = '';
            // get data from wunderground:
            rc = http_get_xml( url
                             : *null
                             : %paddr(getWeather)
                             : %addr(response) );
            if rc < 1;
               http_crash();
            endif;
            dsply (response.weather + ' ' + response.temp);
            *inlr = *on;
          /end-free
         P getWeather      B
         D                 PI
         D   resp                              likeds(response)
         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)
          /free
            select;
            when name = 'weather';
               resp.weather = value;
            when name = 'temperature_string';
               resp.temp = value;
            endsl;
          /end-free
         P                 E
   On 3/13/2015 2:25 PM, Bill Zader (Exel US) wrote:
   > Hi.  Thanks for getting back to me.
   >
   > I took a wild guess at what to do using REST format and their .JSON
   call.
   >
   > I am receiving a 'Host name look up failed.' error message return in
   the http_error field.
   >
   > My parms are below:
   > rc = http_url_post_xml('http://api.wunderground.com +
   >       /api/5b22c92f30a13e79/conditions/q/17112.json'
   >                        : *NULL
   >                        : 0
   >                        : %paddr(StartOfElement)
   >                        : %paddr(EndOfElement)
   >                        : *NULL );
   >
   > Heck it might be as simple as the fact that I have the "+" within the
   rc value. Or it hates the fact that I used *NULL and 0.
   >
   > Bill Zader
   > Team Leader, Application Support
   > (RAF, MRO, XMS, Irista, CribMaster, Infor, ClearOrbit)
   >
   > Exel
   > 260 Salem Church Road
   > Mechanicsburg, PA 17050 USA
   >
   > Office: 717-901-1091
   > Cell: 717-982-1001
   > Fax: 717-901-1733
   >
   > [1]www.exel.com
   >
   >
   > -----Original Message-----
   > From: [2]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   > [[3]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Scott
   > Klement
   > Sent: Friday, March 13, 2015 3:14 PM
   > To: HTTPAPI and FTPAPI Projects
   > Subject: Re: Wunderground REST format
   >
   > I did some proof-of-concept programs with Wunderground ages ago...
   > probably 7-8 years ago.   They worked just fine.
   >
   > Can you tell us more about the problems you're having?
   >
   >
   > On 3/13/2015 12:39 PM, Bill Zader (Exel US) wrote:
   >>      Hello,   I am working on a project to retrieve current weather
   >>      conditions from wunderground.com.  I was able to use SOAPUI in
   REST
   >>      format and receive results. Now I need to convert the thing to
   RPG.
   >>
   >>
   >>      Has anyone gotten this to work? If so, I would greatly
   appreciate how
   >>      you did it as this is a daunting task for someone with no web
   >>      programming experience.
   >>
   >>
   >>      Thanks in advance.
   >>
   >>      Bill Zader
   >>      Team Leader, Application Support
   >>      (RAF, MRO, XMS, Irista, CribMaster, Infor, ClearOrbit)
   >>      [1][4]bill.zader@xxxxxxxx
   >>
   >> References
   >>
   >>      1. [5]mailto:bill.zader@xxxxxxxx
   >>
   >>
   >>
   >>
   ---------------------------------------------------------------------
   >> -
   >> - This is the FTPAPI mailing list.  To unsubscribe, please go to:
   >> [6]http://www.scottklement.com/mailman/listinfo/ftpapi
   >>
   ---------------------------------------------------------------------
   >> -
   >> -
   >
   ----------------------------------------------------------------------
   > - This is the FTPAPI mailing list.  To unsubscribe, please go to:
   > [7]http://www.scottklement.com/mailman/listinfo/ftpapi
   >
   ----------------------------------------------------------------------
   > -
   >
   ----------------------------------------------------------------------
   > - This is the FTPAPI mailing list.  To unsubscribe, please go to:
   > [8]http://www.scottklement.com/mailman/listinfo/ftpapi
   >
   ----------------------------------------------------------------------
   > -
   >
   -----------------------------------------------------------------------
   This is the FTPAPI mailing list.  To unsubscribe, please go to:
   [9]http://www.scottklement.com/mailman/listinfo/ftpapi
   -----------------------------------------------------------------------
References
   1. http://www.exel.com/
   2. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   3. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   4. mailto:bill.zader@xxxxxxxx
   5. mailto:bill.zader@xxxxxxxx
   6. http://www.scottklement.com/mailman/listinfo/ftpapi
   7. http://www.scottklement.com/mailman/listinfo/ftpapi
   8. http://www.scottklement.com/mailman/listinfo/ftpapi
   9. 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
-----------------------------------------------------------------------