nien
nien

Reputation: 1

How to use "web service client" in java

I wanna create a web service client to send some XML data to other web service. Google for the solution for a while but can’t find the correct answer. Now I suffered problem is how to import the WSDL file or ws-addressing to the workspace (if necessary)?

  1. When I used eclipse built-in method to create a web service client it will automatically create some source code (Tomcat v7.0 Apache Axis2). How to use it to connect to other service and should I fallow the XML schema? Here is the example below http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.jst.ws.cxf.doc.user%2Ftasks%2Fcreate_client.html

  2. When I used some source code that I search from internet. The code looks like create a XML by itself. How to I follow the XML schema according to this code? Here is the example below Working Soap client example

Hopefully someone may give me some clues or more detail information.

Upvotes: 0

Views: 1311

Answers (2)

Amar
Amar

Reputation: 971

If you are comfortable using Spring and Maven , find below link which might be useful :

https://spring.io/guides/gs/consuming-web-service/

Upvotes: 0

gdupont
gdupont

Reputation: 1678

Try to use Jaxb & jax-ws which enable to generate and client stub from your WSDL and all XSD dependencies (if reachable). You will have java beans for all objects that will be passed in arguments (ie Jaxb will handle the XML conversion).

you can also refer to this thread: Web service client given WSDL

Upvotes: 1

Related Questions