December 3, 2015

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.

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 content-type="application/json" GPSTargetType="BusinessService" GPSRelativeURI="ForPost" GPSMethod="POST" GPSTarget="GenericParallelSelfTest/REST/CallRESTBackend">
    {"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 Content-Length="121" X-Powered-By="Servlet/2.5 JSP/2.1" GPSIndex="1" GPSBatchIndex="1" Date="Thu, 03 Dec 2015 03:49:23 GMT" Content-Type="application/json; charset=utf-8">
  <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:typ="http://genericparallel/types" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header></soapenv:Header>
   <soapenv:Body>
      <typ:GPS GPSFailMode="NEVER">
         <typ:Requests>

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

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

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

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

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

            <typ:Request GPSTargetType="BusinessService" GPSRelativeURI="ForHead" GPSMethod="HEAD" GPSTarget="GenericParallelSelfTest/REST/CallRESTBackend">
            </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 Content-Length="121" X-Powered-By="Servlet/2.5 JSP/2.1" GPSIndex="1" GPSBatchIndex="1" Date="Thu, 03 Dec 2015 04:00:47 GMT" Content-Type="application/json; charset=utf-8">
               <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 Content-Length="113" X-Powered-By="Servlet/2.5 JSP/2.1" GPSIndex="2" GPSBatchIndex="1" Date="Thu, 03 Dec 2015 04:00:47 GMT" Content-Type="application/json; charset=utf-8">
               <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 Content-Length="91" X-Powered-By="Servlet/2.5 JSP/2.1" GPSIndex="3" GPSBatchIndex="1" Date="Thu, 03 Dec 2015 04:00:47 GMT" Content-Type="application/json; charset=utf-8">
               <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 Content-Length="0" X-Powered-By="Servlet/2.5 JSP/2.1" GPSIndex="4" Connection="close" GPSBatchIndex="1" Date="Thu, 03 Dec 2015 04:00:47 GMT" Content-Type="application/json">
               <soap-env:Envelope>
                  <soap-env:Body></soap-env:Body>
               </soap-env:Envelope>
            </types:Response>
            <types:Response Content-Length="103" X-Powered-By="Servlet/2.5 JSP/2.1" GPSIndex="5" Connection="close" GPSBatchIndex="1" Date="Thu, 03 Dec 2015 04:00:47 GMT" Content-Type="application/json; charset=utf-8">
               <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 and MockMotor, a powerful mock server.

I'm building SOA enterprise systems for clients large and small for almost 20 years. Most of that time I've been 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