org.jibx.ws.server
Class ServiceDefinition

java.lang.Object
  extended by org.jibx.ws.server.ServiceDefinition

public final class ServiceDefinition
extends Object

Defines a service to be invoked by JiBX/WS.

After setting the required properties on this class, the init() method must be called to initialize this class.

When using JiBX to configure the service, this class is populated from the XML service definition document by JiBX unmarshalling and the init() method is automatically called after the properties have been set.


Constructor Summary
ServiceDefinition()
           
 
Method Summary
 List getHandlerDefinitions()
          Get handler definitions.
 IBindingFactory getInBodyBindingFactory()
          Returns the optional JiBX binding factory used for the request message bodies received by operations.
 boolean getIncludeStackTraceOnFault()
          Returns whether a stack trace should be included when a SOAP fault is created as the result of an unhandled error.
 List getOperationDefinitions()
          Get operation definitions.
 IBindingFactory getOutBodyBindingFactory()
          Returns the optional JiBX binding factory used for the response message bodies sent by operations.
 Class getOutputCompletionListenerClass()
          Get outputCompletionListenerClass.
 org.jibx.ws.transport.OutputCompletionListener getOutputCompletionListenerObject()
          Get outputCompletionListenerObject.
 String getProtocolName()
          Get the name of protocol to use for this service.
 Class getServiceClass()
          Get service class information.
 Class getServiceExceptionHandlerClass()
          Get fault handler class information.
 org.jibx.ws.server.ServiceExceptionHandler getServiceExceptionHandlerObject()
          Get fault handler object.
 String getServiceName()
          Get service name.
 Object getServiceObject()
          Get service object.
 XmlOptions getXmlOptions()
          Returns the formatting options for outbound XML.
 void init()
          This method must be called after all properties have been set.
 void setBindingFactory(IBindingFactory factory)
          Sets the optional JiBX binding factory used for the body of the request and response messages exchanged by operations.
 void setHandlerDefinitions(List hdefs)
          Sets the definitions of the handlers for the service.
 void setInBodyBindingFactory(IBindingFactory factory)
          Sets the optional JiBX binding factory used for the request message bodies received by operations.
 void setIncludeStackTraceOnFault(boolean includeStackTraceOnFault)
          Sets whether a stack trace should be included when a SOAP fault is created as the result of an unhandled error.
 void setIndentCount(int indentCount)
          Sets the number of spaces to indent output XML.
 void setOperationDefinitions(List opdefs)
          Sets the operations to be made available for the service.
 void setOutBodyBindingFactory(IBindingFactory factory)
          Sets the optional JiBX binding factory used for the response message bodies sent by operations.
 void setOutputCompletionListener(org.jibx.ws.transport.OutputCompletionListener listener)
          Sets the object to be notified of the completion of output.
 void setOutputCompletionListenerClassName(String outputCompletionListenerClassName)
          Sets the fully qualified name of class to be notified of the completion of output.
 void setProtocolName(String name)
          Set name of protocol to use for service.
 void setServiceClassName(String serviceClassName)
          Sets the fully qualified name of class used to process requests for this service.
 void setServiceExceptionHandlerClassName(String serviceExceptionHandlerClassName)
          Sets the fully qualified name of class used for handling faults.
 void setServiceExceptionHandlerObject(org.jibx.ws.server.ServiceExceptionHandler serviceExceptionHandler)
          Sets the object to be used for handling exceptions in processing the message or executing the service method.
 void setServiceName(String serviceName)
          Sets the optional name to be used for this service.
 void setServiceObject(Object serviceObject)
          Sets the object to be used for processing requests for this service.
 void setTransportOptionsDefinitions(List definitions)
          Sets the definition of options that are specific to a particular transport.
 void setWsdlFilepath(String wsdlFilepath)
          Sets the path to an existing WSDL file.
 void setWsdlLocationTransform(boolean transform)
          Sets whether WSDL locations should be transformed using the location of the WSDL request.
 void setXmlOptions(XmlOptions options)
          Sets the options for formatting of the outbound XML message for the service.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceDefinition

public ServiceDefinition()
Method Detail

init

public void init()
          throws WsConfigurationException
This method must be called after all properties have been set. This fills in any names not supplied by the binding and initializes the contained definition objects (eg. handler definitions).

