Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Playframework 2 as SOAP server

I like Play 2.0 much (especially Scala API). But it lacks SOAP completely. Is there some not mindblowing way to provide SOAP WS (wsdl based) from Play 2.0?

Say, I'd want it to be accessible from some URL (e.g. /soap), preserving other pages to be HTML. Please, help, I have no clue (I'm java newb, and zillions of abbreviations for frameworks and libs make me confused).

PS To prevent possible unproductive treatments: I'm a java newb but not a newcomer programmer, so I know how SOAP, HTTP and other stuff are meant to work at protocol level.

like image 962
dmitry Avatar asked Jul 19 '12 09:07

dmitry


2 Answers

I ran into the same problem - Apache CXF and Axis2 depend on the Servlet API, which the Play Framework doesn't have.

I created a custom transport plugin for Apache CXF which connects to Play's Controller API. There is a tutorial about setting it all up in an empty project: http://www.imind.eu/web/2013/11/07/developing-soap-services-using-play-framework-2-2-x/

The plugin's source (and a sample Play application) is here: https://github.com/imindeu/play-cxf

like image 148
László Kustra Avatar answered Oct 15 '22 22:10

László Kustra


If you trying to create a web service API for existing business logic that will be part of your Play service, then you should probably look using existing Java libraries that can do the SOAP magic for you (e.g. Axis2). Scala can use existing Java libraries without any problem.

However, most people would strongly recommend you look at a REST service rather than a SOAP service, if this is an option. Have a look at Play Mini to see how this is done.

UPDATE:

Ah, this may help you: https://github.com/mandubian/scala-xmlsoap-ersatz

like image 4
Jack Avatar answered Oct 15 '22 20:10

Jack