0

I have following WSDL URL :

https://www.deanumber.com/Websvc/deaWebsvc.asmx?wsdl

There are many WSDL operations as you can see when you hit the URL. But , I just want to run GetQuery operation and get the response (GetQueryResponse in the WSDL ).

I am able to successfully test this in SoapUI. The response is coming properly. I want to do the same in my existing web project (Java) in Eclipse.

As per How do you convert wsdl to java classes using Eclipse? , I used Eclipse to auto-generate the WSDL client code from the URL and 20+ Java files got created in my web project including GetQuery.java and GetQueryResponse.java. I know how to instantiate GetQuery.java , but do not know how to get the response. Is there any standard way to call the already generated client code?

Satej Koli
  • 79
  • 2
  • 15

1 Answers1

0

You can find a good HelloWorld example for a soap client generated using wsimport tool in the following link.

Using wsimport command to generate web service client

Sample code quoted from the given link above

    public class HelloWorldClient {

    public static void main(String[] args) {

        HelloWorldServerImplService service = new HelloWorldServerImplService();

        HelloWorldServer server = service.getHelloWorldServerImplPort();

        System.out.println(server.sayHello("Satej"));

    }
}

Where HelloWorldServerImplService and HelloWorldServer are auto-generated java files from a given WSDL using wsimport tool

Salman
  • 1,236
  • 5
  • 30
  • 59
  • Thanks @Salman . wsimport is not working for me. I have already got the Java source generated from my side. But , not able to figure out how to call it. Can you please try with below WSDL URL ?https://www.deanumber.com/Websvc/deaWebsvc.asmx?wsdl – Satej Koli Oct 03 '17 at 12:35
  • I analyzed their java files extensively and was able to write some code to submit the request. The response is also coming as I can see the values in debug mode. Now , I just need to identify the nodes and get the required values. Your example did not help me directly , but yes it forced me to think more and I was able to find a solution. Thanks a lot :) – Satej Koli Oct 03 '17 at 14:03
  • @SatejKoli Most likely you will have a response object that has its own getter methods for all available nodes. If not then you need to parse the incoming XML string response and get the nodes values you require. Here is an example to do so [How to read XML file in Java](https://www.mkyong.com/java/how-to-read-xml-file-in-java-dom-parser/) – Salman Oct 04 '17 at 11:25