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下安装MongoDB
    Prometheus+Grafana企业监控系统
    微服务项目运维管理
    Jenkins CI&CD 自动化发布项目实战(上篇)
    Docker入门与进阶(下)
    Docker入门与进阶(上)
    Git&Gitlab开发流程与运维管理
    报名中|面基啦~首站深圳线下云原生技术开放日来了
    kubernetes 降本增效标准指南| 容器化计算资源利用率现象剖析
    使用 Velero 跨云平台迁移集群资源到 TKE
  • 原文地址:https://www.cnblogs.com/skyeyh/p/3708864.html
Copyright © 2011-2022 走看看