RPC vs Document style

Friday, March 23, 2007

RPC Style

RPC stands for Remote Procedure call, in which the client sends a SOAP request to execute an operation on the Web Service. The SOAP request contains the name of method to be executed and the parameter it takes. The server running the Web Service converts this request to appropriate objects, executes the operation and sends the response as SOAP message to client. At the client side, this response is used to form appropriate objects and return the required information (output) to the client. RPC-style Web Services are tightly coupled because the sending parameters and return values are as described in WSDL (Web Service Description Language ) file and are wrapped in the SOAP body. Following is an example SOAP Body of RPC-style Web Service, which invokes GetStockQuote method with input parameter "ORCL".

<SOAP-ENV:Envelope...>
    <SOAP-ENV:Body>
      <m:GetStockQuote xmlns:m="urn:xmethods:example">
        <m:Symbol>ORCL</m:Symbol>
      </m:GetStockQuote>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Document-style

Document Style Web Service are loosely coupled and the request / response are in the form of XML documents. The client sends the parameter to the Web Service as XML document, instead of discrete set of parameter values. The Web Service processes the document, executes the operation and constructs & sends the response to the client as an XML document . There is no direct mapping between the server objects (parameters, method calls etc) and the values in XML documents. The application has to take care of mapping the XML data values. The SOAP Body of a document style carries one or more XML documents, within its body. The protocol places no constraint on how that document needs to be structured, which is totally handled at the application level. Document-style Web Service follows asynchronous processing. Following is an example SOAP body for Document style Web Service.

<SOAP-ENV:Envelope ...>
    <SOAP-ENV:Body>
       <StockQuoteRequest symbol="ORCL"/>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Read more...

How to invoke Oracle BPEL process from Java?

Thursday, March 22, 2007

Import the following classes.

// To connect to BPEL Process Manager
import com.oracle.bpel.client.Locator;

// To invoke BPEL process
import com.oracle.bpel.client.dispatch.IDeliveryService;

// To process XML messages
import com.oracle.bpel.client.NormalizedMessage;

Add following code to your invokation logic.

1: Connect to BPEL process manager

Locator locator = new Locator("Domain Name", "Pass Word" , "IP Address");

Ex: Locator locator = new Locator("default", "bpel", null);
// null IP address means local server

2: Get the handle of IDeliveryService instance which is used to invoke BPEL process.

IDeliveryService deliveryService =
(IDeliveryService)locator.lookupService(IDeliveryService.SERVICE_NAME );

3: Prepare the XMl message for input.

String xmlData = "XML data";
NormalizedMessage message = new NormalizedMessage( );
message.addPart("payload", xmlData );

4: Invoking BPEL process with two way operations
(which has both input and output messages)

NormalizedMessage res =
deliveryService.request("BPEL Process ID", "Operation Name", "message");
Map payload = res.getPayload();

5: Invoking BPEL process with one way operations
(which takes input message but returns not output)

deliveryService.post("BPEL Process ID", "Operation Name", "message");

Read more...

  © Blogger templates Newspaper by Ourblogtemplates.com 2008

Back to TOP