public class WebServiceHelper extends ServerHelper
This class allows connections only to SOAP 1.1 services, to conform with Progress runtime.
Rules describing the validation of the web-service connect options and validation of the WSDL file:
-Service
or -Port
is specified, then -Binding
and
-SOAPEndpoint
must not be specified (and viceversa).-Binding
is specified, then -SOAPEndpoint
must be specified.
-TargetNamespace
is specified, it must match the one at the WSDL document.
-Service
is specified, then:
-Port
is specified, then the port must be matched with one specified at
the service in the WSDL document and it must have an associated SOAP 1.1. binding.-Port
is specified, then there must exist only one SOAP 1.1.
(port, binding)
pair at the service configuration.-Binding
is specified, then:
-Binding
or -Service
is specified, then:
The CONNECT_OPTION_MAX_CONNECTIONS
, CONNECT_OPTION_CONNECTION_LIFETIME
,
CONNECT_OPTION_NO_SESSION_REUSE
and CONNECT_OPTION_NO_HOST_VERIFY
options are
not yet implemented by connect(java.util.Map<java.lang.String, java.lang.String>)
.
TODO: implementation for these options will not be trivial. There probably will be needed changes to AXIS2 core to allow persistent connections and to validate the SSL Host and reuse the SSL Session. Host's SSL certificate validation may be done separately (by establishing a connection just to make sure the target host is known), but SSL Session reuse is linked to AXIS2 code.
Modifier and Type | Field and Description |
---|---|
(package private) static java.lang.String |
CONNECT_OPTION_BINDING
Constant identifying the '-Binding' connect option.
|
(package private) static java.lang.String |
CONNECT_OPTION_BINDING_NAMESPACE
Constant identifying the '-BindingNamespace' connect option.
|
(package private) static java.lang.String |
CONNECT_OPTION_CONNECTION_LIFETIME
Constant identifying the '-connectionLifetime' connect option.
|
(package private) static java.lang.String |
CONNECT_OPTION_MAX_CONNECTIONS
Constant identifying the '-maxConnections' connect option.
|
(package private) static java.lang.String |
CONNECT_OPTION_NO_HOST_VERIFY
Constant identifying the '-nohostverify' connect option.
|
(package private) static java.lang.String |
CONNECT_OPTION_NO_SESSION_REUSE
Constant identifying the '-nosessionreuse' connect option.
|
(package private) static java.lang.String |
CONNECT_OPTION_PF
Constant identifying the '-pf' connect option.
|
(package private) static java.lang.String |
CONNECT_OPTION_PORT
Constant identifying the '-Port' connect option.
|
(package private) static java.lang.String |
CONNECT_OPTION_SERVICE
Constant identifying the '-Service' connect option.
|
(package private) static java.lang.String |
CONNECT_OPTION_SERVICE_NAMESPACE
Constant identifying the '-ServiceNamespace' connect option.
|
(package private) static java.lang.String |
CONNECT_OPTION_SOAP_ENDPOINT
Constant identifying the '-SOAPEndpoint' connect option.
|
(package private) static java.lang.String |
CONNECT_OPTION_SOAP_ENDPOINT_PASSWORD
Constant identifying the '-SOAPEndpointPassword' connect option.
|
(package private) static java.lang.String |
CONNECT_OPTION_SOAP_ENDPOINT_USER
Constant identifying the '-SOAPEndpointUserid' connect option.
|
(package private) static java.lang.String |
CONNECT_OPTION_TARGET_NAMESPACE
Constant identifying the '-TargetNamespace' connect option.
|
(package private) static java.lang.String |
CONNECT_OPTION_WSDL
Constant identifying the '-WSDL' connect option.
|
(package private) static java.lang.String |
CONNECT_OPTION_WSDL_PASSWORD
Constant identifying the '-WSDLPassword' connect option.
|
(package private) static java.lang.String |
CONNECT_OPTION_WSDL_USERID
Constant identifying the '-WSDLUserid' connect option.
|
private static java.util.Set<java.lang.String> |
knownConnectOptions
The set of web-service connect options used by the legacy CONNECT method.
|
private static ContextLocal<WebService> |
localService
The context-local data of this class.
|
private static java.util.logging.Logger |
LOG
Logger
|
private int |
nextAsyncReqId
The counter for async requests.
|
private java.lang.String |
soapEndpoint
The target SOAP endpoint to which requests are sent.
|
private int |
webServiceId
The client side context id for the web service associated with this helper.
|
server
Modifier | Constructor and Description |
---|---|
private |
WebServiceHelper(int webServiceId,
java.lang.String soapEndpoint)
Instantiate a new helper.
|
Modifier and Type | Method and Description |
---|---|
(package private) static WebServiceHelper |
connect(java.util.Map<java.lang.String,java.lang.String> opts)
Do a first level validation of parameters and send them to client to establish a new
web-service connection using the connect options in the given map.
|
void |
disconnect()
Disconnect this server.
|
java.lang.String |
getConnectionID()
Get the connection ID of this web service connection.
|
(package private) static java.util.Set<java.lang.String> |
getKnownConnectOptions()
Get the set of known options for web-service connections.
|
java.lang.String |
getServerName()
Get the name of this server.
|
java.lang.String |
getSubType()
Get the sub-type of this web service connection.
|
(package private) BaseDataType |
invoke(long timeout,
AsyncRequestImpl asyncReq,
character name,
handle h,
boolean function,
boolean dynamicFunction,
boolean superCall,
boolean transactionDistinct,
java.lang.String modes,
java.lang.Object... args)
Invoke a web service operation.
|
private character |
invokeRequestHeaderCallback(PortTypeWrapper portProc,
java.lang.String opName,
java.lang.String opNamespace)
Invoke the request-header callback, if it was set for the specified procedure.
|
private boolean |
invokeResponseHeaderCallback(PortTypeWrapper portProc,
handle soapHeader,
java.lang.String opName,
java.lang.String opNamespace)
Invoke the response-header callback, if it was set for the specified procedure.
|
boolean |
isConnected()
This implementation always returns true, as the connection to remote side is not permanent.
|
boolean |
isSessionFree()
Check if this is a session-free connection.
|
boolean |
isWebService()
Check if this is a web service.
|
PersistentProcedure |
runPort(character name)
Run the port type with the given name, only if the name matches (case-insensitively) with
the
target port type determined during connection. |
void |
sendStop()
Send a STOP condition to the request currently being executed on this connection.
|
void |
sendStop(int requestId)
Send a STOP condition to the specified async request.
|
private void |
showCallbackError(boolean request,
ControlFlowOps.ArgValidationErrors err,
java.lang.String procedure)
Show a callback error for a failed callback validation.
|
getServer, setServer
private static final java.util.logging.Logger LOG
static final java.lang.String CONNECT_OPTION_WSDL
static final java.lang.String CONNECT_OPTION_WSDL_USERID
static final java.lang.String CONNECT_OPTION_WSDL_PASSWORD
static final java.lang.String CONNECT_OPTION_SERVICE
static final java.lang.String CONNECT_OPTION_SERVICE_NAMESPACE
static final java.lang.String CONNECT_OPTION_PORT
static final java.lang.String CONNECT_OPTION_BINDING
static final java.lang.String CONNECT_OPTION_BINDING_NAMESPACE
static final java.lang.String CONNECT_OPTION_SOAP_ENDPOINT
static final java.lang.String CONNECT_OPTION_SOAP_ENDPOINT_USER
static final java.lang.String CONNECT_OPTION_SOAP_ENDPOINT_PASSWORD
static final java.lang.String CONNECT_OPTION_TARGET_NAMESPACE
static final java.lang.String CONNECT_OPTION_MAX_CONNECTIONS
static final java.lang.String CONNECT_OPTION_CONNECTION_LIFETIME
static final java.lang.String CONNECT_OPTION_NO_SESSION_REUSE
static final java.lang.String CONNECT_OPTION_NO_HOST_VERIFY
static final java.lang.String CONNECT_OPTION_PF
private static final java.util.Set<java.lang.String> knownConnectOptions
private final java.lang.String soapEndpoint
private static final ContextLocal<WebService> localService
private int nextAsyncReqId
private int webServiceId
private WebServiceHelper(int webServiceId, java.lang.String soapEndpoint)
webServiceId
- The client side id of WebService implementation.soapEndpoint
- The target SOAP endpoint to which requests are sent.static WebServiceHelper connect(java.util.Map<java.lang.String,java.lang.String> opts)
opts
- A map with the connect options.WebServiceHelper
instance or null
if no connection
was possible. Check the ErrorManager
for details about any errors.static java.util.Set<java.lang.String> getKnownConnectOptions()
public PersistentProcedure runPort(character name)
target port type
determined during connection.name
- The port type name.PortTypeWrapper
instance associated with the port type or null
if the port type name does not match.public java.lang.String getSubType()
getSubType
in class ServerHelper
WEBSERVICE
string.public java.lang.String getConnectionID()
getConnectionID
in class ServerHelper
soapEndpoint
.public boolean isWebService()
isWebService
in class ServerHelper
true
.public boolean isSessionFree()
isSessionFree
in class ServerHelper
true
for web service connections.public java.lang.String getServerName()
getServerName
in class ServerHelper
soapEndpoint
.public void disconnect()
This is a no-op for web-services.
disconnect
in class ServerHelper
public boolean isConnected()
isConnected
in class ServerHelper
true
.public void sendStop(int requestId)
sendStop
in class ServerHelper
requestId
- The request where to send a STOP condition.public void sendStop()
sendStop
in class ServerHelper
java.lang.IllegalStateException
- If the appserver is not connected.BaseDataType invoke(long timeout, AsyncRequestImpl asyncReq, character name, handle h, boolean function, boolean dynamicFunction, boolean superCall, boolean transactionDistinct, java.lang.String modes, java.lang.Object... args)
invoke
in class ServerHelper
timeout
- The maximum allowed time for this invocation to complete. In milliseconds.
Use 0
to disable the timeout.asyncReq
- When not-null, an AsyncRequestImpl
instance for the associated async
request.name
- The name for the web service operation.h
- The port-type procedure in which to invoke the web service operation. May not
be null
.function
- true
if this is a function call.dynamicFunction
- true
if this is a DYNAMIC-FUNCTION call.superCall
- true
if this is a RUN SUPER or SUPER() call.transactionDistinct
- Flag indicating if the TRANSACTION DISTINCT clause is in effect.modes
- A string representation of the modes of each parameter. May not be null
.args
- The procedure's arguments.null
if the
invocation could not be performed.java.lang.IllegalArgumentException
- If this is a super call, the argument modes are not specified or the passed
procedure handle is null
or not a PortTypeWrapper
procedure.private boolean invokeResponseHeaderCallback(PortTypeWrapper portProc, handle soapHeader, java.lang.String opName, java.lang.String opNamespace)
This will also validate the response-header callback and the associated context procedure.
portProc
- The port-type procedure
.soapHeader
- A handle pointing to the SOAPHeader
resource.opName
- The name of operation to be invoked.opNamespace
- The namespace of operation to be invoked.true
if the callback was invoked and no error condition was raised.private character invokeRequestHeaderCallback(PortTypeWrapper portProc, java.lang.String opName, java.lang.String opNamespace)
This will also validate the request-header callback and the associated context procedure.
portProc
- The port-type procedure
.opName
- The name of operation to be invoked.opNamespace
- The namespace of operation to be invoked.character
instance if nothing is needed to be invoked,
null
in case of any raised error conditions or the request-header
XML payload serialized as text, in case of success.private void showCallbackError(boolean request, ControlFlowOps.ArgValidationErrors err, java.lang.String procedure)
request
- When true
, the request-header callback is invoked.err
- The validation errors for this callback. null
specifies the callback
procedure was not found in the specified context.procedure
- The procedure name for this callback.