groovy.lang.GroovyRuntimeException: Ambiguous method overloa



我需要动态解析WSDL文件。

我的代码在这里:

package com.wsdl.migration;
import com.predic8.schema.Schema;
import com.predic8.wsdl.Definitions;
import com.predic8.wsdl.Fault;
import com.predic8.wsdl.Message;
import com.predic8.wsdl.Operation;
import com.predic8.wsdl.Part;
import com.predic8.wsdl.PortType;
import com.predic8.wsdl.WSDLParser;
import groovy.lang.GrabResolver;
import groovy.lang.MetaMethod;
import javax.xml.namespace.*;
public class FullWSDLParser {
    public static void main(String[] args) {
        WSDLParser parser = new WSDLParser();
        //https://community.workday.com/custom/developer/API/Time_Tracking/v23.0/Time_Tracking.wsdl
       Definitions defs = parser.parse("http://www.thomas-bayer.com/axis2/services/BLZService?wsdl");

        out("-------------- WSDL Details --------------");
        System.err.println("TargenNamespace: t ---- > " + defs.getTargetNamespace());
        if (defs.getDocumentation() != null) {
            out("Documentation: tt" + defs.getDocumentation());
        }
        out("n");
        //defs.getQName().getQualifiedName()
        // For detailed schema information see the FullSchemaParser.java sample.
        out("Schemas: ");
        for (Schema schema : defs.getSchemas()) {
            out("  TargetNamespace: t" + schema.getTargetNamespace());
        }
        out("n");
        out("Messages: ");
        for (Message msg : defs.getMessages()) {
            System.out.println("  Message Name: " + msg.getName());
            System.out.println("  Message Parts: ");
            for (Part part : msg.getParts()) {
                out("    Part Name: " + part.getName());
                out("    Part Element: " + ((part.getElement() != null) ? part.getElement() : "not available!"));
                out("    Part Type: " + ((part.getType() != null) ? part.getType() : "not available!" ));
                out("");
            }
        }
        out("");
        out("PortTypes: ");
        for (PortType pt : defs.getPortTypes()) {
            System.err.println("  PortType Name: " + pt.getName());
            System.out.println("  PortType Operations: ");
            for (Operation op : pt.getOperations()) {
                System.err.println("    Operation Name: " + op.getName());
                System.out.println("------------QNAME - > "+op.getQName());
                System.err.println("    Operation Input Name: "
                    + ((op.getInput().getName() != null) ? op.getInput().getName() : "not available!"));
                System.out.println("    Operation Input Message: "
                    + op.getInput().getMessage().getQname());
                System.out.println("    Operation Output Name: "
                    + ((op.getOutput().getName() != null) ? op.getOutput().getName() : "not available!"));
                System.out.println("    Operation Output Message: "
                    + op.getOutput().getMessage().getQname());
                System.out.println("    Operation Faults: ");
                if (op.getFaults().size() > 0) {
                    for (Fault fault : op.getFaults()) {
                        System.out.println("      Fault Name: " + fault.getName());
                        System.out.println("      Fault Message: " + fault.getMessage().getQname());
                    }
                } else out("      There are no faults available!");
            }
            out("");
        }
        out("");
        out("Bindings: ");
        for (Binding bnd : defs.getBindings()) {
            out("  Binding Name: " + bnd.getName());
            out("  Binding Type: " + bnd.getPortType().getName());
            out("  Binding Protocol: " + bnd.getBinding().getProtocol());
            if(bnd.getBinding() instanceof AbstractSOAPBinding) out("  Style: " + (((AbstractSOAPBinding)bnd.getBinding()).getStyle()));
            out("  Binding Operations: ");
            for (BindingOperation bop : bnd.getOperations()) {
                out("    Operation Name: " + bop.getName());
                if(bnd.getBinding() instanceof AbstractSOAPBinding) {
                    out("    Operation SoapAction: " + bop.getOperation().getSoapAction());
                    out("    SOAP Body Use: " + bop.getInput().getBindingElements().get(0).getUse());
                }
            }
            out("");
        }
        out("");
        out("Services: ");
        for (Service service : defs.getServices()) {
            out("  Service Name: " + service.getName());
            out("  Service Potrs: ");
            for (Port port : service.getPorts()) {
                out("    Port Name: " + port.getName());
                out("    Port Binding: " + port.getBinding().getName());
                out("    Port Address Location: " + port.getAddress().getLocation()
                    + "n");
            }
        }
        out("");
    }
    private static void out(String str) {
        System.out.println(str);
    }
}

我的依赖项的 Gradle 文件在这里:

