GenericParallel 1.5 is now with REST Support!

GenericParallel 1.5.0 now allows to use non-XML content, as well as HTTP POST, PUT, GET, DELETE and relative URIs. Download GenericParallel 1.5.

172952

OSB’s split-join is WSDL-only facility. Your message must be a SOAP one to be routed anywhere from split-join.

This is quite a limitation. With the rise of REST services we do need to call multiple REST services in parallel.

GenericParallel, too, was only accepting SOAP and XML messages.

But not anymore!

Syntax for REST

I will document the new functionality in full later. For time being, all you need to know is that you can:

  • Have payloads that are not XML (i.e. JSON, text, CSVs, whatnot)
  • Specify HTTP method to use (POST, PUT, GET, DELETE, …)
  • Specify relative URI to use

Example: here I’m sending a JSON payload to a business service named GenericParallelSelfTest/REST/CallRESTBackend, with HTTP method POST and relative URI /ForPost. I also specify the content type as application/json:

<typ:Request 
  GPSTarget="GenericParallelSelfTest/REST/CallRESTBackend"
  GPSTargetType="BusinessService"
  GPSMethod="POST"
  GPSRelativeURI="ForPost"
  Content-Type="application/json">
    {"name":"gps-aaa"}
  </typ:Request>

The response will contain the payload and any of the necessary headers, including the content type, like this:

<types:Response GPSIndex="1" GPSBatchIndex="1" Date="Thu, 03 Dec 2015 03:49:23 GMT" Content-Length="121" Content-Type="application/json; charset=utf-8" X-Powered-By="Servlet/2.5 JSP/2.1">
  <soap-env:Envelope>
    <soap-env:Body>{"method":"POST","relativeURI":"ForPost.gps","contentType":"application/json; charset=utf-8","body":"{'name':'gps-aaa'}"}</soap-env:Body>
  </soap-env:Envelope>
</types:Response>

(The response here is from a REST Echo test service, that’s why it lists all the parameters I used in the call within its JSON response.)

A more complicated, parallel call to a REST service which includes more HTTP methods, is below:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://genericparallel/types">
   <soapenv:Header/>
   <soapenv:Body>
      <typ:GPS GPSFailMode="NEVER">
         <typ:Requests>
         
            <typ:Request 
            	GPSTarget="GenericParallelSelfTest/REST/CallRESTBackend"
            	GPSTargetType="BusinessService"
            	GPSMethod="POST"
            	GPSRelativeURI="ForPost.gps"
            	Content-Type="application/json">
             {"name":"gps-aaa"}
            </typ:Request>

            <typ:Request 
            	GPSTarget="GenericParallelSelfTest/REST/CallRESTBackend"
            	GPSTargetType="BusinessService"
            	GPSMethod="PUT"
            	GPSRelativeURI="ForPut"
            	Content-Type="application/x-son">
             {"name":"bbbz"}
            </typ:Request>

            <typ:Request 
            	GPSTarget="GenericParallelSelfTest/REST/CallRESTBackend"
            	GPSTargetType="BusinessService"
            	GPSMethod="GET"
            	GPSRelativeURI="ForGet">
            </typ:Request>

            <typ:Request 
            	GPSTarget="GenericParallelSelfTest/REST/CallRESTBackend"
            	GPSTargetType="BusinessService"
            	GPSMethod="DELETE">
            </typ:Request>

            <typ:Request 
            	GPSTarget="GenericParallelSelfTest/REST/CallRESTBackend"
            	GPSTargetType="BusinessService"
            	GPSMethod="DELETE"
            	GPSRelativeURI="ForDelete/1/2/3">
            </typ:Request>

            <typ:Request 
            	GPSTarget="GenericParallelSelfTest/REST/CallRESTBackend"
            	GPSTargetType="BusinessService"
            	GPSMethod="HEAD"
            	GPSRelativeURI="ForHead">
            </typ:Request>

         </typ:Requests>
      </typ:GPS>
   </soapenv:Body>
</soapenv:Envelope>

