1 2 3 Previous Next 32 Replies Latest reply on Jul 7, 2011 3:25 PM by luke.samad Go to original post
      • 15. Re: httprouter issues with GET/POST WADL Services and Web Routing
        jackalista

        OK, you gave me a class called JerseyClientSingleton, but you also have a 3rd party class of the same name.  Where is this com.yellowbook.soa.esb stuff from?  I don't see that in any of the jars mentioned, where is that from?

        • 16. Re: httprouter issues with GET/POST WADL Services and Web Routing
          jackalista

          I'm trying to run down some of the last issues so I can try to get this stuff running.  There is an HttpRequest class that's extracted from the incoming message (in my case this won't exist, as I'm not trying to route, but to simply make an outgoing request) and you use the query params to supply to the outgoing GET request.  I'm trying to make sure I have the right imports, so checking your HttpRequest from the jboss package (org.jboss.soa.esb.http.HttpRequest) against the javadocs, I'm seeing a slight discrepancy, here's the call imbedded in your http client get call:

           

          response = JerseyClientSingleton.get(endpointUrl
                                                          ,requestInfo.getQueryParams()
                                                          ,method
                                                          ,restfulrequest
                                                          );

           

          from: http://docs.jboss.org/resteasy/docs/1.0.0.GA/javadocs/index.html, see HttpRequest

           

          There's a *similar* method called "getFormParameters()" but nothing called getQueryParams(), am I looking at the right class here?

           

          Also, since I don't have an incoming request, it looks like I'll have to go construct this:

           

          MultivaluedMap<java.lang.String,java.lang.String>

           

          Where can I read about how to use this thing?  I'm looking at the Jersey site but it's not clear exactly what I need to look at, any pointer to relevant docs woiuld be great...

           

          I have now got this code to compile and load into the ESB, but I had to comment out one of your "get" methods from the JerseyClientSingleton class you get me, the compiler didn't like the ambiguity between the two supplied methods.  I am manually constructing the 2nd map parameter for the "get" method as I have no incoming request to exploit to get this value, I'm making a fresh GET request with a couple of String valued query parameters, so I used a CaseInsensitiveMap, which implements the spec'ed interface.  If any of this looks off base to you, please do tell, I've no familiarity with Jersey whatsoever, but I am just trying to make a pretty simple GET request.  I will go try reading up on the Jersey code and it's care and feeding, but any details relating to this would be much appreciated.  Also, I'm kind of surprised, what with jboss making statements about REST that it takes this level of screwing around to make a simple service call from an action pipeline, so there really is no support other than roll your own, eh?    Anyway, thanks a *ton* for your kind contribution of code, and I will set about to getting this stuff working, any further details and / or pointers to docs gladly accepted...

           

          --j

          • 17. Re: httprouter issues with GET/POST WADL Services and Web Routing
            davesiracusa

            I mentioned I was using SOA-P 5.0, what version are you using?

             

             

             

            org.jboss.soa.esb.http.HttpRequest has getQueryParams while org.jboss.resteasy.spi doesn't.

             

             

            endpointUrl  - http://server/resources

            requestInfo.getQueryParams() - name/value pair should suffice assuming you are doing a GET

             

             

            method - somemethod, basically appended to the endpointUrl

             

            restfulrequest - likely to be null or empty

             

             

            response = JerseyClientSingleton.get (

             

             

                                                                                  endpointUrl

             

             

                                                                                  ,requestInfo.getQueryParams()

                                                                                   ,method

                                                                                  ,restfulrequest

                                                                                  );

             

             

             

            The get methods have different parameters, make sure the map imports in this file are intact.

             

            • 18. Re: httprouter issues with GET/POST WADL Services and Web Routing
              jackalista

              I'm using the soa 5.0 (from JBoss you mean, right?) dist.  You didn't give me any Map imports for the WADLAction class, but what I'm using is this:

               

              import org.jboss.resteasy.util.CaseInsensitiveMap;

               

              the code looks like this, I'm about to try running it:

               

              ...

              CaseInsensitiveMap queryParamterMap = new CaseInsensitiveMap();
              queryParamterMap.putSingle("action", "getprofile");
              queryParamterMap.putSingle("busta", "27184283");

               

              response = JerseyClientSingleton.get    (endpointUrl
                                                                         ,queryParamterMap
                                                                         ,method
                                                                         ,""
                                                                         );

               

               

              The "" is the request body, and "method" is a String parameter set to "GET"... I'll let ya know how it goes in a minute... (but feel free to correct me on anything that needs it...)

              • 19. Re: httprouter issues with GET/POST WADL Services and Web Routing
                davesiracusa

                I looked at the SOA-P HttpRequest source, the query map is a:

                private Map<String, String[]> queryParams = new HashMap<String, String[]>();

                 

                Looks like I assumed wrong.  I'm only making POST calls.

                • 20. Re: httprouter issues with GET/POST WADL Services and Web Routing
                  jackalista

                  Oh, sweet, thanks, I got a NullPointerException, I was wondering if the problem was with the Map... can you throw me a link to that src?  Or do I have to download it from our subscriber account or something, do you know?  If it's protected, I will see if I can get it via proper channels, but if it's out on a public svn server, I'd love the link.  Thx,

                   

                  --j

                  • 21. Re: httprouter issues with GET/POST WADL Services and Web Routing
                    davesiracusa

                    My bad, I was correct, my overloaded get passes

                    Map<String, String[]> requestParams

                    • 23. Re: httprouter issues with GET/POST WADL Services and Web Routing
                      davesiracusa

                      I hope I haven't led you down RESTful rapids....  On my end I needed to support much more than a singular request.

                      If your needs are modest you can simply make a httpclient call.  Keep in mind you will need to set connection and host limits beyond the 20, and 2 with an out-of-box httpclient.  If you don't set those limits your concurrency and performance will be bad.

                      • 24. Re: httprouter issues with GET/POST WADL Services and Web Routing
                        jackalista

                        I don't thnk so, I just got it working, I'm spewing XML all over the place, thanks Dave.  So we have a set of REST-like services that we will want to interact with on the bus, the exact architecture isn't determined just yet, we're just getting going with it (the ESB) now but being able to consume several of these services is one thing we needed, I suspect we may want to expose these services on the bus too which may require different sorts of things so I don't think this was a bad thing, I got a solution that's perhaps part of an evolving component to talk to restful services, we need that and it appears that's what Jersey's purpose is so it's sensible enough right now, I'm just at POC stage so it's all good.

                         

                        It *does* make me wonder about JBoss ESB a bit, as while I like it, this is an awful lot of work to do to be able to talk to REST implementations from the bus, I would have thought JBoss would have provided this component.  That said, you don't mind if I post the source for this do you?  I've got it working as part of one of the quick starts so it's easy to deply and would hate to see the next who knows how many people have to repeat these steps... If I don't hear that you *don't* want me to post the source, I'll post it, at least to help those trying to do similar things get going.  I have to clean it up a little and will atribute all but it's whittling down / repackaging to you as that's the reality of it.  Anyway, I'm curious as to your thoughts but no, it's a starting point and much appreciated for what it is!

                         

                        --j

                        • 25. Re: httprouter issues with GET/POST WADL Services and Web Routing
                          davesiracusa

                          It's fine to post,  thanks for attributing a portion to me.  As far as REST,  it's not as mature as SOAP, especially WADL-based REST.

                          SOAPUI and well as other tools are just starting to support it, not perfectly though.

                          • 26. Re: httprouter issues with GET/POST WADL Services and Web Routing
                            jackalista

                            yeah, this thing appears relatively stable, thanks man, much appreciated!

                            • 27. Re: httprouter issues with GET/POST WADL Services and Web Routing
                              jackalista

                              Here's some src, it is very rough and not at all componentized but will get ya going...

                               

                              --j

                              • 28. Re: httprouter issues with GET/POST WADL Services and Web Routing
                                jackalista

                                Oh, forgot to mention in the readme, you will need to go find a real REST endpint and use that instead of the dummy one in WADLACtion.java and you will also need to give "real" SMTP values for your network in jboss-esb.xml, didn't want to leave my details in there, sorry .  Other than that, I think it's redy to run...

                                 

                                --j

                                • 29. Re: httprouter issues with GET/POST WADL Services and Web Routing
                                  jackalista

                                  Here's a slightly more verbose readme, including the comments from above that I forgot at first, the rest of the files in the archive are exactly the same, I woiuld just delete the earlier archive and upload this but couldn't find out how.  Anyway this should be a bit more self contained and should run out of the box as long as you put in a good end point and SMTP server config.