简体   繁体   English

为什么没有简单的方法来使用Java使用Web服务?

[英]Why is there no easy way to consume web services in Java?

I've been doing a lot of work exploring different methods to consume (.NET) web services in Java clients. 我一直在做很多工作,探索在Java客户端中使用不同方法(.NET)Web服务的方法。 It seems that this area is a black hole in Java. 在Java中,该区域似乎是一个黑洞。 The easiest way that I have found is to use Apache Axis2 wsdl2java to generate the source files. 我发现的最简单的方法是使用Apache Axis2 wsdl2java生成源文件。 But still, this requires some work to integrate Apache into my existing web applications. 但这仍然需要做一些工作才能将Apache集成到我现有的Web应用程序中。

I'm surprised that there is no easier way. 我很惊讶没有更简单的方法。 Why is that? 这是为什么?

Because there is. 因为有。 The required functionality for SOAP clients are included in the standard API library. SOAP客户端所需的功能包含在标准API库中。 You can use the wsimport tool (located in the bin directory of your JDK installation) to generate client classes from a specified WSDL. 您可以使用wsimport工具(位于JDK安装的bin目录中)从指定的WSDL生成客户机类。

I've not used metro , but it sounds like it integrates with JAXB2.0 well and might be worth taking a look at. 我没有使用Metro ,但是听起来它已经与JAXB2.0很好地集成了,可能值得一看。 I noticed a metro vs axis2 comparison which might be interesting if you are familiar with axis2 already. 我注意到Metro与axis2的比较 ,如果您已经熟悉axis2,这可能会很有趣。

for quick and dirty stuff the apache commons httpclient + jaxb works well. 对于快速而肮脏的东西,apache commons httpclient + jaxb效果很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM