Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!!

like image 465
user6543599 Avatar asked Dec 18 '16 11:12

user6543599


1 Answers

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?

like image 187
Sully Avatar answered Oct 16 '22 11:10

Sully