and the response is below. As you can see, GenericParallel 1.5.0 doesn’t handle REST errors as well as it should – the REST payload is lost when the HTTP status is 500. This is to be fixed in 1.5.1.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soap-env:Body xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
      <types:GPSResponse xmlns:types="http://genericparallel/types">
         <types:Responses>
            <types:Response GPSIndex="1" GPSBatchIndex="1" Date="Thu, 03 Dec 2015 04:00:47 GMT" Content-Length="121" Content-Type="application/json; charset=utf-8" X-Powered-By="Servlet/2.5 JSP/2.1">
               <soap-env:Envelope>
                  <soap-env:Body>{"method":"POST","relativeURI":"ForPost.gps","contentType":"application/json; charset=utf-8","body":"{'name':'gps-aaa'}"}</soap-env:Body>
               </soap-env:Envelope>
            </types:Response>
            <types:Response GPSIndex="2" GPSBatchIndex="1" Date="Thu, 03 Dec 2015 04:00:47 GMT" Content-Length="113" Content-Type="application/json; charset=utf-8" X-Powered-By="Servlet/2.5 JSP/2.1">
               <soap-env:Envelope>
                  <soap-env:Body>{"method":"PUT","relativeURI":"ForPut","contentType":"application/x-son; charset=utf-8","body":"{'name':'bbbz'}"}</soap-env:Body>
               </soap-env:Envelope>
            </types:Response>
            <types:Response GPSIndex="3" GPSBatchIndex="1" Date="Thu, 03 Dec 2015 04:00:47 GMT" Content-Length="91" Content-Type="application/json; charset=utf-8" X-Powered-By="Servlet/2.5 JSP/2.1">
               <soap-env:Envelope>
                  <soap-env:Body>{"method":"GET","relativeURI":"ForGet","contentType":"text/plain; charset=utf-8","body":""}</soap-env:Body>
               </soap-env:Envelope>
            </types:Response>
            <types:Response GPSIndex="4" GPSBatchIndex="1" Date="Thu, 03 Dec 2015 04:00:47 GMT" Content-Length="0" Connection="close" Content-Type="application/json" X-Powered-By="Servlet/2.5 JSP/2.1">
               <soap-env:Envelope>
                  <soap-env:Body/>
               </soap-env:Envelope>
            </types:Response>
            <types:Response GPSIndex="5" GPSBatchIndex="1" Date="Thu, 03 Dec 2015 04:00:47 GMT" Content-Length="103" Connection="close" Content-Type="application/json; charset=utf-8" X-Powered-By="Servlet/2.5 JSP/2.1">
               <soap-env:Envelope>
                  <soap-env:Body>{"method":"DELETE","relativeURI":"ForDelete/1/2/3","contentType":"text/plain; charset=utf-8","body":""}</soap-env:Body>
               </soap-env:Envelope>
            </types:Response>
            <types:Response GPSIndex="6" GPSBatchIndex="2">
               <soap-env:Envelope>
                  <soap-env:Body>
                     <soap-env:Fault>
                        <faultcode>soapenv:Server</faultcode>
                        <faultstring>BEA-380000: Internal Server Error</faultstring>
                        <detail>
                           <con:fault xmlns:con="http://www.bea.com/wli/sb/context">
                              <con:errorCode>BEA-380000</con:errorCode>
                              <con:reason>Internal Server Error</con:reason>
                              <con:location>
                                 <con:node>DR</con:node>
                                 <con:path>response-pipeline</con:path>
                              </con:location>
                           </con:fault>
                        </detail>
                     </soap-env:Fault>
                  </soap-env:Body>
               </soap-env:Envelope>
            </types:Response>
         </types:Responses>
      </types:GPSResponse>
   </soap-env:Body>
</soapenv:Envelope>

Download GenericParallel 1.5 and happy RESTing! :-)

Vladimir Dyuzhev, author of GenericParallel

About Me

My name is Vladimir Dyuzhev, and I’m the author of GenericParallel, an OSB proxy service for making parallel calls effortlessly.

I’m building SOA enterprise systems for clients large and small for almost 20 years. Most of that time I’m working with BEA (later Oracle) Weblogic platform, including OSB and other SOA systems.

Feel free to contact me if you have a SOA project to design and implement. See my profile on LinkedIn.

I live in Toronto, Ontario, Canada.  canada   Email me at info@genericparallel.com


2 comments on “GenericParallel 1.5 is now with REST Support!
  1. Thanks for the GenrericParallel Service. I am trying to parallel publish to 5 Business Services. But my message content is huge. For each Requests/Request my message body is very huge. AS a result, the end XML is very huge, spawning upto 40 MB. But the message body is same across all the Request. Is there a way i can reuse the same Body across all the request, and the publish the same body to different destinations ?

    • Vlad Dyuzhev says:

      Hello, Vignesh.

      As far as I can tell, you have two options:

      1. Place the payload into a shared storage, and pass only its ID to the receiving proxy which in turn retrieves the payload and does the call. The shared storage can be a distributed cache (Coherence, Redis, ehcache, SOSS) or a file system (see my Dehydration post for an example).
      2. Another option is to modify GenericParallel to accept more than one target per request. E.g. have GPSTarget, GPSTarget2, … attributes or pass the values in a comma-separated list to GPSTarget. Then update the flow to create separate calls for each value. It looks like a special case, so I’m not likely to add it to GenericParallel myself, but you’re free to modify your copy as you like.

      Hope that helps.

Leave a Reply

Your email address will not be published. Required fields are marked *

*