第 3 方已向我提供了 Web 服务方法的定义,我已经创建了 java 类,maven schemagen 插件从这些类中出色地生成了 xsd。然后我设置了一个 spring-ws-servlet 等来发布 wsdl,只有 WSDL11Definition 类需要请求和响应后缀....我没有后缀。方法名称是 getAttribute、setAttribute、refreshDetails、manageAttribute 等。有人知道解决这个问题的方法吗?是否有其他可以引用的 wsdl 定义类来执行此操作,或者是否有其他提供程序(而不是 defaultWsdl11Definition 使用的 suffixProviders)?
任何帮助将不胜感激!
最佳答案
Spring-WS 是围绕 "schema first" design 设计的,而不是“代码优先”:
When creating Web services, there are two development styles: Contract Last and Contract First. When using a contract-last approach, you start with the Java code, and let the Web service contract (WSDL, see sidebar) be generated from that. When using contract-first, you start with the WSDL contract, and use Java to implement said contract.
Spring-WS only supports the contract-first development style, and this section explains why.
您可以以“代码优先”的方式使其工作,但您将面临一场战斗。
如果您想坚持使用 Spring-WS,那么我强烈建议您使用 Web 服务规范编写描述操作的 XML 模式,然后从该模式生成 java,或者手动编写 java。
关于java - 如何在 Spring 中生成没有默认请求/响应后缀的 wsdl?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3227985/