Thanks Edwin for beautiful post.
In OSB ( Oracle Service Bus , aqualogic service bus ) it is relative easy to add schema validation to your proxy service and to make a custom exception handling for this validation. Just follow the next steps. First in this example I use these xml schema's for the request and response operation.
The request xsd
<xs:schema xmlns="http://www.test.com/request" xs="http://www.w3.org/2001/XMLSchema" targetnamespace="http://www.test.com/request" elementformdefault="qualified" attributeformdefault="unqualified">
<xs:element name="request">
<xs:complextype>
<xs:sequence>
<xs:element name="runid" type="xs:short"/>
<xs:element name="message" type="xs:string" minoccurs="0"/>
</xs:sequence>
</xs:complextype>
</xs:element>
</xs:schema>
And the response xsd
<xs:schema xmlns="http://www.test.com/response" xs="http://www.w3.org/2001/XMLSchema" targetnamespace="http://www.test.com/response" elementformdefault="qualified" attributeformdefault="unqualified">
<xs:element name="response">
<xs:complextype>
<xs:sequence>
<xs:element name="runid" type="xs:short"/>
<xs:element name="message" type="xs:string" minoccurs="0"/>
<xs:element name="errorid" type="xs:string" minOccurs="0"/>
<xs:element name="error" type="xs:anyType" minOccurs="0"/>
</xs:sequence>
</xs:complextype>
</xs:element>
</xs:schema>
When everything goes well I will only return the runid element else we get the full message with the errorcode. With these xsd's I made a simple WSDL which I can use in the proxy service.
First part of this blog entry is to make the happy flow when this works we can add the xsd validation.
Make a new proxy service and use this WSDL.
The next step is to make a simple business service with file transport
In my case I put the request xml in the c drive temp folder.
Go back to your proxy service where we create a new message flow.
Add a route-node to the flow with inside a new routing. This routing will call the file business service.
Add an assign component to request action flow so I can retrieve the runid from the request and add this to the runid variable. This variable I can use for the response.
To make a return message I add an assign to the response action.Now I add the response template xml to the body variable.
Add an insert to the response action after the assign. In this insert we will add the runid of the request to the runid of the response message.
The first part is finished, you service should work now. In the second part we will add the XSD validation.
To make a custom exception handling for the xsd we need to add a Pipeline Pair node.
In the request pipeline I will add a new stage.
In this stage I use the validation component. Now we have to select an element in the body variable which OSB will validate against the XSD. Provide the XSD and use the raise error option.
Add an error handler to this stage.
Add a new stage in the error handler
First we add an assign to the stage to retrieve the runid of the request message so I can use this for the response.
Add a second assign to the stage. In this assign I will add the response template xml to the body variable.
Add the runid to the response xml
Add the error details to the response xml
And the error code
With the reply we can give back the response xml back to the client. Very important report no error because this is a handled exception.
The second part is also finished, we only have to test this proxy service by adding a unknow element to the request and look at the response. Here is a picture of the result.
8 comments:
Hi,
I am a begninner in OSB, I tried to create a proxy service which reads from a queue on weblogic server.In the business process i have to insert the data read from the queue into the database table.
I have tested the proxy n business service independently both are reading and inserting data in the oracle db table.
But now i am stuck as I know how should the proxy give the read data to business, so that it can insert it into db.
The question might sound real lame but just started working in OSB.Could you plz help me with this.
Regards,
Anju
Hi Anju,
Sorry i missed your posting as it went to spam mail :(.
BTW what you need to do call your business service from proxy service and perform transformation to transform your queue message to business service message.
Please refer my examples in blog posts on how to make OSB from proxy to business service call.
Hi,
I am a beginner in ALSB,i started to create Proxy and Business service.But now my doubt is how to create a split join in Jdeveloper and export it to ALSb or just to create in ALSb itself.Could you help me with the example screenshots like XSD Validation.
Regards,
Rohini
Hi Rohini,
Please refer split join example given in one of my posts. You need to use OSB console to achieve that.
Please let me know if you have more question after that example.
I have just Started working on OSB10gR3. Can i have a post of Split Join in OSB? I have developed a split Join project. But I am getting error while runinng the business service
I have just Started working on OSB10gR3. Can i have a post of Split Join in OSB? I have developed a split Join project. But I am getting error while runinng the business service
Hi Debarshi,
There is already a post on SPLIT JOIN in OSB. Please refer.
Here is the link
http://abhishek-oracleaia-bpel-esb.blogspot.com/2009/03/oracle-service-bus-split-join-example.html
Post a Comment