Throws:
WsConfigurationException - on configuration error

setProtocolName

public void setProtocolName(String name)
Set name of protocol to use for service.

Parameters:
name - protocol name

getProtocolName

public String getProtocolName()
Get the name of protocol to use for this service.

Returns:
protocol name

setIndentCount

public void setIndentCount(int indentCount)
Sets the number of spaces to indent output XML. The default is to suppress all indentation and generate XML with no added spaces or line breaks. Alternatively, for more control over output format, use setXmlOptions(XmlOptions).

Parameters:
indentCount - number of spaces to use

setXmlOptions

public void setXmlOptions(XmlOptions options)
Sets the options for formatting of the outbound XML message for the service.

Parameters:
options - message options

getXmlOptions

public XmlOptions getXmlOptions()
Returns the formatting options for outbound XML. If no options have been set, this will create default options.

Returns:
XML formatting options

setServiceName

public void setServiceName(String serviceName)
Sets the optional name to be used for this service. If not supplied, a name is generated by appending "Service" to the base name.

Parameters:
serviceName - the service name

getServiceName

public String getServiceName()
Get service name.

Returns:
service name

getServiceObject

public Object getServiceObject()
Get service object.

Returns:
service object

setServiceObject

public void setServiceObject(Object serviceObject)
Sets the object to be used for processing requests for this service. The object will potentially be used by multiple service instances, so the methods that implement the service operations must be thread safe. Alternatively, if using the Spring Framework, the object can use a scoped proxy to create new object instances for the desired object scope.

Either this method or setServiceClassName(String) must be called.

Parameters:
serviceObject - the service service object

setServiceClassName

public void setServiceClassName(String serviceClassName)
Sets the fully qualified name of class used to process requests for this service. All operations defined for the service must be implemented by methods of this class. A separate instance of the specified class will be constructed for each service instance, unless all of the operations use static methods, in which case only a single instance of the specified class will be constructed.

Either this method or setServiceObject(Object) must be called.

Parameters:
serviceClassName - the full name of the service class

getServiceClass

public Class getServiceClass()
                      throws WsConfigurationException
Get service class information.

Returns:
service class information
Throws:
WsConfigurationException - if service class unavailable

getServiceExceptionHandlerObject

public org.jibx.ws.server.ServiceExceptionHandler getServiceExceptionHandlerObject()
Get fault handler object.

Returns:
fault handler object

setServiceExceptionHandlerObject

public void setServiceExceptionHandlerObject(org.jibx.ws.server.ServiceExceptionHandler serviceExceptionHandler)
Sets the object to be used for handling exceptions in processing the message or executing the service method. The object will potentially be used by multiple service instances, so the methods must be thread safe. Alternatively, if using the Spring Framework, the object can use a scoped proxy to create new object instances for the desired object scope.

Either this method or setServiceExceptionHandlerClassName(String) must be called.

Parameters:
serviceExceptionHandler - the service exception handler object

setServiceExceptionHandlerClassName

public void setServiceExceptionHandlerClassName(String serviceExceptionHandlerClassName)
                                         throws WsConfigurationException
Sets the fully qualified name of class used for handling faults. A separate instance of the specified class will be constructed for each service instance.

Either this method or setServiceExceptionHandlerObject(ServiceExceptionHandler) must be called.

Parameters:
serviceExceptionHandlerClassName - the full name of the fault handler class
Throws:
WsConfigurationException - if fault handler class unavailable

getServiceExceptionHandlerClass

public Class getServiceExceptionHandlerClass()
Get fault handler class information.

Returns:
fault handler class information

setBindingFactory

public void setBindingFactory(IBindingFactory factory)
Sets the optional JiBX binding factory used for the body of the request and response messages exchanged by operations. For finer-grain control, call either or both of setInBodyBindingFactory(IBindingFactory) and setOutBodyBindingFactory(IBindingFactory).

If no binding factory is specified, JiBX/WS assumes that there is a single binding factory that includes bindings for all of the possible request and response message bodies, and will look up this factory based on the class of one of the request or response message bodies.

Parameters:
factory - the binding factory to use for all request and response message bodies

setInBodyBindingFactory

public void setInBodyBindingFactory(IBindingFactory factory)
Sets the optional JiBX binding factory used for the request message bodies received by operations.

