WebService Exceptions
一、
Exception in thread "main" java.lang.ExceptionInInitializerError at com.sun.xml.internal.bind.api.TypeReference.<init>(TypeReference.java:76) at com.sun.xml.internal.ws.model.RuntimeModeler.processDocWrappedMethod(RuntimeModeler.java:691) at com.sun.xml.internal.ws.model.RuntimeModeler.processMethod(RuntimeModeler.java:612) at com.sun.xml.internal.ws.model.RuntimeModeler.processClass(RuntimeModeler.java:401) at com.sun.xml.internal.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:240) at com.sun.xml.internal.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:312) at com.sun.xml.internal.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:178) at com.sun.xml.internal.ws.api.server.WSEndpoint.create(WSEndpoint.java:456) at com.sun.xml.internal.ws.api.server.WSEndpoint.create(WSEndpoint.java:475) at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.createEndpoint(EndpointImpl.java:213) at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(EndpointImpl.java:143) at com.sun.xml.internal.ws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:102) at javax.xml.ws.Endpoint.publish(Endpoint.java:170) at com.he.Server.main(Server.java:8) Caused by: java.util.MissingResourceException: Can't find bundle for base name com.sun.xml.internal.bind.api.Messages, locale zh_CN at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1427) at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1250) at java.util.ResourceBundle.getBundle(ResourceBundle.java:705) at com.sun.xml.internal.bind.api.Messages.<clinit>(Messages.java:43) ... 14 more Caused by: java.lang.ClassCastException: com.sun.xml.internal.bind.api.Messages cannot be cast to ResourceBundle at java.util.ResourceBundle$Control.newBundle(ResourceBundle.java:2297) at java.util.ResourceBundle.loadBundle(ResourceBundle.java:1364) at java.util.ResourceBundle.findBundle(ResourceBundle.java:1328) at java.util.ResourceBundle.findBundle(ResourceBundle.java:1282) at java.util.ResourceBundle.findBundle(ResourceBundle.java:1282) at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1224) ... 16 more
//代码如下
@WebService public interface MyService { @WebResult(name="addResult")
//当配置的参数name一致时,就会出现此异常,很显然这个异常的信息,言不对题 姑且视为bug吧。 public int add(/**/@WebParam(name="addend1")int i, /**/@WebParam(name="addend1")int j); //@WebResult(name="minusResult") public int minus(/**/@WebParam(name="subtrahend")int i, /**/@WebParam(name="minuend")int j); }
二、
Exception in thread "main" com.sun.xml.internal.ws.streaming.XMLStreamReaderException: unexpected XML tag. expected: {http://service.hzm.com/ws}loginResponse but found: {http://service.hzm.com/ws}login at com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil.verifyTag(XMLStreamReaderUtil.java:203) at com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil.verifyTag(XMLStreamReaderUtil.java:211) at com.sun.xml.internal.ws.client.sei.ResponseBuilder$DocLit.readResponse(ResponseBuilder.java:513) at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:110) at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78) at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107) at $Proxy32.login(Unknown Source) at Client.main(Client.java:14) 原因:在Handler中 将handleMessage的返回值设置为false @Override public boolean handleMessage(MessageContext context) { System.out.println("handleMessage"); return false; }
三、java调用.net webservice Exception: javax.xml.ws.soap.SOAPFaultException: 服务器未能识别 HTTP 头 SOAPAction 的值: 。 java使用soap调用.net webservice需要指定SOAPAction信息,用Apache Cxf可以解决 ID: 1 Address: http://www.webxml.com.cn/WebServices/WeatherWebService.asmx Encoding: UTF-8 Http-Method: POST Content-Type: text/xml Headers: {Accept=[*/*], SOAPAction=["http://WebXml.com.cn/getSupportProvince"]}
四、在用eclipse解析wsdl的时候出现错误信息,百思不得其解,google未果,但是不影响继续开发(直接点finish完成),望知道的朋友指点一下。
Exception: WS-I: (BP 2402) The wsdl: binding element does not use a soapbind: binding element
posted on 2014-04-02 21:10 hzm_frank 阅读(1757) 评论(0) 编辑 收藏 举报