We have support for the processing of XML headers or body elements through the use of the XStream library. XStream is idea when you have a bunch of POJOs and you want to stream them over XML.
If you are given a WSDL and want to create beans for it, we recommend a tool like XMLBeans, Castor or JAXB. However if you're starting with POJOs then XStream is nice & simple & fast.
The client API is pretty much the same as for the other marshalling tools. First off we have a regular interface that represents some service...
{snippet:id=example|lang=java|url=http://cvs.activesoap.codehaus.org/viewrep/~raw,r=HEAD/activesoap/src/test/org/codehaus/activesoap/examples/snowboard2/SnowboardService.java} |
Now here's a REST client invoking a remote service..
{snippet:id=restClient|lang=java|url=http://cvs.activesoap.codehaus.org/viewrep/~raw,r=HEAD/activesoap/src/test/org/codehaus/activesoap/examples/snowboard2/SnowboardTest.java} |
Or the SOAP client looks like this
{snippet:id=soapClient|lang=java|url=http://cvs.activesoap.codehaus.org/viewrep/~raw,r=HEAD/activesoap/src/test/org/codehaus/activesoap/examples/snowboard2/SnowboardTest.java} |
The following example demonstrates how to bind the server side implementation of a service to the some transport ready for being dispatched.
Here's a REST service example
{snippet:id=restServer|lang=java|url=http://cvs.activesoap.codehaus.org/viewrep/~raw,r=HEAD/activesoap/src/test/org/codehaus/activesoap/examples/snowboard2/SnowboardTest.java} |
Here's a SOAP service example
{snippet:id=soapServer|lang=java|url=http://cvs.activesoap.codehaus.org/viewrep/~raw,r=HEAD/activesoap/src/test/org/codehaus/activesoap/examples/snowboard2/SnowboardTest.java} |
You can avoid using service interfaces and dynamic proxies and just pass typed document POJOs around using the dynamic interface.
Here's a REST client example
{snippet:id=restDClient|lang=java|url=http://cvs.activesoap.codehaus.org/viewrep/~raw,r=HEAD/activesoap/src/test/org/codehaus/activesoap/examples/snowboard2/SnowboardTest.java} |
Here's a SOAP client example
{snippet:id=soapDClient|lang=java|url=http://cvs.activesoap.codehaus.org/viewrep/~raw,r=HEAD/activesoap/src/test/org/codehaus/activesoap/examples/snowboard2/SnowboardTest.java} |