public abstract class Operation extends OperationCommons
events) the main parts of a service implementation.
The actual business logic behind an operation is contained within the invoke(ParameterValue) method. Operation subclasses are required to overwrite it
providing the code to be executed when this operation is called.
Before adding an operation to a service, the types of its input and output parameters must be defined in terms of XML
Schema constructs like elements, simple types and complex typess. A simple operation with no input and a single string message as its
only output parameter could look like:
Operation myOperation = new Operation() {
public ParameterValue invoke(ParameterValue params)
throws InvocationException, TimeotException {
// business logic goes here
...
}
};
Element message = new Element("message",
"http://www.example.org/messageService", SchemaUtil.TYPE_STRING);
myOperation.setOutput(message);
Additionally, if an operation's invocation can cause expected (checked) exceptional conditions
(errors), they must be declared as faults. Note:
According to WSDL 1.1 Specification, an operation's
name is not required to be unique within the scope of its containing port type
in order to support overloading. However, when overloading operations, the combination of each
one's name, input name and output name must be unique in order to avoid name clashes.
inputAttributable, outputAttributable, typeattributes| Modifier | Constructor and Description |
|---|---|
|
Operation()
Creates a new operation instance without specified name.
|
|
Operation(java.lang.String name)
Creates a new operation instance with the given
name. |
|
Operation(java.lang.String name,
QName portType)
Creates a new operation instance with the given local
name and portType
. |
|
Operation(java.lang.String name,
java.lang.String serviceName)
Creates a new operation instance with the given
name and the name of the specified
service. |
protected |
Operation(WSDLOperation operation) |
| Modifier and Type | Method and Description |
|---|---|
int |
getType()
Returns the
transmission type of this operation according to WSDL 1.1 specification. |
ParameterValue |
invoke(ParameterValue parameterValue)
Deprecated.
|
ParameterValue |
invoke(ParameterValue parameterValue,
CredentialInfo credentialInfo)
Method for invoke this Operation.
|
protected abstract ParameterValue |
invokeImpl(ParameterValue parameterValue,
CredentialInfo credentialInfo)
This method must be overwritten from User.
|
boolean |
isOneWay()
Returns
true if the transmission type of this operation is WSDLOperation.TYPE_ONE_WAY. |
boolean |
isRequestResponse()
Returns
true if the transmission type of this operation is WSDLOperation.TYPE_REQUEST_RESPONSE. |
addCustomComplexType, addFault, addInputParameter, addOutputParameter, clearCustomComplexTypes, createFaultValue, createFaultValue, createInputValue, createInputValue, createOutputValue, createOutputValue, equals, getCustomComplexTypes, getFault, getFaultAttribute, getFaultAttributes, getFaultCount, getFaults, getInput, getInputAction, getInputAttribute, getInputAttributes, getInputName, getInputParameter, getName, getNameQuallified, getOutput, getOutputAction, getOutputAttribute, getOutputAttributes, getOutputName, getOutputParameter, getPortType, getService, hasFaultAttributes, hashCode, hasInputAttributes, hasOutputAttributes, isInputActionSet, isInputNameSet, isOutputActionSet, isOutputNameSet, removeCustomComplexType, removeFault, setFaultAttribute, setFaultAttributes, setInput, setInputAction, setInputAttribute, setInputAttributes, setInputName, setInputNameInternal, setOutput, setOutputAction, setOutputAttribute, setOutputAttributes, setOutputName, setOutputNameInternal, setService, toStringgetAttribute, getAttributes, hasAttributes, serializeAttributes, setAttribute, setAttribute, setAttributespublic Operation(java.lang.String name,
QName portType)
name and portType
.name - the name of the operation; see here for a short description of uniqueness
requirements regarding operation namesportType - the qualified port type of the operationpublic Operation()
public Operation(java.lang.String name)
name.name - public Operation(java.lang.String name,
java.lang.String serviceName)
name and the name of the specified
service. Namespace default is "http://www.ws4d.or" can be set once in the DefaultDevice
(setDefaultNamespace). There is also the possibility to set the namespace for every operation.name - protected Operation(WSDLOperation operation)
public final int getType()
transmission type of this operation according to WSDL 1.1 specification. The value returned is one of
WSDLOperation.TYPE_ONE_WAY or WSDLOperation.TYPE_REQUEST_RESPONSE.getType in interface OperationDescriptiongetType in class OperationCommonspublic final boolean isOneWay()
true if the transmission type of this operation is WSDLOperation.TYPE_ONE_WAY. Returns false in any other case.one-way operationpublic final boolean isRequestResponse()
true if the transmission type of this operation is WSDLOperation.TYPE_REQUEST_RESPONSE. Returns false in any other case.request-response operationpublic final ParameterValue invoke(ParameterValue parameterValue) throws InvocationException, CommunicationException
invoke(ParameterValue, CredentialInfo).parameterValue - InvocationExceptionCommunicationExceptionpublic final ParameterValue invoke(ParameterValue parameterValue, CredentialInfo credentialInfo) throws InvocationException, CommunicationException, AuthorizationException
ParameterValue and CredentialInfo. If no security
will be used, use CredentialInfo.EMPTY_CREDENTIAL_INFO instead of null.parameterValue - for invoke.credentialInfo - if security is available.InvocationExceptionCommunicationExceptionAuthorizationExceptionprotected abstract ParameterValue invokeImpl(ParameterValue parameterValue, CredentialInfo credentialInfo) throws InvocationException, CommunicationException
parameterValue - credentialInfo - InvocationExceptionCommunicationException