码迷,mamicode.com
首页 > Web开发 > 详细

调用Axis WebService异常:org.xml.sax.SAXException: Bad envelope tag: definitions

时间:2014-05-09 12:20:40      阅读:1171      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   class   code   java   

用Eclipse直接创建的webservice客户端,调用webservice:
bubuko.com,布布扣
String endpoint = "XXXService?wsdl";
XXXServiceProxy proxy = new XXXServiceProxy(endpoint);
try{
    String result = proxy.request();
    System.out.println(result);
}catch(RemoteException e){
    e.printStackTrace();      
}
bubuko.com,布布扣

调用webservice出现异常:

 
Caused by: org.xml.sax.SAXException: Bad envelope tag:  definitions
at org.apache.axis.message.EnvelopeBuilder.startElement(EnvelopeBuilder.java:71)
at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1048)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(Unknown Source)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
... 12 more
 
在网上找到解决办法:
String endpoind = "XXXService?wsdl";
创建endpoint的时候不能加上?wsdl,改为:
String endpoint = "XXXService";

调用Axis WebService异常:org.xml.sax.SAXException: Bad envelope tag: definitions,布布扣,bubuko.com

调用Axis WebService异常:org.xml.sax.SAXException: Bad envelope tag: definitions

标签:des   style   blog   class   code   java   

原文地址:http://www.cnblogs.com/skyeyh/p/3708864.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!