Skip to main content

Wrong value set in a binding object in a web service

Please note these forums are being decommissioned and use the new and improved forums at
1 reply [Last post]
Joined: 2010-12-21

I am getting wrong values in my object when it is received at the server side:
I have the following input that I send to my web service:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<line time="2010-11">109.80</line>
<line time="2010-12">11.0</line>
I have written XSD files to describe my xml documents, and used them to generate the binding classes with JAXB. The element "line" is a double according to my xsd schema.
I have a test client with fire this message:
String file = "C://data//test.xml";
try {
URL url = new URL(Configuration.UPLOAD);
MyUploadService service = new MyUploadService (url, TestToolkit.WS__SERVICE_NAME);
Dispatch<Source> dispatch = service.createDispatch(TestToolkit.WS__PORT_NAME, Source.class,
String xmlIn =;
StringReader reader = new StringReader(xmlIn);
Source sourceIn = (Source) new StreamSource(reader);
Source sourceOut = dispatch.invoke(sourceIn);
String xmlOut = TestToolkit.getXmlFromSource(sourceOut);
System.out.println("xmlOut " + xmlOut);
} catch (Exception e) {

I have a web service that expect an input which is defined in one of the xsd schema's and wsdl. In my Server I implemented the service and it look like:
public XmlUploadResponseType getUpload(XmlUploadRequestType uploadRequest) throws UploadException {
The XmlUploadRequestType Object describes the root element of the XML file and is generated.
Now, if I change the value of the element "line" to a non double (not a valid value) I get a zero value for that element in my server side. Can anyone explain me how this happens?
Somewhere is the xml file transformed to binding classes. According to the xsd it should not be possible to have a non double and the zero is set instead. Can I set the validation somewhere to only receive valid objects in the server?
Thanks a lot,


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2010-12-21

I found the solution. The validation can be set on in the class that implements the web service by using @SchemaValidation() annotation:
@HandlerChain(file = "HandlerChain.xml")
public class UploadServiceImpl implements UploadEndPoint {
this Link was useful: