org.apache.muse.core.proxy
Interface ProxyHandler

All Known Implementing Classes:
AbstractProxyHandler, ReflectionProxyHandler

public interface ProxyHandler

ProxyHandler defines the methods needed to serialize and deserialize the parameters an responses when making a remote web services invocation. The interface requires details about the target web service operation, all of which can be found in the service's WSDL. This information will allow the handler to construct appropriate SOAP messages after serializing request parameters.

This interface is used for sending outgoing messages on the client-side. Receiving web service requests is handled by MessageHandler.

Author:
Dan Jemiolo (danj)

Method Summary
 Object fromXML(Element xml)
          Deserializes the given DOM Element into a POJO that can be returned to the invoker of the web service operation.
 String getAction()
           
 QName getRequestName()
           
 QName[] getRequestParameterNames()
           
 QName[] getRequestParameterSchemaTypes()
           
 Class[] getRequestParameterTypes()
           
 QName getResponseName()
           
 QName getReturnSchemaType()
           
 Class getReturnType()
           
 void setAction(String action)
           
 void setRequestName(QName requestName)
           
 void setRequestParameterNames(QName[] parameterNames)
           
 void setRequestParameterSchemaTypes(QName[] parameterTypes)
          This is an optional method.
 void setRequestParameterTypes(Class[] parameterTypes)
          This is an optional method.
 void setResponseName(QName responseName)
           
 void setReturnSchemaType(QName returnType)
           
 void setReturnType(Class returnType)
           
 Element toXML(Object[] parameters)
          Serializes the given objects into a DOM Element that can used in a request SOAP Body.
 

Method Detail

fromXML

Object fromXML(Element xml)
               throws SoapFault
Deserializes the given DOM Element into a POJO that can be returned to the invoker of the web service operation. Implementations should use Muse's registered Serializers in order to deserialize the XML into objects of the proper types.

Parameters:
xml - The contents of the response SOAP Body, where the root element contains either a simple value or a single child element that defines a complex type. Multiple return values will not be parsed - they must be part of a single data structure.
Returns:
The return value from the operation. This object will have the same type as getReturnType().
Throws:
SoapFault -
  • If the name of the element does not match the value of getResponseName().
  • If no serialization mechanism exists for the return value type.
  • If the XML could not be deserialized into an object.
See Also:
getReturnType(), Serializer.fromXML(Element)

getAction

String getAction()
Returns:
The WS-Addressing Action URI for the target operation.

getRequestName

QName getRequestName()
Returns:
The QName of the SOAP request element that deserializable DOM Elements will be wrapped in.

getRequestParameterNames

QName[] getRequestParameterNames()
Returns:
The QNames for the individual parameters in the SOAP request message, in the order they are defined by the target operation. These are defined in the type (schema) definition of the WSDL input message.

If the operation takes no parameters (void), or if it takes one simple parameter that is wrapped in the root request element (i.e., WS-RP GetResourceProperty), then this method returns an empty array.

getRequestParameterSchemaTypes

QName[] getRequestParameterSchemaTypes()
Returns:
The XSD types that define the operation's parameters. This is an optional method, and if the type data is not provided, the returned array will be empty.

getRequestParameterTypes

Class[] getRequestParameterTypes()
Returns:
The Java types that are expected by the serialization framework for each of the operation's parameters. This is an optional method, and if the type data is not provided, the returned array will be empty.

getResponseName

QName getResponseName()
Returns:
The QName of the SOAP response element that deserializable DOM Elements will be wrapped in.

getReturnSchemaType

QName getReturnSchemaType()
Returns:
The XSD type that defines the response value; if the operation has no response value, this method returns null.

getReturnType

Class getReturnType()
Returns:
The type to which the response value should be deserialized. If the operation has no response value, this method returns Void.TYPE (not null).

setAction

void setAction(String action)
Parameters:
action - The WS-Addressing Action URI for the target operation. This cannot be null.

setRequestName

void setRequestName(QName requestName)
Parameters:
requestName - The QName of the SOAP request element that deserializable DOM Elements will be wrapped in.

setRequestParameterNames

void setRequestParameterNames(QName[] parameterNames)
Parameters:
parameterNames - The QNames for the individual parameters in the SOAP request message, in the order they are defined by the target operation. These are defined in the type (schema) definition of the WSDL input message. This array cannot be null, but it can be empty.

setRequestParameterSchemaTypes

void setRequestParameterSchemaTypes(QName[] parameterTypes)
This is an optional method. If the type data is not provided, getRequestParameterSchema Types() will simply return an empty array.

Parameters:
parameterTypes - The XSD types that define the operation's parameters.

setRequestParameterTypes

void setRequestParameterTypes(Class[] parameterTypes)
This is an optional method. If the type data is not provided, getRequestParameterTypes() will simply return an empty array.

Parameters:
parameterTypes - The Java types that are expected by the serialization framework for each of the operation's parameters.

setResponseName

void setResponseName(QName responseName)
Parameters:
responseName - The QName of the SOAP response element that deserializable DOM Elements will be wrapped in.

setReturnSchemaType

void setReturnSchemaType(QName returnType)
Parameters:
returnType - The XSD type that defines the response value. If the operation has no response value, the parameter should be null (as opposed to xsd:any).

setReturnType

void setReturnType(Class returnType)
Parameters:
returnType - The type to which the response value should be deserialized. If the operation has no response value, the parameter can be null or Void.TYPE (null will be translated as Void.TYPE).

toXML

Element toXML(Object[] parameters)
              throws SoapFault
Serializes the given objects into a DOM Element that can used in a request SOAP Body. Implementations should use Muse's registered Serializers in order to serialize the objects into the proper formats.

Parameters:
parameters - The parameters for the operation, which must be serialized into XML.
Returns:
The XML equivalent of the given objects, wrapped in an element whose QName is the value of getRequestName(). Each object's XML fragment will be wrapped in the equivalent QName from the array returned by getRequestParameterNames().
Throws:
SoapFault -
  • If no serialization mechanism exists for an object's type.
  • If an object could not be serialized into XML.
See Also:
getRequestName(), getRequestParameterNames(), Serializer.toXML(Object, QName)


Copyright © 2005-2011 Apache Web Services - Muse. All Rights Reserved.