问题
I want to create a SOAPUI project using a wsdl.
this is my code :
File projectFile =new File("Test/sampleURI-soapui-project");
SoapUI.setSoapUICore(new StandaloneSoapUICore(true));
WsdlProject project = new WsdlProject("sampleURI");
WsdlInterface[] wsdls = WsdlImporter.importWsdl(project, "http://192.168.18.171/sample/api/v2_soap/?wsdl");
for(int j=0;j<wsdls.length;j++){
WsdlInterface wsdl = wsdls[j];
String soapVersion = wsdl.getSoapVersion().toString();
int c = wsdl.getOperationCount();
String reqContent="";
String result="";
for(int i=0;i<c;i++){
WsdlOperation op = (WsdlOperation) wsdl.getOperationAt(i);
String opName = op.getName();
reqContent = op.createRequest(true);
WsdlRequest req = op.addNewRequest("Req_"+soapVersion+"_"+opName);
}
}
I am getting the following error :
WARN [SoapUI] Missing folder [D:\EclipsePrograms\kepler-workspace\Test.\ext] for external libraries Exception in thread "main" java.lang.NoSuchMethodError: org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(Ljava/lang/ClassLoader;Ljava/lang/String;)Lorg/apache/xmlbeans/SchemaTypeSystem; at com.eviware.soapui.config.SoapuiSettingsDocumentConfig.(Unknown Source) at com.eviware.soapui.config.SoapuiSettingsDocumentConfig$Factory.parse(Unknown Source) at com.eviware.soapui.DefaultSoapUICore.initSettings(DefaultSoapUICore.java:211) at com.eviware.soapui.SwingSoapUICore.initSettings(SwingSoapUICore.java:118) at com.eviware.soapui.DefaultSoapUICore.init(DefaultSoapUICore.java:142) at com.eviware.soapui.StandaloneSoapUICore.(StandaloneSoapUICore.java:37) at sampleSoap.main(sampleSoap.java:20)
What jar file am I missing for getting this issue?.Any help would be appreciated.
回答1:
This typeSystemForClassLoader
method is introduced after version 2.0.0 of xbean .Use a greater version (2.1.0) for solving this issue. Compare javadoc of 2 versions
<dependency>
<groupId>xmlbeans</groupId>
<artifactId>xbean</artifactId>
<version>2.1.0</version>
</dependency>
回答2:
I had the same Exception. After using SoapUI Pro the Problem was solved.
You can try out the SoapUI Pro trial for 2 weeks at the moment. Just imported the new SoapUI.jar and it works well.
来源:https://stackoverflow.com/questions/20660192/to-create-a-soapui-project-using-a-wsdl