dusk7
dusk7

Reputation: 139

Create SOAP service facade in Java

I have a java web application (with Servlets) which has several REST and SOAP based interfaces.

For SOAP interfaces, I have hard coded request XML which I post using Jersey HttpClient and extract data from response XML using StringUtils. I'm not using any special libraries in my application for these interfaces.

Now I have to create one new SOAP interface which uses Asynchronous messaging i.e. I have to give a callback URL where actual response will be sent. Problem is that this interface requires callback URL to implement some SOAP web-service based on some response WSDL given in interface documentation.

I don't want to implement SOAP server or add libraries for this. I simply want to create a servlet for callback URL which will receive response XML. Is there any way I can achieve this?

Upvotes: 0

Views: 827

Answers (1)

dusk7
dusk7

Reputation: 139

I created a servlet with one GET and POST methods mapped to the path of callback URL

GET method provides hardcoded WSDL required by client interface. Port address in this WSDL again points to the callback URL (handled by my servlet) where client interface posts response SOAP XML.

POST method receives response SOAP XML from client interface and parses it to get the result.

This way one servlet acts as SOAP service without adding any external libraries

Upvotes: 1

Related Questions