user6543599
user6543599

Reputation: 621

SOAP and REST webservice in single application

Is it possible to develop both SOAP and REST webservice in single application using spring boot or spring mvc. I have been looking for some example but not able to find.

For Example: myWebAddress is my application

  1. Passing XML request through SOAPUI to my application by hitting SOAP URL(http://ww.mywebaddress.com/soap)

  2. Passing request as parameter to same application by hitting REST URL(http://ww.mywebaddress.com/soap?parameter)

If possible, could you provide some simple example or link to any example.

Thanks in Advance!!

Upvotes: 8

Views: 13787

Answers (1)

Sully
Sully

Reputation: 14943

Yes, you can create two web service types for the same Spring web application, but you have to be careful with namespaces.

For SOAP, you will publish a WSDL and use an end point. The WSDL will be consumed and a client web service call will be generated on the calling side.

Check this example for soap

For RESTFUL, you will create a @RestController with a @RequestMapping.

Check this example for rest

Also, read:

Can I use SOAP Webservices and Spring MVC together

Both REST and SOAP Web Services for a single application

Can I use Spring MVC and Spring WS in one single application?

Upvotes: 9

Related Questions