David Portabella David Portabella - 1 month ago 25
Java Question

Java. Validate SOAP message against a WSDL

I need to validate a SOAP message against a

WSDL
?
(in the same way that an
XML
file can be validated against a
XSD
schema).

I am not calling any webservice;
I just have a
SOAP
message and a
WSDL
, and I need to verify that the
SOAP
message is correct.
without calling the webservice or whatsoever afterwards.

I need to make this validate within a Java program.
Do you know of a small Java library to do this?

ps: I am aware that several
JAX-WS
libraries can validate the request/response when you call a webservice. But again, I am not calling any webservice; I have a simple
SOAP
message, and a
WSDL
, and I a need a function that validates the
SOAP
message against the
WSDL
.

ps: I am also aware that there tools that can do this, such as
SOAPUI
and
XMLSpy
. Again, I need to do this validation within my Java program.

ps: I am aware that I could extract the body part of the
SOAP
message, and validate it against the
XSD
. However, I'd like to validate the entire
SOAP
message against the
WSDL
.

BPS BPS
Answer

You might look at the source code for the WsdlValidator class in the open-source soapUI project.

https://github.com/SmartBear/soapui

http://www.soapui.org/apidocs/com/eviware/soapui/impl/wsdl/support/wsdl/WsdlValidator.html