日期:2014-05-17  浏览次数:20708 次

100分求助:WEB Service 非string数据类型总是报错
在构建Web Service. 
环境:JBoss 5.1 企业版 + Jdk1.6.
问题:当XML里面的字段设成非string 类型如integer时,如果这个字段的值为空或者输入一个非数字字符时,就会出现以下的错误。本来是想在代码里做验证的,实际上好象根本就没有进入到我的代码,而是在Jbss就报错了。求大虾们指教。

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <S:Fault xmlns:ns4="http://www.w3.org/2003/05/soap-envelope">
         <faultcode>S:Server</faultcode>
         <faultstring>Failed to read a response: javax.xml.bind.UnmarshalException
 - with linked exception:
[javax.xml.bind.UnmarshalException: For input string: ","
 - with linked exception:
[java.lang.NumberFormatException: For input string: ","]]</faultstring>
         <detail>
            <ns2:exception class="com.sun.xml.ws.encoding.soap.DeserializationException" note="To disable this feature, set com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptureStackTrace system property to false" xmlns:ns2="http://jax-ws.dev.java.net/">
               <message>Failed to read a response: javax.xml.bind.UnmarshalException
 - with linked exception:
[javax.xml.bind.UnmarshalException: For input string: ","
 - with linked exception:
[java.lang.NumberFormatException: For input string: ","]]</message>
               <ns2:stackTrace>
                  <ns2:frame class="com.sun.xml.ws.server.sei.EndpointMethodHandler" file="EndpointMethodHandler.java" line="235" method="invoke"/>
                  <ns2:frame class="com.sun.xml.ws.server.sei.SEIInvokerTube" file="SEIInvokerTube.java" line="75" method="processRequest"/>
                  <ns2:frame class="com.sun.xml.ws.api.pipe.Fiber" 

。。。。。。。。。。。
                              <ns2:frame class="org.apache.catalina.valves.ErrorReportValve" file="ErrorReportValve.java" line="102" method="invoke"/>
                              <ns2:frame class="org.jboss.web.tomcat.service.jca.CachedConnectionValve" file="CachedConnectionValve.java" line="158" method="invoke"/>
                              <ns2:frame class="org.apache.catalina.core.StandardEngineValve" file="StandardEng