0

From a colleague I have received a WSDL file that describes the web service he is offering, and which I am supposed to call from my code. I would now like to do two things:

1) Implement the client

2) Have a stub server that I can use for testing, until I have access to the real server.

What I tried is the following:

wsimport -clientjar foo.jar foo.wsdl

This gives me a jar file that contains the Datatype that will contain the data to be posted to the web service, and also an ObjectFactory. I guess I will have to use it as follows:

 TestDataType testDataType = new TestDataType();
   testDataType.setFoo("foo");
   testDataType.setBar("bar"); 
   ObjectFactory objectFactory = new ObjectFactory();
   JAXBElement<TestDatatype> request = objectFactory.createTestRequest(testDatatype);

Now how do I send this request?

Also a class TestDemoService annotated with @WebServiceClient has been generated. How do I run this class?

Any advice is highly appreciated.

Anoop LL
  • 1,548
  • 2
  • 21
  • 32
user152468
  • 3,202
  • 6
  • 27
  • 57

1 Answers1

1

You've created the client. To use this client you need to set the endpoint(if not already set) and call the service using the generated api.

This site should be a good reference. Using wsimport

caburse
  • 156
  • 6