简体   繁体   English

用于从wsdl创建SOAP请求的Java代码

[英]Java code for creating SOAP request from wsdl

I have a requirement of creating SOAP request xml for one operation from wsdl(using wsdl url). 我需要为wsdl的一项操作(使用wsdl url)创建SOAP请求xml。 I am getting a response from a web service call.I need to take some values from this response and add it to another web service Soap request and do a web service call again. 我收到来自Web服务调用的响应。我需要从该响应中获取一些值,并将其添加到另一个Web服务Soap请求中,然后再次执行Web服务调用。 So in order to add the new value to the soap request I need to get it's complete soap requst xml.So that's why I was asking how to get soap request xml from wsdl.I cannot use SoapUI since it's dynamic everytime, so I need to write a java code. 因此,为了将新值添加到soap请求中,我需要获取完整的soap requst xml,所以这就是为什么我要问如何从wsdl获取soap请求xml。我不能使用SoapUI,因为它每次都是动态的,所以我需要编写一个Java代码。

I tried using something similar to below code: 我尝试使用类似于以下代码的内容:

WsdlProject project = new WsdlProject(); 
WsdlInterface[] wsdls = WsdlImporter.importWsdl(project, "<wsdl url>"); 
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)); 
} 

but I was getting exception 但我越来越例外

java.lang.NoClassDefFoundError: org/fife/ui/rtextarea/RTextArea" in line "WsdlProject project = new WsdlProject(); “ WsdlProject project = new WsdlProject();”行中的java.lang.NoClassDefFoundError:org / fife / ui / rtextarea / RTextArea”

I imported latest jars (soapui-xmlbeans-4.5.0,wsdl-xmlbeans-1.1,soapui-4.5.0) but still throwing exception. 我导入了最新的jar(soapui-xmlbeans-4.5.0,wsdl-xmlbeans-1.1,soapui-4.5.0),但仍然抛出异常。 Could anybody" http://www.soapui.org/repository/eviware/ " suggest how can I rectify it? 有人可以http://www.soapui.org/repository/eviware/提出如何纠正它的建议吗? Is there any other approach which I can take apart from this? 除此以外,还有别的方法吗?

Try downloading rsyntaxtextarea-1.0.jar from http://www.java2s.com/Code/Jar/r/Downloadrsyntaxtextarea10jar.htm add it to your Build Path. 尝试从http://www.java2s.com/Code/Jar/r/Downloadrsyntaxtextarea10jar.htm下载rsyntaxtextarea-1.0.jar,然后将其添加到构建路径中。 Hope it helps 希望能帮助到你

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM