Hi Im a newbie to Spring WebServices. I would like to go through a standard example wherein the WSDL is provided as input from Provider. Now how will the client code for this WSDL looks like. Do we need to generate a stub code at client side??
问问题
25283 次
2 回答
9
我建议使用 JAXB 从提供者的 XSD 模式生成请求和响应对象。
您不需要使用 Spring WS 生成服务类,因为它使用模板类与 WS 服务器进行通信。如果您熟悉 Spring JDBC 或 Spring JMS,那么模板类的行为与JMSTemplate
和JdbcTemplate
类非常相似。
实际上,Spring WS 客户端根本不需要 WSDL 文档!除了 XSD 模式之外,您只需要像以下示例一样在 WebServiceTemplate bean 上设置 URI 属性:
<bean id="webServiceTemplate"
class="org.springframework.ws.client.core.WebServiceTemplate">
<property name="marshaller" ref="marshaller" />
<property name="unmarshaller" ref="marshaller" />
<property name="defaultUri"
value="http://localhost:8081/ws-demo/account-balance-service" />
</bean>
这是一个教程,可能会给你一些答案。
于 2010-05-30T14:36:50.940 回答
3
在http://justcompiled.blogspot.com/2010/11/web-service-client-with-spring-ws.html上查看此分步教程 - 使用 Spring-WS 的 Web 服务客户端 - 是否有帮助
于 2010-11-07T20:02:51.127 回答