This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I�m using Weblogic 8.1 and acting as web service provider. In the WSDL if we declare a field in response as minouccrs=1 , which means the response should contain this element for sure. My question is whether the weblogic container will raise some fault if we fail to send the response which has the field as minoccurs=1, or as the server side provider do we need to handle this condition and make sure that this field is always part of the response.
In nut shell, does the weblogic or any web services container does any validation before sending the SOAP response to client to make sure that response is strictly according to the WSDL?
Originally posted by satish jupalli: does the weblogic or any web services container does any validation before sending the SOAP response to client to make sure that response is strictly according to the WSDL?
In the general case no validation is done for performance reasons. However minoccurs=1 could have an impact on the generated classes depending on how sophisticated the code generator is. (minOccurs=1, maxOccurs=1) on a simple type that translates to an intrinsic Java type simply translates to a property with a default value (either specified by the WSDL/XML Schema or the Java defaults) as intrinsic types cannot be null. (minOccurs=1, maxOccurs=1) on a complex type that translates to a Java class would require additional code - like a mandatory non-null parameter on the constructor and/or sanity-check in every accessor (getter) of the object to ensure that only consistent instances of the class are used.
You'll simply have to experiment with the generated code to see if violations of the constraints laid down by the WSDL/XML Schema will result in exceptions in the generated Java code.
Take into account that WebLogic 8.1 is a J2EE 1.3 generation platform. Web services didn't enter the J2EE specification until 1.4. So any web service support under WebLogic 8.1 should be viewed as "early" and "proprietary" - so I wouldn't get my hopes up.