Invoking REST services in SOA 11g using HTTP Binding
If you want to invoke HTTP
methods like GET or POST in SOA composite application for that HTTP Binding
Adapter is available that can be use to invoke REST services. For example if you
have a web application that has a servlet that takes HTTP GET request with some
parameter and returns an XML response.
So here I am demonstrating with
an example. Create a SOA project with empty composite
Create an sample xsd
<?xml version="1.0" encoding="windows-1252"
?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.example.org"
targetNamespace="http://www.example.org"
elementFormDefault="qualified">
<xsd:element name="Request">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="FName" type="xsd:string"/>
<xsd:element name="LName" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Response">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Name" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.example.org"
targetNamespace="http://www.example.org"
elementFormDefault="qualified">
<xsd:element name="Request">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="FName" type="xsd:string"/>
<xsd:element name="LName" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Response">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Name" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Drop a Http Binding adapter in
exposed services name it HttpTest click next in HTTP Binding
Configuration.
Here you can specify type as
service or reference, service type one way or request response, operation name
and type of HTTP GET or POST.
In
Request message either you can select existing element from a schema or select
the wizard to create it .
Create a bpel process with
Define Service later template
Wire service and bpel
process
In Bpel process drop a receive
activity with create instance checked and connect it with partner link
In assign activity
use concat function to assign name to output variable.
Deploy the application and for test through web
browser
http://TPCW48LLPC0096.ind.zensar.com:7001/soa-infra/services/default/RestFulService/RestServiceTesting?FName=Deepthi&MName=Mani&LName=Reddy&operationName=Request-Response
Following Response
<Response><Name>DeepthiReddy</Name></Response>
By Deepthi Reddy
No comments:
Post a Comment