Parameters:
factory - the binding factory to use for all request message bodies

getInBodyBindingFactory

public IBindingFactory getInBodyBindingFactory()
Returns the optional JiBX binding factory used for the request message bodies received by operations.

Returns:
the binding factory to use for all request message bodies

setOutBodyBindingFactory

public void setOutBodyBindingFactory(IBindingFactory factory)
Sets the optional JiBX binding factory used for the response message bodies sent by operations.

Parameters:
factory - the binding factory to use for all response message bodies

getOutBodyBindingFactory

public IBindingFactory getOutBodyBindingFactory()
Returns the optional JiBX binding factory used for the response message bodies sent by operations.

Returns:
the binding factory to use for all response message bodies

setHandlerDefinitions

public void setHandlerDefinitions(List hdefs)
Sets the definitions of the handlers for the service.

Parameters:
hdefs - a list of HandlerDefinition

getHandlerDefinitions

public List getHandlerDefinitions()
Get handler definitions.

Returns:
list of HandlerDefinitions

setOperationDefinitions

public void setOperationDefinitions(List opdefs)
Sets the operations to be made available for the service. Each operation uses an associated method within the service class specified by the setServiceClassName(String) or setServiceObject(Object) methods.

With the doc/lit style of web services supported by JiBX/WS the input message element name always determines the particular operation to be performed. JiBX/WS actually finds the input message element name corresponding to each operation by doing a reverse lookup of the methods in the service class. Since only one type of object can be associated with an element, there's a fixed linkage between the element name and the object type. This means that the type of the input parameter used for each operation method within a service must be unique.

Parameters:
opdefs - a list of OperationDefinition

getOperationDefinitions

public List getOperationDefinitions()
Get operation definitions.

Returns:
list of OperationDefinitions

setIncludeStackTraceOnFault

public void setIncludeStackTraceOnFault(boolean includeStackTraceOnFault)
Sets whether a stack trace should be included when a SOAP fault is created as the result of an unhandled error.

Parameters:
includeStackTraceOnFault - set to true if a stack trace should be created, false otherwise.

getIncludeStackTraceOnFault

public boolean getIncludeStackTraceOnFault()
Returns whether a stack trace should be included when a SOAP fault is created as the result of an unhandled error.

Returns:
true if a stack trace should be created, false otherwise.

setOutputCompletionListenerClassName

public void setOutputCompletionListenerClassName(String outputCompletionListenerClassName)
                                          throws WsConfigurationException
Sets the fully qualified name of class to be notified of the completion of output. A separate instance of the specified class will be constructed for each service instance.

Parameters:
outputCompletionListenerClassName - the full name of the listener class
Throws:
WsConfigurationException - if listener class unavailable
See Also:
setOutputCompletionListener(OutputCompletionListener)

setOutputCompletionListener

public void setOutputCompletionListener(org.jibx.ws.transport.OutputCompletionListener listener)
Sets the object to be notified of the completion of output.

Parameters:
listener - the listener object to be notified
See Also:
setOutputCompletionListenerClassName(String)

getOutputCompletionListenerObject

public org.jibx.ws.transport.OutputCompletionListener getOutputCompletionListenerObject()
Get outputCompletionListenerObject.

Returns:
outputCompletionListenerObject

getOutputCompletionListenerClass

public Class getOutputCompletionListenerClass()
Get outputCompletionListenerClass.

Returns:
outputCompletionListenerClass

setTransportOptionsDefinitions

public void setTransportOptionsDefinitions(List definitions)
Sets the definition of options that are specific to a particular transport. At most one definition may be supplied for each transport.

Parameters:
definitions - list of TransportOptionsDefinition. The list must contain no more than one TransportOptionsDefinition object for each TransportOptionsDefinition class.
Throws:
IllegalArgumentException - if a duplicate transport options definition is found

setWsdlFilepath

public void setWsdlFilepath(String wsdlFilepath)
Sets the path to an existing WSDL file.

Parameters:
wsdlFilepath - path to WSDL file

setWsdlLocationTransform

public void setWsdlLocationTransform(boolean transform)
Sets whether WSDL locations should be transformed using the location of the WSDL request.

Parameters:
transform - set to true if a location should be transformed, false otherwise.


Project Web Site