简体   繁体   中英

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). 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. 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.

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();

I imported latest jars (soapui-xmlbeans-4.5.0,wsdl-xmlbeans-1.1,soapui-4.5.0) but still throwing exception. Could anybody" http://www.soapui.org/repository/eviware/ " suggest how can I rectify it? 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. Hope it helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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