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??
-
YOu;ve read the client docs at http://static.springsource.org/spring-ws/sites/1.5/reference/html/client.html, right? – skaffman May 13 '10 at 09:19
-
yes i have gone through but that doesnt answer my requirements – Hari Charan May 13 '10 at 11:27
-
that example doesnt contain WSDL URL at all. It was simple String message but my project contains WSDL with wrapper request objects – Hari Charan May 13 '10 at 11:28
2 Answers
I will recommend generating the request and response objects with JAXB from the provider's XSD schemas.
You don't need to generate the service classes with Spring WS since it uses a template class to communicate against the WS server. If you're familiar with Spring JDBC or Spring JMS, the template class behaves quite similar to the JMSTemplate
and JdbcTemplate
classes.
Actually, the Spring WS client doesn't need the WSDL document at all! In addition to XSD schemas, you only need to set the URI property on the WebServiceTemplate bean like this example does:
<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>
Here's a tutorial that might give you some answers.

- 10,545
- 5
- 33
- 39
See if this step by step tutorial on - Web Service Client with Spring-WS - is helpful - at http://justcompiled.blogspot.com/2010/11/web-service-client-with-spring-ws.html

- 277
- 3
- 14