Friday, January 14, 2011

Dynamic Validate Action in Oracle Service Bus

Till current release of OSB (11.1.1.3), there is no support for dynamically specifying XML Schema/WSDL and Elements/Types for schema validation using "Validate" action of OSB. You have to select XSD/WSDL and Element/Type at design time itself.

This has been raised as an ER (Enhancement Request) to Oracle, and it is expected that future release of OSB will have this Dynamic Validation kind facility.

For the time being users can rely on Java (XMLBeans & OSB java API) to implement this solution. Using java callout for validation will slightly hurt you on performance. After measuring, I found that on an average it takes almost thrice time as compare to OSB validate action if you use java but still it is the best choice in the case when you have hundreds of schemas/WSDL's to choose

Another option may be to use IF-ELSE statements in the message flow and select WSDL's/XSD's at design time itself and at runtime whichever condition gets fulfilled, that Validate action will execute. This alternative is best for the cases when you have very limited number of WSDL's/XSD's

Hope to see the Dynamic Validate action enhancement soon!! :)

10 comments:

  1. How do we write xpath condition for xsi:type how do we extract local name and uri for the value of xsi:type? If we want to go with if-else condition

    ReplyDelete
  2. You may use XQuery functions fn:namespace-uri() and fn:local-name()

    ReplyDelete
  3. Its not working...I tried even different QName functions.
    fn:namespace-uri($body/ref:getReferenceData/GenericDataTypeRequest/attribute::xsi:type)
    =
    fn:namespace-uri($SpecificDataTypeRequest)

    Here I have created SpecificDataTypeRequest as variable from xsd.
    Getting Invalid xsi:type qname: 'ns5:SpecificDataTypeRequest' even though ns5 is declared

    ReplyDelete
  4. Please raise a thread in Oracle SOA suite forum with the details -

    http://forums.oracle.com/forums/forum.jspa?forumID=320

    ReplyDelete
  5. I am also facing the same issue as Sravan. Have you raise a thread on Oracle SOA suite forum? If yes then can you give its link and have you found solution.
    Thanks to Anuj for nice blog.

    ReplyDelete
  6. Hi,

    we are trying to develop dynamic validation by using java callout. Yet, we are in trouble when our xsd schema is importing another xsd schema. It raises an exception that says ".... URL .. is not well formed". We are using relative paths in our xsd files. Can you help us?

    Thnx,
    Fatma

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
  8. @Sravan Gurugubelli

    OSB supports dynamic validation if we have the usage of xsi;

    Lets take an example,

    A , A1 and A2 are three schemas structure.
    A1 and A2 extends A.

    Now, the request is A xsi:type="A1".

    what you need to do in validation stage is:

    validate request in body against A

    It will dynamically try to validate with A1 structure.

    Now,if the request is A xsi:type="A2"

    it will validate against A2 structure.

    Try a POC , check it. I am sure since I have used it in my project.

    ReplyDelete
  9. Yes, but If you have A1 with one parameter diferent that A, you can't validate it. :(

    ReplyDelete
  10. For example:

    A have P1, P2
    A1 have P1, P2, P3

    You can't validate A1

    ReplyDelete