Java Webservice Client (Best way)
I have a third party WSDL, I need to write code in JAVA for a web service client to invoke the operations in the third party WSDL. Right now, I have generated the client stub using the WSDL2JAVA tool from Axis and used the XMLbeans for data binding.
wsimport
in another option. What are the pros and cons? I used some of the basic things initially. Now I have these options
C:axis2-1.5.1bin>wsdl2java -uri mywsdlurl -o client -p somepackage -d xmlbeans -s -t -ssi
What is the best approach to do this JAVA?
I would personally NOT use Axis 2, even for client side development only. Here is why I stay away from it:
The only reason Axis is still around is IMO because it's used in Eclipse since ages. Thanks god, this has been fixed in Eclipse Helios and I hope Axis2 will finally die. There are just much better stacks.
I read about SAAJ, looks like that will be more granular level of approach?
To do what?
Is there any other way than using the WSDL2Java tool, to generate the code. Maybe wsimport in another option. What are the pros and cons?
Yes! Prefer a JAX-WS stack like CXF or JAX-WS RI (you might also read about Metro, Metro = JAX-WS RI + WSIT), they are just more elegant, simpler, easier to use. In your case, I would just use JAX-WS RI which is included in Java 6 and thus wsimport
.
Can someone send the links for some good tutorials on these topics?
That's another pro, there are plenty of (good quality) tutorials for JAX-WS, see for example:
What are the options we need to use while generating the code using the WSDL2Java?
No options, use wsimport
:)
See also
Related questions
I have had good success using Spring WS for the client end of a web service app - see http://static.springsource.org/spring-ws/sites/1.5/reference/html/client.html
My project uses a combination of:
XMLBeans (generated from a simple Maven job using the xmlbeans-maven-plugin)
Spring WS - using marshalSendAndReceive() reduces the code down to one line for sending and receiving
some Dozer - mapping the complex XMLBeans to simple beans for the client GUI
You can find some resources related to developing web services client using Apache axis2 here.
http://today.java.net/pub/a/today/2006/12/13/invoking-web-services-using-apache-axis2.html
Below posts gives good explanations about developing web services using Apache axis2.
http://www.ibm.com/developerworks/opensource/library/ws-webaxis1/
http://wso2.org/library/136
链接地址: http://www.djcxy.com/p/91870.html上一篇: 用于C ++的通用WebService(SOAP)客户端库
下一篇: Java Web服务客户端(最佳方式)