0

I have a SOAP endpoint which processes XML requests by identifying the unmarshalled object and then using appropriate handlers. Now, I am trying to make a new endpoint and handler method which would handle the same request differently. From what I understand, Spring-Webservices (or SOAP for that matter) doesn't have a RESTful-kind of routing for requests.

Can I route a SOAP request through two different endpoints with a URL suffix or something in the API path (kind-of RESTful) ? The namespace, localpart, etc all being same. If not, is there a way ?

SO doesn't seem to have working answers on this topic, tried this: How can i have two separate web services with identical name space and local name requests be routed to different end points?

Multiple SOAP endpoints with one namespace & localpart

Any approach/ideas are appreciated.

  • If they are the same request, how would you know what to do? That will ofcourse not work as they need to be unique. – M. Deinum Jul 06 '21 at 08:46
  • @M.Deinum Actually, I want to differentiate at the URL path itself if possible, so that I can have two methods for two ways. (improved problem description in the post) – srinivasreddyramaram Jul 06 '21 at 09:05
  • The solution in your first linked answer should work. Or just deploy 2 `MessageDispatcherServlet` instances mapped to different base URLs (`/service1` and `/service2`) and each having a dedicated endpoint for what you want. – M. Deinum Jul 06 '21 at 09:27

2 Answers2

0

As far as I understood, you need to execute different business logic methods depending on the flag value. Well, the most straightforward approach is to use an if statement directly inside the endpoint. If you want to call different API (controllers) methods, you can take a look at Spring Functional Endpoints. Though I'm not sure they are integrated with SOAP

Semyon Kirekov
  • 1,237
  • 8
  • 20
0

The mentioned approaches in the question didn't work for me, so I used a mixed approach - made a RESTful api for the new endpoint with a different suffix in the url. I read the payload as a string and used marshallers to validate.