Web service request ignores basic WSDL XML element restrictions

Posted by Oliver on Stack Overflow See other posts from Stack Overflow or by Oliver
Published on 2010-03-22T21:40:34Z Indexed on 2010/03/22 21:41 UTC
Read the original article Hit count: 481

Filed under:
|
|

Hi all,

I have encountered some difficulties while trying to validate an incoming soap message to a service I have running on JBoss AS (v. 5.1.0).

In my code, I have explicitly set some fields to be required, eg:

public class MyClass {
    @XmlElement(required=true, nillable=false)
    private List<myOtherObjects> myList;
}

This requirement is also reflected in the WSDL (note the lack of minOccurs="0"):

<xs:element maxOccurs="unbounded" name="myList" type="tns:myOtherObjects" /> 

However, when I do a test soap message that has myList set to empty or null, these restrictions are completely ignored, forcing me to validate manually within the application logic on the service.

I did some searching on the Internet and found out that, on WebLogic, the validation does not seem to be enabled by default, though it can be turned on by modifying the weblogic-webservices.xml file. (http://forums.oracle.com/forums/thread.jspa?threadID=783972&tstart=115)

I’m wondering if there is something similar that I have to do with JBoss AS to enable automatic validation before the soap message reaches the service. Any help would be greatly appreciated.

Oliver

© Stack Overflow or respective owner

Related posts about java

Related posts about web-services