简体   繁体   English

有没有办法从 WSDL 生成 Java 中的 SOAP 服务器?

[英]Is there a way to generate a SOAP Server in Java from a WSDL?

I'm required to code a SOAP client for a customer, but I only have the WSDL and no access to their SOAP Server.我需要为客户编写 SOAP 客户端,但我只有 WSDL,无法访问他们的 SOAP 服务器。

I have successfully generated the SOAP client, but I would like to test it locally against a close approximation of their SOAP Server.我已经成功地生成了 SOAP 客户端,但我想在本地对其 SOAP 服务器进行近似测试。 So I want to generate a working SOAP Server framework from the supplied WSDL and modify it to supply some test data.所以我想从提供的 WSDL 生成一个工作的 SOAP 服务器框架,并对其进行修改以提供一些测试数据。

I've tried using Spring and Maven to generate the server code, but it doesn't seem to allow WSDLs - only XSD files.我尝试使用 Spring 和 Maven 生成服务器代码,但它似乎不允许 WSDL - 只有 XSD 文件。 And all attempts to call any SOAP service from my client fails with 404s.从我的客户端调用任何 SOAP 服务的所有尝试都以 404 失败。

Has anyone successfully generated a SOAP Server using WSDLs?有没有人使用 WSDL 成功生成了 SOAP 服务器? What are the gotcha's?什么是陷阱?

You can create skeleton code for the service implementation with something like wsdl2java .您可以使用类似wsdl2java的方式为服务实现创建框架代码。 For example, with Axis2 or CXF:例如,对于 Axis2 或 CXF:

I wouldn't bother though, since you can create a service mock with SoapUI starting from the same WSDL you would use to feed to wsdl2java .不过我不会打扰,因为您可以使用 SoapUI 从用于提供给wsdl2java的相同 WSDL 开始创建服务模拟。 For example:例如:

So start testing using SoapUI first, before going for a service implementation from the WSDL.所以首先开始使用 SoapUI 进行测试,然后再从 WSDL 进行服务实现。

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

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