0
WSDLファイルを動的に解析する必要があります。groovy.lang.GroovyRuntimeException:メソッドcom.predic8.schema.Element#setTypeのあいまいなメソッドオーバーロード。?
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: \t\t" + 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ファイルのURLと私がエラーをスローすると、私は何かをrelaと言うときに出力は、自分のWSDLのURLを使用することができますQNameでted。私はwsdlとxmlのnewbeeです。私は事実上の問題を見つけることができません。だから私を助けてください。前もって感謝します。
私もこの問題に直面しています。解決策はわかりませんが、疑わしいのは クラスQNameは2つの異なるjarファイルで定義されています。 1. class javax.xml.namespace.QName 2.クラスgroovy.xml.QName つまり、javaとgroovyのxmlライブラリから取得します。ランタイム中のGroovyは、その両方、したがってあいまいさを検出します。 –