Using spring-ws with already existing WSDL
Asked Answered
E

2

8

I am new to spring-ws. what ever tutorial i see starts with xsd and at the end generates a wsdl. What is the approach when we have already an existing wsdl.

Also i was having a doubt on contract first approach which is already discussed (though am not getting convinced with the answer)

spring-ws and contract-first approach

My assignment is to use spring-ws with an existing wsdl. can you please provide me an approach for this.

As per my understanding. In the process of contract first approach, I got the contract already so how to proceed further is not shown in any tutorial.

Erlandson answered 31/8, 2016 at 9:35 Comment(2)
Further to add on this, I feel like spring-ws is only useful when we are exposing a service with our own WSDL. It doesn't seem to work with an 3rd party WSDL. Is this true?Erlandson
The WSDL is a technology agnostic contract for the service. That is imo a good starting point especially when different technology stacks are in use. Also makes it easy to test or stub the service from tools like soapUI.Sordello
E
0

Actually spring does support both static and dynamic wsdl. But each comes with different challenges. As from what i have seen, spring works on a notion of pattern matching when comes to generating a wsdl dynamically from a xsd. Like "Request" string which says input and "Response" means output. Now here is a problem where the spring generates a wsdl with synchronous responses. If our requirement is to have asynchronous response then the dynamic wsdl wont work.

To overcome this, we can use the static wsdl and let spring know not to generate wsdl dynamically.

Erlandson answered 21/10, 2019 at 7:7 Comment(0)
M
11

When developing a web service using Java you can use one of two approaches:

  • Contract-first: start with an WSDL that defines the web service operations and their input/output messages. Then generate the corresponding Java objects to implement the service.
  • Contract last: Start with the implementation of one or more methods in Java and generate the WSDL files based on these methods and the Java objects that they use.

Spring-WS, as you already mentioned, only supports the contract first approach. This means that you cannot develop a web service using Spring-WS without first having a WSDL or XSD that describes the input/output messages.

You should be able to create a service using Spring-WS using any valid WSDL file. For a concrete example let me point you to a blog post that I created that illustrates how you can develop a web service using Spring-WS starting from a WSDL file.

Monkfish answered 29/11, 2016 at 15:3 Comment(1)
This blog post is great, easy to follow and it works. However, when I deploy to a local tomcat or jetty instance I am getting a 404. Anyone else have this issue?Lucrecialucretia
E
0

Actually spring does support both static and dynamic wsdl. But each comes with different challenges. As from what i have seen, spring works on a notion of pattern matching when comes to generating a wsdl dynamically from a xsd. Like "Request" string which says input and "Response" means output. Now here is a problem where the spring generates a wsdl with synchronous responses. If our requirement is to have asynchronous response then the dynamic wsdl wont work.

To overcome this, we can use the static wsdl and let spring know not to generate wsdl dynamically.

Erlandson answered 21/10, 2019 at 7:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.