简体   繁体   中英

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.

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

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

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

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