Spring Web Services Framework

org.springframework.ws.server.endpoint.adapter
Class MarshallingMethodEndpointAdapter

java.lang.Object
  extended by org.springframework.xml.transform.TransformerObjectSupport
      extended by org.springframework.ws.server.endpoint.adapter.AbstractMethodEndpointAdapter
          extended by org.springframework.ws.server.endpoint.adapter.MarshallingMethodEndpointAdapter
All Implemented Interfaces:
InitializingBean, EndpointAdapter
Direct Known Subclasses:
GenericMarshallingMethodEndpointAdapter

public class MarshallingMethodEndpointAdapter
extends AbstractMethodEndpointAdapter
implements InitializingBean

Adapter that supports endpoint methods that use marshalling. Supports methods with the following signature:

 void handleMyMessage(MyUnmarshalledType request);
 
or
 MyMarshalledType handleMyMessage(MyUnmarshalledType request);
 
I.e. methods that take a single parameter that is supported by the Unmarshaller, and return either void or a type supported by the Marshaller. The method can have any name, as long as it is mapped by an EndpointMapping.

This endpoint needs a Marshaller and Unmarshaller, both of which can be set using properties.

Since:
1.0.0
Author:
Arjen Poutsma
See Also:
setMarshaller(org.springframework.oxm.Marshaller), setUnmarshaller(org.springframework.oxm.Unmarshaller)

Field Summary
 
Fields inherited from class org.springframework.ws.server.endpoint.adapter.AbstractMethodEndpointAdapter
logger
 
Constructor Summary
MarshallingMethodEndpointAdapter()
          Creates a new MarshallingMethodEndpointAdapter.
MarshallingMethodEndpointAdapter(Marshaller marshaller)
          Creates a new MarshallingMethodEndpointAdapter with the given marshaller.
MarshallingMethodEndpointAdapter(Marshaller marshaller, Unmarshaller unmarshaller)
          Creates a new MarshallingMethodEndpointAdapter with the given marshaller and unmarshaller.
 
Method Summary
 void afterPropertiesSet()
           
 Marshaller getMarshaller()
          Returns the marshaller used for transforming objects into XML.
 Unmarshaller getUnmarshaller()
          Returns the unmarshaller used for transforming XML into objects.
protected  void invokeInternal(MessageContext messageContext, MethodEndpoint methodEndpoint)
          Use the given method endpoint to handle the request.
 void setMarshaller(Marshaller marshaller)
          Sets the marshaller used for transforming objects into XML.
 void setUnmarshaller(Unmarshaller unmarshaller)
          Sets the unmarshaller used for transforming XML into objects.
protected  boolean supportsInternal(MethodEndpoint methodEndpoint)
          Supports a method with a single, unmarshallable parameter, and that return void or a marshallable type.
 
Methods inherited from class org.springframework.ws.server.endpoint.adapter.AbstractMethodEndpointAdapter
invoke, supports
 
Methods inherited from class org.springframework.xml.transform.TransformerObjectSupport
createTransformer, getTransformerFactory, newTransformerFactory, setTransformerFactoryClass, transform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MarshallingMethodEndpointAdapter

public MarshallingMethodEndpointAdapter()
Creates a new MarshallingMethodEndpointAdapter. The Marshaller and Unmarshaller must be injected using properties.

See Also:
setMarshaller(org.springframework.oxm.Marshaller), setUnmarshaller(org.springframework.oxm.Unmarshaller)

MarshallingMethodEndpointAdapter

public MarshallingMethodEndpointAdapter(Marshaller marshaller)
Creates a new MarshallingMethodEndpointAdapter with the given marshaller. If the given Marshaller also implements the Unmarshaller interface, it is used for both marshalling and unmarshalling. Otherwise, an exception is thrown.

Note that all Marshaller implementations in Spring-WS also implement the Unmarshaller interface, so that you can safely use this constructor.

Parameters:
marshaller - object used as marshaller and unmarshaller
Throws:
IllegalArgumentException - when marshaller does not implement the Unmarshaller interface

MarshallingMethodEndpointAdapter

public MarshallingMethodEndpointAdapter(Marshaller marshaller,
                                        Unmarshaller unmarshaller)
Creates a new MarshallingMethodEndpointAdapter with the given marshaller and unmarshaller.

Parameters:
marshaller - the marshaller to use
unmarshaller - the unmarshaller to use
Method Detail

getMarshaller

public Marshaller getMarshaller()
Returns the marshaller used for transforming objects into XML.


setMarshaller

public final void setMarshaller(Marshaller marshaller)
Sets the marshaller used for transforming objects into XML.


getUnmarshaller

public Unmarshaller getUnmarshaller()
Returns the unmarshaller used for transforming XML into objects.


setUnmarshaller

public final void setUnmarshaller(Unmarshaller unmarshaller)
Sets the unmarshaller used for transforming XML into objects.


afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

invokeInternal

protected void invokeInternal(MessageContext messageContext,
                              MethodEndpoint methodEndpoint)
                       throws Exception
Description copied from class: AbstractMethodEndpointAdapter
Use the given method endpoint to handle the request.

Specified by:
invokeInternal in class AbstractMethodEndpointAdapter
Parameters:
messageContext - the current message context
methodEndpoint - the method endpoint to use
Throws:
Exception - in case of errors

supportsInternal

protected boolean supportsInternal(MethodEndpoint methodEndpoint)
Supports a method with a single, unmarshallable parameter, and that return void or a marshallable type.

Specified by:
supportsInternal in class AbstractMethodEndpointAdapter
Parameters:
methodEndpoint - method endpoint to check
Returns:
whether or not this adapter can adapt the given method
See Also:
Marshaller.supports(Class), Unmarshaller.supports(Class)

Spring Web Services Framework

Copyright © 2005-2010 The Spring Web Services Framework. All Rights Reserved.