In this sample I will focus on the Proxy Service, so I will ignore any business-proxy-business transformations and the sample will show a simple Business Service virtualization through data by-pass, but implementing some complex validation on the request input that is the main objective of this article.You can download the example artifacts in the links bellow this article.Create a XSD named “validation.xsd” into xsd folder.
– XPath: ./ord: Order Request – In Variable: body – Against Resource: Order Service-v1.wsdl/Order Request – Raise Error Now comes the great part, lets prepare our advanced XQuery validation.
So if you try to assign a soap fault directly to this variable, it just doesn’t work.
To throw a soap fault you must assign the entire soap body.
In this insert we will add the runid of the request to the runid of the response message. Now we have to select an element in the body variable which OSB will validate against the XSD. 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.
The first part is finished, you service should work now. To make a custom exception handling for the xsd we need to add a Pipeline Pair node. Very important report no error because this is a handled exception.