buildscript {
    ext {
        springBootVersion = '1.5.2.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
    mavenCentral()
}
dependencies {
 compile 'org.springframework:spring-support:2.0.8'
  compile 'org.springframework:spring-aop:4.1.2.RELEASE'
  compile 'org.springframework:spring-beans:4.1.2.RELEASE'
  compile 'org.springframework:spring-context:4.1.2.RELEASE'
  compile 'org.springframework:spring-core:4.1.2.RELEASE'
  compile 'com.squareup.okio:okio:1.11.0'
  compile 'com.squareup.okhttp3:okhttp:3.6.0'
  compile 'org.json:json:20160810'
  compile 'mysql:mysql-connector-java:5.1.38'
  compile 'org.apache.commons:commons-dbcp2:2.0.1'
  compile group: 'org.hibernate.javax.persistence', name: 'hibernate-jpa-2.0-api', version: '1.0.1.Final'
  compile group: 'log4j', name: 'log4j', version: '1.2.17'
  compile('org.springframework.boot:spring-boot-starter-jdbc')
 // https://mvnrepository.com/artifact/com.predic8/soa-model-core
    compile group: 'com.predic8', name: 'soa-model-core', version: '1.5.4'
    // https://mvnrepository.com/artifact/org.reflections/reflections
compile group: 'org.reflections', name: 'reflections', version: '0.9.5-RC2'
}

我的错误日志:

Exception in thread "main" groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method com.predic8.schema.Element#setType.
Cannot resolve which method to invoke for [null] due to overlapping prototypes between:
    [class javax.xml.namespace.QName]
    [class groovy.xml.QName]
    at groovy.lang.MetaClassImpl.chooseMostSpecificParams(MetaClassImpl.java:3268)
    at groovy.lang.MetaClassImpl.chooseMethodInternal(MetaClassImpl.java:3221)
    at groovy.lang.MetaClassImpl.chooseMethod(MetaClassImpl.java:3164)
    at groovy.lang.MetaClassImpl.getNormalMethodWithCaching(MetaClassImpl.java:1380)
    at groovy.lang.MetaClassImpl.getMethodWithCaching(MetaClassImpl.java:1295)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1065)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1027)
    at org.codehaus.groovy.runtime.metaclass.MultipleSetterProperty.setProperty(MultipleSetterProperty.java:54)
    at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:2694)
    at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:3775)
    at com.predic8.soamodel.XMLElement.setProperty(XMLElement.groovy)
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.setGroovyObjectProperty(ScriptBytecodeAdapter.java:532)
    at com.predic8.schema.Element.parseAttributes(Element.groovy:50)
    at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:64)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:174)
    at com.predic8.soamodel.XMLElement.parse(XMLElement.groovy:41)
    at com.predic8.soamodel.XMLElement$parse.call(Unknown Source)
    at com.predic8.schema.ModelGroup.parseChildren(ModelGroup.groovy:37)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:64)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:182)
    at com.predic8.soamodel.XMLElement.parse(XMLElement.groovy:46)
    at com.predic8.soamodel.XMLElement$parse.call(Unknown Source)
    at com.predic8.schema.ComplexType.parseChildren(ComplexType.groovy:41)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:64)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:182)
    at com.predic8.soamodel.XMLElement.parse(XMLElement.groovy:46)
    at com.predic8.soamodel.XMLElement$parse.call(Unknown Source)
    at com.predic8.schema.Schema.parseChildren(Schema.groovy:99)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:64)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:182)
    at com.predic8.soamodel.XMLElement.parse(XMLElement.groovy:46)
    at com.predic8.soamodel.XMLElement$parse.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
    at com.predic8.wsdl.Types.parseChildren(Types.groovy:41)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:64)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:182)
    at com.predic8.soamodel.XMLElement.parse(XMLElement.groovy:46)
    at com.predic8.soamodel.XMLElement$parse.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
    at com.predic8.wsdl.Definitions.parseChildren(Definitions.groovy:251)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:182)
    at com.predic8.soamodel.XMLElement.parse(XMLElement.groovy:46)
    at com.predic8.soamodel.XMLElement$parse.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
    at com.predic8.wsdl.WSDLParser.parseLocal(WSDLParser.groovy:44)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:174)
    at com.predic8.soamodel.AbstractParser.parse(AbstractParser.groovy:35)
    at com.predic8.wsdl.WSDLParser.super$2$parse(WSDLParser.groovy)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1218)
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:132)
    at com.predic8.wsdl.WSDLParser.parse(WSDLParser.groovy:24)
    at com.wsdl.migration.FullWSDLParser.main(FullWSDLParser.java:39)

我从网上得到这个代码。但是我只能使用他们的WSDL网址获得输出,当我使用其他wsdl文件URL时,我抛出错误,说一些与QName有关的事情。我找不到累积问题.所以请帮助我.提前谢谢。

我也遇到了这个问题,并且是时髦版本的问题,

请尝试降级时髦版本。

相关内容

  • 没有找到相关文章

最新更新