java创建soap,如何创建SOAP UI项目并在Java中运行请求

I want to create a Java class that will do the following

1. load/create a SOAPUI project using a wsdl.

2. run requests to the operations in that wsdl.

This is my SoapJavaTest.java file(though this is not complete, it is just registering a project in SOAP UI and printing the operations contained in it)

public class SoapJavaTest{

public static void main(String args[]) throws Exception{

String projectFile ="SoapUIJavaTest\\SoapUIProjects\\soapui-project1.xml";

WsdlProject project = new WsdlProject (projectFile);

//WsdlProject project = new WsdlProject();

WsdlInterface[] wsdls = WsdlImporter.importWsdl(project, "http://metalmaker.net/metalmaker.asmx?WSDL");

WsdlInterface wsdl = wsdls[0];

for (Operation operation : wsdl.getOperationList()){

WsdlOperation op = (WsdlOperation) operation;

System.out.println("OP:"+op.getName());System.out.println(op.createRequest(true));

System.out.println("Response:");System.out.println(op.createResponse(true));

}

}

}

I am getting the following error - 'NoSuchMethodError: org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(Ljava/lang/ClassLoader;Ljava/lang/String;)Lorg/apache/xmlbeans/SchemaTypeSystem;'.

I have included the following jar files

1. commons-cli-1.2

2. commons-httpclient-3.1

3. log4j

4. soapui-3.6-beta2

5. soapui-xmlbeans-2.0.2

6. wsdl-xmlbeans-1.1

7. xbean-1.0.3

8. xmlbeans-xmlpublic-2.2.0

9. XmlSchema-1.0.3

What jar file am I missing or is it the wrong classes that I am using? Any help would be appreciated.

解决方案

Finally I am able to solve this. I am creating a SoapUI project, saving it and sending requests all via code. Please refer to link here for complete details. Thanks.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值