Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

Here is an example of an interface to a service. Note that the interface is optional, you can expose a class as a service - we've just used an interface in this example as its good practice and makes the example easier to follow.

An error occurred: cvs.activesoap.codehaus.org. The system administrator has been notified.

There's a method on this interface which accepts an XMLBeans type. We can have as many methods as we like all auto-published, the only requirement is that when using the XMLBeansRegistery, the parameter must be an XMLBeans type, so that when we register it we can auto-deduce the QName which matches the correct method on the service.

Then if we register an implementation of this interface with the XMLBeansRegistry we can automatically publish the service as both REST and SOAP endpoints...

An error occurred: cvs.activesoap.codehaus.org. The system administrator has been notified.

Exposing services over HTTP

The following example demonstrates how to make a service available over HTTP using the SOAP protocl (1.2 is the default)

An error occurred: cvs.activesoap.codehaus.org. The system administrator has been notified.

Here is the same service exposed as a pure REST service

An error occurred: cvs.activesoap.codehaus.org. The system administrator has been notified.

Client interface

As well as implementing web services, its also useful to be able to invoke them easily in a document centric way.

The following example demonstates how to invoke a web service using an XMLBeans interface for a WSDL endpoint.

An error occurred: cvs.activesoap.codehaus.org. The system administrator has been notified.

Here's the same thing again for a service exposed via pure REST

An error occurred: cvs.activesoap.codehaus.org. The system administrator has been notified.

Dynamic interface

Instead of having a concrete interface for a WSDL endpoint, we can use the dynamic interface to pass in/out any arbitrary XML blob over REST or SOAP.

So here is a dynamic web service invocation using XMLBeans as the body and result of the documents. Note that XmlObject instances could be used in this example, there's no real need to have a concrete, autogenerated schema when using this mechanism (other than performance).

An error occurred: cvs.activesoap.codehaus.org. The system administrator has been notified.

Here's the same example again using a REST client

An error occurred: cvs.activesoap.codehaus.org. The system administrator has been notified.

The API for the dynamic invocation API currently works with XMLBeans but should ultimately work with JAX-RPC, JAXB, Castor, XStream etc.

  • No labels