I'm writing a jax-ws document literal soap service. I have an int as an argument. I'm have a client that I test it with. I create a HttpURLConnection and basically pump a file with a soap message to the service. This method I'm invoking takes an int as a parameter. So naturally, I sent a String over and to my surprise, jax-ws converts the String to an int with zero as the value. Id rather throw an exception. I'm not exactly sure how to go about this. I do have a soap handler on my service which dumps soap messages to an error log. Any advice as to how to return an error when the value passed is non numeric? I could just change the argument to a string and manually check once my web method begins to execute but that doesn't seem like the correct way to do this.
Joined: Jul 06, 2010
When you say you send a String to the web service, you mean you send characters and not digits?
Does the web service use RPC style? If so, using Document style instead might help. Document style web services add an XML schema to the WSDL, which specifically defines how the SOAP body should look. So if the request's SOAP body contains a string where there should be an integer, I think that this might cause an error to be thrown.
SCJP 6 || SCWCD 5
Joined: Jul 09, 2001
4.2. Schema Validation explains the subject. I guess it's not enabled by default, due to performance considerations.
William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.