ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

I'm so lost...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • I'm so lost...

    Hey guys,
    I'm trying to get into REST web services with our iseries.

    We installed Scott Klement's LIBHTTP package and are currently using several web services using SOAP.
    There are a ton of awesome web services out there that use REST so I've been researching how to get into this.

    I set a Linux machine running Debian 10 and then set up am apache tomcat server on it.
    Where do I go from here?
    The only articles I could find, involved installing and running the tomcat server on the iseries.
    I'm THE ONLY person in this company that knows anything about this kind of stuff, so I would rather keep the server on an external machine for now.
    I don't think I'll get permission to play around in the 400 with this kind of stuff, until I can DO something.

    I'm sure I'm leaving a ton of stuff out, but any documentation you could point me towards would help a lot.

  • #2
    I don't kn ow why you are bothering with setting up another server. HTTPAPI consumes REST as easily as SOAP. What am I missing?

    Comment


    • #3
      Originally posted by c0nfitty View Post
      I'm trying to get into REST web services with our iseries.

      We installed Scott Klement's LIBHTTP package and are currently using several web services using SOAP.
      There are a ton of awesome web services out there that use REST so I've been researching how to get into this.
      HTTPAPI is really designed for REST. Its possible to do SOAP, and 15 years ago when "SOAP was king" I wrote a bunch of examples, but its actually much more intuitive and simple to use it to call REST web services.

      Originally posted by c0nfitty View Post
      I set a Linux machine running Debian 10 and then set up am apache tomcat server on it.
      Where do I go from here?
      The only articles I could find, involved installing and running the tomcat server on the iseries.
      I'm THE ONLY person in this company that knows anything about this kind of stuff, so I would rather keep the server on an external machine for now.
      I don't think I'll get permission to play around in the 400 with this kind of stuff, until I can DO something.
      Here I'm getting a little bit lost. There are two sides to this -- consuming a web service (i.e. "calling" a service) and providing (i.e. "hosting" your own service). Which one are you trying to do?

      You started talking about HTTPAPI, which is only for consuming... but then started talking about setting up a server, which would be for providing. Which one are you trying to do?

      And, I guess it's possible to do this with Tomcat... but seems like an old-school choice. Unless you're primarily a Java shop, its not clear why you'd do this? Most of the docs that I find for providing services on IBM i actually don't even mention Tomcat or WebSphere, but instead point to the Integrated Web Services (IWS) tool that IBM provides to make it easy. This is not only true of REST, but also SOAP. What I find difficult is finding info about other alternatives (which is frequently an issue since IWS has certain limitations.) I've written a number of articles and presentations about this over the years, though. And, its quite common for people to discuss them here.

      But, it's hard to give specific examples since its not clear whether you're talking about providing or consuming?

      Comment


      • #4
        I knew this post would confuse people. Hence the title haha.
        We have implemented the HTTPAPI from the Scott Klement web site so that we could build SOAP envelopes and send them out for a request/reply.
        This is the first time I've worked with XML and the entire concept blew my mind.
        I loved the example programs that came with it, like the "Send a Tweet" with SOAP.

        I've been exploring and I've found other web services that would make my life a lot easier.
        However, most of them don't accept SOAP protocol, they accept REST architecture. (I'm sure my jargon is hilarious)
        It feels like the entire world is three steps ahead of me when it comes to REST, or even web services in general.
        I know I need some type of server to store procedures in right?
        I went for the Tomcat server because I knew it wouldn't cost anything, and if I created it outside of the 400 my chances of bringing the system down would be less likely.
        Am I correct by saying that Websphere or IWS is a paid service, either monthly or a one time fee?

        I don't think the bigwigs at my company would approve any spending on software that I hardly know anything about.
        The Tomcat server was my first stab at getting some sort of proof of concept so that we could then move towards Websphere or IWS.
        I did find some literature about setting up a server with the iseries navigator. That sounded pretty easy, but I think I'm lacking in the foundational knowledge.

        Please send me some links.



        Comment


        • #5
          Look at the HTTPAPI samples. There are examples there of calling REST web services. As both Scott and I have pointed out you already have everything you need to use REST services.

          But to answer your question re WebSphere and IWS - BOTH are available free-of-charge on your IBM i. The version of WebSphere is not the top level enterprise server - but it is more than enough for most needs.

          Your IBM i can be both a REST service supplier (using IWS or "raw" RPG) AND a REST web service consumer using HTTPAPI.

          Basically you are confusing yourself by thinking you need a Tomcat server or Linux or ... anything more than you have.

          Might I suggest that you study Scott's excellent presentations on using RPG to supply and consume web services. Try this one "Options for Consuming REST APIs from RPG" and this one "Providing Web Services on IBM i" both of which - along with sample code - can be accessed here: http://www.scottklement.com/presentations/


          Comment


          • #6
            This is perfect! Thank you guys for the help. This opens a lot of doors for me, and the other developers here.
            I was chatting with one of our consultants this morning and he warned me that running the IWS is a pretty big security concern.

            I see that if I create my own HTTP server (see attached) I can integrate my own security.
            Do you have any other recommendations for security?

            Would my overly-complicated first idea have been more secure since the server didn't run from inside the 400?

            thanks again!

            Comment


            • #7
              I'd love to know his rationale for declaring IWS a security threat. As far as I know connecting it through the regular Apache server - so no difference to creating any HTTP server.

              Comment


              • #8
                This is what he said...

                "You are correct about providing Web Services. There are many ways. Writing your own may not be the best solution. Security is the highest concern. When you open up the system to the internet, you create a huge security problem.

                It's not there when you are consuming Web Services like FedEx and UPS, because you are making the connection. When providing Web Services, you cannot easily control who is trying to connect to the system. Most commercial Web Service software takes into account security before anything else.
                "


                Maybe that was his way of saying "be careful". It's no secret that I'm clueless when it comes to a lot of this.
                I don't want to be the one to blame if our system is breached haha.

                My first thought would obviously be some type of SSL or TLS encryption. After that, I don't know what else I could do.

                Comment


                • #9
                  Yes, what he says is 100% true. But, there's nothing specific to IWS in what he says... ANY time you open up a port that serves out network requests to the Internet, you have to be very, very careful, keep on top of bug fixes, monitor it to make sure its not being abused, etc. It doesn't matter if its IWS, Tomcat, Apache, etc... this applies equally to everything.

                  I asked earlier if you were planning to consume or provide web services, you didn't answer that question.

                  Comment


                  • #10
                    Yes, I avoided the question because, again, I'm kind of clueless about all of this. haha
                    Please let me know if I'm wrong, but from what I've read...
                    Providing web services would be allowing users to access the procedures I have stored on the Server.
                    The term 'Consume' really throws me....
                    Does it mean I can 'Consume' the procedures on my own server, as well as 'Consume' procedures on other servers?

                    I think my lack of foundational knowledge has provided me with terrible google searches.
                    If I'm in the ballpark, then the answer is both.
                    I don't really have an end goal here, other than gaining knowledge on the subject.
                    Just trying to get my feet wet.

                    Comment


                    • #11
                      Originally posted by c0nfitty View Post
                      Providing web services would be allowing users to access the procedures I have stored on the Server.
                      Yes, it provides a service that can be called from elsewhere. (Can be used to call procedures or programs.)

                      Originally posted by c0nfitty View Post
                      The term 'Consume' really throws me....
                      Does it mean I can 'Consume' the procedures on my own server, as well as 'Consume' procedures on other servers?
                      I wonder if you're overthinking this? "Consume" is just the web service term for "call". Instead of "call a program" you "consume a service".

                      Yes, you can consume them from the same machine or a different machine (just as with SOAP).

                      Years ago the most common scenario was that you had different applications running on different machines (doesn't matter if they are servers or desktops for this discussion) and you'd use web services as a way to integrate them. So you'd have multiple computers on the same corporate network calling each other via services, but you wouldn't expose them to the internet. In those days, the only reason you'd open it up to the Internet is for remote users (for example, via mobile apps) to access your data, or perhaps to allow integration with your vendors/customers. Today opening services up to the Internet is much more common because so many companies are putting applications in the cloud. For example, if you have a local inventory system on your IBM i, but the application that is used to re-order inventory is running out on the cloud, you might need the two to be able to call each other, and so you'd use web services. In the old days, that might be SOAP, today its more likely to be REST... but whether its REST or SOAP, the terms "consume" or "provide" are the same.

                      Comment

                      Working...
                      X