Loading ...
Sorry, an error occurred while loading the content.
 

Re: [Easy400Group] Easy400 and XML

Expand Messages
  • Richard ECUYER
    Hi, In this kind of case, i would mix 2 things : . CGIDEV2 to use the gethtmlIfs procedure in addition with the updhtmlvar. It is so easy to have a template
    Message 1 of 14 , Feb 1, 2007
      Hi,
       
      In this kind of case, i would mix 2 things :
          . CGIDEV2 to use the gethtmlIfs procedure in addition with the updhtmlvar.
          It is so easy to have a template and populate it with data.
          The template will be of course a piece of XML wich is nothing else that a text file.
       
          . And socket (I use scott klement template) to post the data and "read" the answer, and interpret the returned data.
       
      I do this very oiften and it works like a charm :)
       
      Thank's to Scott, Mel, and giovanni 
       
      --- Original Message -----
      Sent: Wednesday, January 31, 2007 10:52 PM
      Subject: [Easy400Group] Easy400 and XML

      Can I use CGIDEV2 to create and send an XML document
      to a specific web site. We have a customer who
      requires EDI using XML. I envision a process that
      runs entirely on the iSeries. Basically extract the
      data, convert to XML, post the document a web site,
      and interrogate the status of the post. Thanks, Tim

      ____________ _________ _________ _________ _________ _________ _
      8:00? 8:25? 8:40? Find a flick in no time
      with the Yahoo! Search movie showtime shortcut.
      http://tools. search.yahoo. com/shortcuts/ #news

    • gibknits2
      I ve recently installed CGIDEV on our AS/400 which is on V5R3. Mel s API calls are beautiful, and I m writing out the XML into a file in the IFS
      Message 2 of 14 , Mar 12, 2007
        I've recently installed CGIDEV on our AS/400 which is on V5R3. Mel's
        API calls are beautiful, and I'm writing out the XML into a file in
        the IFS beautifully---as long as there aren't any headers.

        My question is this--I need to send this XML to a web service as a
        POST. When are the appropriate headers written? Do I write them and
        append them to the XML file at the time I send the file via Scott's
        socket template?

        Thanks for any help you can give me.

        Kim Gibson


        --- In Easy400Group@yahoogroups.com, "Richard ECUYER" <recuyer@...>
        wrote:
        >
        > Hi,
        >
        > In this kind of case, i would mix 2 things :
        > . CGIDEV2 to use the gethtmlIfs procedure in addition with the
        updhtmlvar.
        > It is so easy to have a template and populate it with data.
        > The template will be of course a piece of XML wich is nothing
        else that a text file.
        >
        > . And socket (I use scott klement template) to post the data
        and "read" the answer, and interpret the returned data.
        >
        > I do this very oiften and it works like a charm :)
        >
        > Thank's to Scott, Mel, and giovanni
        >
        > --- Original Message -----
        > From: Tim Gornall
        > To: Easy400Group@yahoogroups.com
        > Sent: Wednesday, January 31, 2007 10:52 PM
        > Subject: [Easy400Group] Easy400 and XML
        >
        >
        > Can I use CGIDEV2 to create and send an XML document
        > to a specific web site. We have a customer who
        > requires EDI using XML. I envision a process that
        > runs entirely on the iSeries. Basically extract the
        > data, convert to XML, post the document a web site,
        > and interrogate the status of the post. Thanks, Tim
        >
        > __________________________________________________________
        > 8:00? 8:25? 8:40? Find a flick in no time
        > with the Yahoo! Search movie showtime shortcut.
        > http://tools.search.yahoo.com/shortcuts/#news
        >
      • Kim in Idaho
        Correction -- it was CGIDEV2 that I ve installed. ... Mel s ... in ... and ... Scott s ... the ... nothing
        Message 3 of 14 , Mar 12, 2007
          Correction -- it was CGIDEV2 that I've installed.


          --- In Easy400Group@yahoogroups.com, "gibknits2" <gibknits2@...>
          wrote:
          >
          > I've recently installed CGIDEV on our AS/400 which is on V5R3.
          Mel's
          > API calls are beautiful, and I'm writing out the XML into a file
          in
          > the IFS beautifully---as long as there aren't any headers.
          >
          > My question is this--I need to send this XML to a web service as a
          > POST. When are the appropriate headers written? Do I write them
          and
          > append them to the XML file at the time I send the file via
          Scott's
          > socket template?
          >
          > Thanks for any help you can give me.
          >
          > Kim Gibson
          >
          >
          > --- In Easy400Group@yahoogroups.com, "Richard ECUYER" <recuyer@>
          > wrote:
          > >
          > > Hi,
          > >
          > > In this kind of case, i would mix 2 things :
          > > . CGIDEV2 to use the gethtmlIfs procedure in addition with
          the
          > updhtmlvar.
          > > It is so easy to have a template and populate it with data.
          > > The template will be of course a piece of XML wich is
          nothing
          > else that a text file.
          > >
          > > . And socket (I use scott klement template) to post the data
          > and "read" the answer, and interpret the returned data.
          > >
          > > I do this very oiften and it works like a charm :)
          > >
          > > Thank's to Scott, Mel, and giovanni
          > >
          > > --- Original Message -----
          > > From: Tim Gornall
          > > To: Easy400Group@yahoogroups.com
          > > Sent: Wednesday, January 31, 2007 10:52 PM
          > > Subject: [Easy400Group] Easy400 and XML
          > >
          > >
          > > Can I use CGIDEV2 to create and send an XML document
          > > to a specific web site. We have a customer who
          > > requires EDI using XML. I envision a process that
          > > runs entirely on the iSeries. Basically extract the
          > > data, convert to XML, post the document a web site,
          > > and interrogate the status of the post. Thanks, Tim
          > >
          > > __________________________________________________________
          > > 8:00? 8:25? 8:40? Find a flick in no time
          > > with the Yahoo! Search movie showtime shortcut.
          > > http://tools.search.yahoo.com/shortcuts/#news
          > >
          >
        • Scott Klement
          Do you mean the XML header? (i.e. the tag??) If not, can you clarify what you mean by headers ? What do you mean by Scott s
          Message 4 of 14 , Mar 13, 2007
            Do you mean the XML header? (i.e. the <?xml version="1.0", etc ?>
            tag??) If not, can you clarify what you mean by "headers"?

            What do you mean by "Scott's socket template"? Are you referring to
            HTTPAPI?


            gibknits2 wrote:
            > I've recently installed CGIDEV on our AS/400 which is on V5R3. Mel's
            > API calls are beautiful, and I'm writing out the XML into a file in
            > the IFS beautifully---as long as there aren't any headers.
            >
            > My question is this--I need to send this XML to a web service as a
            > POST. When are the appropriate headers written? Do I write them and
            > append them to the XML file at the time I send the file via Scott's
            > socket template?
            >
            > Thanks for any help you can give me.
            >
            > Kim Gibson
            >
          • Kim in Idaho
            Hi Scott--thanks for the response! By headers I meant the HTTP headers, as what I ve shown below. They re above the tag. POST pathname
            Message 5 of 14 , Mar 13, 2007
              Hi Scott--thanks for the response!

              By "headers" I meant the HTTP headers, as what I've shown below. They're above the <? xml version="1.0"> tag. 

              POST pathname HTTP/1.1
              HOST: hostname
              Content-type: text/xml;charset="utf8"
              Content-length: 26012

              As for "Scott's socket template", I meant the code from your sockets tutorial (which is great, btw).

              Am I doing this the wrong way? I'm trying to send an XML file via a POST to a web service.



              --- In Easy400Group@yahoogroups.com, Scott Klement <easy400@...> wrote:
              >
              > Do you mean the XML header? (i.e. the <?xml version="1.0", etc ?>
              > tag??) If not, can you clarify what you mean by "headers"?
              >
              > What do you mean by "Scott's socket template"? Are you referring to
              > HTTPAPI?
              >
              >
              > gibknits2 wrote:
              > > I've recently installed CGIDEV on our AS/400 which is on V5R3. Mel's
              > > API calls are beautiful, and I'm writing out the XML into a file in
              > > the IFS beautifully---as long as there aren't any headers.
              > >
              > > My question is this--I need to send this XML to a web service as a
              > > POST. When are the appropriate headers written? Do I write them and
              > > append them to the XML file at the time I send the file via Scott's
              > > socket template?
              > >
              > > Thanks for any help you can give me.
              > >
              > > Kim Gibson
              > >
              >
            • Kim in Idaho
              After more research, it s become apparent to me that I ve made a mistake by putting the HTTP headers inside my XML template. So I m going to start over, and
              Message 6 of 14 , Mar 13, 2007
                After more research, it's become apparent to me that I've made a
                mistake by putting the HTTP headers inside my XML template. So I'm going
                to start over, and explain what I've done so far with CGIDEV2 and XML,
                and what is still left to be done:

                From a green-screen application, a user enters data that is input into a
                file. This file contains an insert trigger, which launches an RPG ILE
                program developed with CGIDEV2. The RPG ILE program loads an XML
                template, populates the variables within the template and writes the
                resulting XML file to the IFS. Easy as pie--I'm loving CGIDEV2!

                Now...I want to be able to send this XML file via a POST to a service
                provider, without any further user interaction (no browser).

                I no longer have the HTTP headers I mentioned earlier within the XML
                file that has been written to the IFS. Should I be connecting to the
                service provider via a sockets program, writing the HTTP headers and
                sending the data via a socket connection?

                I'm obviously a newbie to this sort of thing---our shop doesn't seem to
                like to spend money on training, and there's so much information out
                there that it's overwhelming to know where to begin. I've been reading
                various web services tutorials that are in WDSC, and the constant
                mention of Java scares me off.

                Thanks again for any help.


                --- In Easy400Group@yahoogroups.com, "Kim in Idaho" <gibknits2@...>
                wrote:
                >
                > Hi Scott--thanks for the response!
                >
                > By "headers" I meant the HTTP headers, as what I've shown below.
                They're
                > above the <? xml version="1.0"> tag.
                >
                > POST pathname HTTP/1.1
                > HOST: hostname
                > Content-type: text/xml;charset="utf8"
                > Content-length: 26012
                >
                > As for "Scott's socket template", I meant the code from your sockets
                > tutorial (which is great, btw).
                >
                > Am I doing this the wrong way? I'm trying to send an XML file via a
                POST
                > to a web service.
                >
                >
                >
                > --- In Easy400Group@yahoogroups.com, Scott Klement easy400@ wrote:
                > >
                > > Do you mean the XML header? (i.e. the <?xml version="1.0", etc ?>
                > > tag??) If not, can you clarify what you mean by "headers"?
                > >
                > > What do you mean by "Scott's socket template"? Are you referring to
                > > HTTPAPI?
                > >
                > >
                > > gibknits2 wrote:
                > > > I've recently installed CGIDEV on our AS/400 which is on V5R3.
                Mel's
                > > > API calls are beautiful, and I'm writing out the XML into a file
                in
                > > > the IFS beautifully---as long as there aren't any headers.
                > > >
                > > > My question is this--I need to send this XML to a web service as a
                > > > POST. When are the appropriate headers written? Do I write them
                and
                > > > append them to the XML file at the time I send the file via
                Scott's
                > > > socket template?
                > > >
                > > > Thanks for any help you can give me.
                > > >
                > > > Kim Gibson
                > > >
                > >
                >
              • Scott Klement
                Hi Kim, ... HTTPAPI is an open source project that I started for this sort of thing. It s a service program (similar, in a way, to CGIDEV2) that s designed for
                Message 7 of 14 , Mar 13, 2007
                  Hi Kim,

                  > Now...I want to be able to send this XML file via a POST to a service
                  > provider, without any further user interaction (no browser).

                  HTTPAPI is an open source project that I started for this sort of thing.
                  It's a service program (similar, in a way, to CGIDEV2) that's designed
                  for interacting with web servers.

                  Basically, you'd do the following:

                  rc = http_url_post_stmf( 'http://www.example.com/whatever'
                  : '/path/to/XmlFileSavedByCgidev2.xml'
                  : '/path/to/webServerResponse.xml' );

                  This tells HTTPAPI that you wanto to connect to the web server at
                  http://www.example.com/whatever and send it (via POST) the file called
                  XmlFileSavedByCgidev2.xml. When the web server sends a response, it'll
                  be sent to webServerResponse.xml.

                  There are many other parameters, and many other routines in HTTPAPI that
                  can do other things, but the above one should (hopefully) give you the
                  gist. You don't have to worry about writing your own HTTP headers, or
                  understanding how the HTTP protocol has to work, or understand how to
                  use the socket APIs, because HTTPAPI does all of that for you.

                  Granted, you could simply write your own using sockets. Sockets take
                  care of the process of connecting to the server and sending/receiving
                  data. But you still have to ensure that the data you send is valid
                  according to the HTTP protocol.

                  The samples in my socket tutorial are really designed to teach you how
                  to use the sockets APIs. They were never designed to teach you how HTTP
                  works, and they present only the simplest examples. I can't even
                  promise that they're compatible with all web servers. For example,
                  they're not compatible with servers that use virtual hosts. They're
                  only compatible with the (obsolete) http 1.0 protocol. They don't have
                  any mechanism for timing things out when there's an error. They're not
                  really designed to be full-featured, production quality HTTP tools.
                  They're only there to try to help you understand how the socket API
                  works, and what it does.

                  In my more recent articles on TCP/IP programming, I've used E-mail as an
                  example instead of HTTP, because frankly, too many people somehow got
                  the idea from my original tutorial that sockets were the same thing as
                  HTTP, and that my example programs were intended as utilities (or
                  templates, apparently) and not the over-simplified "hello world" type
                  example programs that I intended them to be.

                  I hope that makes sense... but anyway, if you want to check out
                  HTTPAPI, please see the following site:
                  http://www.scottklement.com/httpapi/

                  There's also a PDF handout for a powerpoint presentation (I speak about
                  HTTPAPI at user group meetings and conventions) at the following link:
                  http://www.scottklement.com/presentations/

                  At the end of that presentation, you'll find links to other articles
                  I've written about HTTPAPI and Web Services from RPG (including a fairly
                  good one in System iNEWS magazine). Hopefully that'll help you along
                  your path...
                • Kim in Idaho
                  Great Scott! (I couldn t resist...) Your advice steered me in exactly the right direction, and HTTPAPI is working very well -- as you suggested, I m using the
                  Message 8 of 14 , Mar 15, 2007

                    Great Scott! (I couldn't resist...)

                    Your advice steered me in exactly the right direction, and HTTPAPI is working very well -- as you suggested, I'm using the call to http_url_post_stmf.  If I have any questions, (and I'm sure I will at some point), I'll post them to the FTPAPI list, and keep my questions here about the tools available on Easy400.net.

                    Thanks again for making this available to us, and for your response to my questions. Thanks also to Giovanni and Mel for CGIDEV2.  You guys have all helped me tremendously!!

                    Sincerely,

                    Kim Gibson


                    --- In Easy400Group@yahoogroups.com, Scott Klement <easy400@...> wrote:
                    >
                    > Hi Kim,
                    >
                    > > Now...I want to be able to send this XML file via a POST to a service
                    > > provider, without any further user interaction (no browser).
                    >
                    > HTTPAPI is an open source project that I started for this sort of thing.
                    > It's a service program (similar, in a way, to CGIDEV2) that's designed
                    > for interacting with web servers.
                    >
                    > Basically, you'd do the following:
                    >
                    > rc = http_url_post_stmf( 'http://www.example.com/whatever'
                    > : '/path/to/XmlFileSavedByCgidev2.xml'
                    > : '/path/to/webServerResponse.xml' );

                     

                  Your message has been successfully submitted and would be delivered to recipients shortly.