.
In simple words if we have the XSD file of
web service we can validate the request of
the web service against that XSD using a
schema validation filter in Mule..
Let’s see how…
Let consider we have a SOAP webs ervice exposed in Mule by
following way :-
Now, if we want to validate the request with an XSD file of the
web service and want to throw a custom message in case if the
SOAP request is invalid or incorrect, we need to use schema
validation filter
So after adding schema validation filter in our flow, our flow
looks like the following
We can also add a subflow which will throw custom message
if the SOAP request is invalid as follow :-
So, if we test the webservice with a wrong SOAP request in
SoapUI we will get a custom message :-
This is how the flow works:-
The code:-
You need to use schema validation filter which will refer to
your XSD files for validating a SOAP request as follows:-
The Schema Validation Filter uses the JAXP libraries to validate a message
against a schema. You must provide the path, file name, and extension of
the schema or schemas in the Schema Locations property.
A code snipped of the Mule config:-
To get the full code access for implementing a SOAP Request
validator in Mule, please visit :-
http://anirbansenchowdhary.com/blog/?p=131
You can also visit Mule documentation on Schema Validation
:-
http://www.mulesoft.org/documentation/display/current/
Schema+Validation+Filter
Mule soap

Mule soap

  • 2.
  • 3.
    In simple wordsif we have the XSD file of web service we can validate the request of the web service against that XSD using a schema validation filter in Mule..
  • 4.
    Let’s see how… Letconsider we have a SOAP webs ervice exposed in Mule by following way :-
  • 5.
    Now, if wewant to validate the request with an XSD file of the web service and want to throw a custom message in case if the SOAP request is invalid or incorrect, we need to use schema validation filter
  • 6.
    So after addingschema validation filter in our flow, our flow looks like the following
  • 7.
    We can alsoadd a subflow which will throw custom message if the SOAP request is invalid as follow :-
  • 8.
    So, if wetest the webservice with a wrong SOAP request in SoapUI we will get a custom message :-
  • 9.
    This is howthe flow works:-
  • 10.
    The code:- You needto use schema validation filter which will refer to your XSD files for validating a SOAP request as follows:- The Schema Validation Filter uses the JAXP libraries to validate a message against a schema. You must provide the path, file name, and extension of the schema or schemas in the Schema Locations property.
  • 11.
    A code snippedof the Mule config:-
  • 12.
    To get thefull code access for implementing a SOAP Request validator in Mule, please visit :- http://anirbansenchowdhary.com/blog/?p=131 You can also visit Mule documentation on Schema Validation :- http://www.mulesoft.org/documentation/display/current/ Schema+Validation+Filter