zoukankan      html  css  js  c++  java
  • 调用Axis WebService异常:org.xml.sax.SAXException: Bad envelope tag: definitions

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

    调用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";
  • 相关阅读:
    linux 安装 Chrome
    J2EE版本
    Java 源码解析之局部变量检查
    /etc/xinetd.conf 和 /etc/xinetd.d/*【新网络服务配置】
    Linux 内核编译
    linux 汇编
    /etc/ethers【地址映射】
    Linux LAMP 搭建
    Linux ftp 使用
    linux apache
  • 原文地址:https://www.cnblogs.com/skyeyh/p/3708864.html
Copyright © 2011-2022 走看看