I created simple web service with Jersey that reads in an XML file and then creates some objects based on that xml. All I have is a single method that Consumes a Post as xml. I parse the xml and use values to create some business objects.
Recently we discovered that our clients only support SOAP.
Is there a way to easily write a wrapper of SOAP on top of this? (I saw Mule mentioned but have never used it)
Or would it be easier to start from scratch and rewrite in SOAP?
I’m completely new to SOAP and it looks much more complicated than my experience with Jersey. Thanks!
The simplest way is to expose a single method that takes the XML as a string, parses it and returns an XML document (again as a String).
You should be able to use that method in the Jersey service, if necessary by delegation to a separate class. Creating a SOAP service around a facade object like that should be easy with soap: http://axis.apache.org/axis/java/index.html
The technically superior solution is to decompose your XML into an object-oriented data transfer object or implement a SOAP service with e.g. document/literal messaging. The former may just add cost without value, depending on your situation. The latter may not even be supported by your partners. For a discussion of the SOAP messaging styles see:
http://msdn.microsoft.com/en-us/library/ms996466.aspx#rpc_literal_topic3