public class WSBrowser extends BaseBrowser
Modifier and Type | Class and Description |
---|---|
static class |
WSBrowser.SchemaMapHolder
Holder for a SchemaMap, allows invoked methods to change the SchemaMap reference.
|
Constructor and Description |
---|
WSBrowser(WSConnection<BrowseContext> conn) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
doEnhanceSoapArrayTypes(WebServiceOperation op)
Returns
true if the schemas for the given operation should have any soap encoded array types "enhanced". |
protected boolean |
doWrapRpcOperation(WebServiceOperation op)
Returns
true if the given operation should be wrapped with a synthetic element (often useful for RPC
style calls with multiple paramters), false otherwise. |
static String |
generateCookie(WebServiceOperation wsOperation)
Converts the given WebServiceOperation into a "cookie" for embedding within an ObjectDefinition (to be returned
during subsequent operation invocations).
|
WSConnection<BrowseContext> |
getConnection()
Returns the base connection that was either provided or created when this instance was created.
|
protected String |
getEnvelopeOperationRequestElementName(WebServiceBindingOperation bindingOp,
WebServiceProtocol soapProtocol,
com.boomi.webservices.SchemaMap schemaDocMap)
Returns the name of the request element for the given operation.
|
protected String |
getEnvelopeOperationResponseElementName(WebServiceBindingOperation bindingOp,
WebServiceProtocol soapProtocol,
WSBrowser.SchemaMapHolder schemaDocMapH)
Returns the name of the response element for the given operation.
|
protected ObjectDefinitions |
getExecuteObjectDefinitions(String objectTypeId,
Collection<ObjectDefinitionRole> roles)
Returns an ObjectDefinitions instance for an EXECUTE operation.
|
protected ObjectTypes |
getExecuteObjectTypes()
Returns an ObjectTypes instance for an EXECUTE operation created by getting the list of operations available in
the webservice wsdl (via a call to
getOperations() ) and converting them to ObjectType instances with
labels created by getOperationLabel(java.lang.String) . |
protected WebServiceOperation |
getExecuteWebServiceOperation(javax.wsdl.Definition wsdl,
String objectTypeId,
com.boomi.webservices.SchemaMap schemaDocMap,
com.boomi.webservices.ProtocolHandler protocolHandler)
Returns the WebServiceOperation for the given object type id (typically an operation name).
|
ObjectDefinitions |
getObjectDefinitions(String objectTypeId,
Collection<ObjectDefinitionRole> roles)
Returns the object definitions for the given object type id and currently configured OperationType (as defined by
the BrowseContext).
|
protected ObjectDefinitions |
getObjectDefinitions(WebServiceOperation op,
Collection<ObjectDefinitionRole> roles,
com.boomi.webservices.SchemaMap schemaDocMap)
Returns an ObjectDefinitions instance for the given operation.
|
protected String |
getObjectTypeId()
Returns the current object type id, as provided in a call to
getObjectDefinitions(java.lang.String, java.util.Collection<com.boomi.connector.api.ObjectDefinitionRole>) . |
ObjectTypes |
getObjectTypes()
Returns the object types which can be utilized by the currently configured OperationType (as defined by the
BrowseContext).
|
protected String |
getOperationLabel(String operationName)
Returns the operation "display name" for the given operation name.
|
protected String |
getOperationRequestElementName(WebServiceBindingOperation bindingOp,
com.boomi.webservices.SchemaMap schemaDocMap)
Returns the name of the request element for the given operation.
|
protected String |
getOperationResponseElementName(WebServiceBindingOperation bindingOp,
WSBrowser.SchemaMapHolder schemaDocMapH)
Returns the name of the response element for the given operation, may be
null if there is no response
type. |
protected List<String> |
getOperations()
Returns the list of webservice operations which should be returned to the caller as the available ObjectTypes.
|
protected ObjectDefinitions |
getOtherObjectDefinitions(String objectTypeId,
Collection<ObjectDefinitionRole> roles)
Returns an ObjectDefinitions instance for any non-EXECUTE operation.
|
protected ObjectTypes |
getOtherObjectTypes()
Returns an ObjectTypes instance for any non-EXECUTE operation.
|
protected com.boomi.webservices.ProtocolHandler |
getProtocolHandler(javax.wsdl.Definition wsdl)
Returns the currently chosen ProtocolHandler, optionally using the given wsdl definition to determine the
appropriate version.
|
protected String |
getRpcOperationRequestElementName(WebServiceBindingOperation bindingOp,
com.boomi.webservices.SchemaMap schemaDocMap)
Returns the name of the request element for the given operation.
|
protected String |
getRpcOperationResponseElementName(WebServiceBindingOperation bindingOp,
WSBrowser.SchemaMapHolder schemaDocMapH)
Returns the name of the response element for the given operation.
|
static WebServiceOperation |
parseCookie(String cookie)
Returns a WebServiceOperation parsed from a cookie generated by
generateCookie(com.boomi.model.connector.common.webservices.WebServiceOperation) . |
protected void |
setObjectTypeId(String newObjectTypeId)
Sets the current object type id.
|
protected void |
setProtocolHandler(com.boomi.webservices.ProtocolHandler protocolHandler)
Sets the current ProtocolHandler.
|
protected static String |
setRootElement(com.boomi.webservices.SchemaMap schemaDocMap,
QName elQName)
Sets the root schema of the given schemaDocMap to the namespaceURI of the given QName and returns the localName
of the given QName.
|
protected static String |
setRootElement(WSBrowser.SchemaMapHolder schemaDocMapH,
QName elQName)
Sets the root schema of the given schemaDocMapHolder to the namespaceURI of the given QName (using
WSBrowser.SchemaMapHolder.setRootSchema(java.lang.String) ) and returns the localName of the given QName. |
protected ObjectDefinition |
toObjectDefinition(com.boomi.webservices.SchemaMap schemaDocMap)
Returns an ObjectDefinition containing the given schemas.
|
protected boolean |
useEnvelopeForOperation(WebServiceOperation op)
Returns
true if the given webservice operation should expose the entire SOAP operation as the request
type (as opposed to the content of the body). |
protected boolean |
useResponseEnvelopeForOperation(WebServiceOperation op)
Returns
true if the given webservice operation should expose the entire SOAP operation as the response
type (as opposed to the content of the body). |
protected boolean |
useRpcOptionalParameters(WebServiceOperation op)
Returns
true if the given webservice operation will allow optional parameters for RPC style operations. |
getContext
public WSBrowser(WSConnection<BrowseContext> conn)
protected com.boomi.webservices.ProtocolHandler getProtocolHandler(javax.wsdl.Definition wsdl)
protected void setProtocolHandler(com.boomi.webservices.ProtocolHandler protocolHandler)
public WSConnection<BrowseContext> getConnection()
BaseBrowser
getConnection
in class BaseBrowser
protected String getObjectTypeId()
getObjectDefinitions(java.lang.String, java.util.Collection<com.boomi.connector.api.ObjectDefinitionRole>)
.protected void setObjectTypeId(String newObjectTypeId)
getObjectDefinitions(java.lang.String, java.util.Collection<com.boomi.connector.api.ObjectDefinitionRole>)
before
any other code is called/executed..public ObjectTypes getObjectTypes()
WSBrowser implementation returns the result of a call to getExecuteObjectTypes()
for an operation type of
EXECUTE and getOtherObjectTypes()
for any other operation type.
AtomConfig.getMaxNumberObjectTypes()
)protected ObjectTypes getExecuteObjectTypes()
getOperations()
) and converting them to ObjectType instances with
labels created by getOperationLabel(java.lang.String)
.protected ObjectTypes getOtherObjectTypes()
public ObjectDefinitions getObjectDefinitions(String objectTypeId, Collection<ObjectDefinitionRole> roles)
The returned collection of definitions must correspond to the given collection of roles (the definitions must be
in the same order as the roles). There must be a definition for each
"required"
role for a given OperationType. There may be a
definition for any "supported"
role for a given OperationType.
Note, the DELETE operation is handled uniquely. By default, this method is not invoked for DELETE operations. However, if the connector has specified an "sdkApiVersion" of "1.0.15" or greater in the connector config file, this method will be invoked. In this situation, the connector implementation may set a cookie for the INPUT definition, but any schema will be ignored. Also, the connector implementation may return an OUTPUT definition.
WSBrowser implementation returns the result of a call to getExecuteObjectDefinitions(java.lang.String, java.util.Collection<com.boomi.connector.api.ObjectDefinitionRole>)
for an operation
type of EXECUTE and getOtherObjectDefinitions(java.lang.String, java.util.Collection<com.boomi.connector.api.ObjectDefinitionRole>)
for any other operation type. Note, a call to
setObjectTypeId(java.lang.String)
is made before any other methods are called.
objectTypeId
- the id of the relevant object type chosen from the list returned from a previous call to
Browser.getObjectTypes()
roles
- the roles corresponding to the profiles requestedprotected ObjectDefinitions getExecuteObjectDefinitions(String objectTypeId, Collection<ObjectDefinitionRole> roles)
WSDLUtil.loadSchemas(javax.wsdl.Definition)
) from the current webservice wsdl (WSCache.getDefinition()
), and the relevant
operation information is determined (via getExecuteWebServiceOperation(javax.wsdl.Definition, java.lang.String, com.boomi.webservices.SchemaMap, com.boomi.webservices.ProtocolHandler)
). The bulk of the work, then, is
delegated to getObjectDefinitions(WebServiceOperation,Collection,SchemaMap)
.protected ObjectDefinitions getOtherObjectDefinitions(String objectTypeId, Collection<ObjectDefinitionRole> roles)
protected ObjectDefinitions getObjectDefinitions(WebServiceOperation op, Collection<ObjectDefinitionRole> roles, com.boomi.webservices.SchemaMap schemaDocMap) throws com.boomi.webservices.SchemaModelException
useEnvelopeForOperation(com.boomi.model.connector.common.webservices.WebServiceOperation)
is called to determine if the entire SOAP envelope should be included as request
type (constructed via getEnvelopeOperationRequestElementName(com.boomi.model.connector.common.webservices.WebServiceBindingOperation, com.boomi.model.connector.common.webservices.WebServiceProtocol, com.boomi.webservices.SchemaMap)
). If not, then doWrapRpcOperation(com.boomi.model.connector.common.webservices.WebServiceOperation)
is called to determine if a synthetic type should be generated which wraps all the parameters to an RPC style
request. If not, then the default behaviour is to determine the request element name by calling
getOperationRequestElementName(com.boomi.model.connector.common.webservices.WebServiceBindingOperation, com.boomi.webservices.SchemaMap)
. For the envelope and default scenarios, the response element name is
determined by calling getOperationResponseElementName(com.boomi.model.connector.common.webservices.WebServiceBindingOperation, com.boomi.connector.ws.WSBrowser.SchemaMapHolder)
, and for RPC style requests the response element
name is determined by calling getRpcOperationResponseElementName(com.boomi.model.connector.common.webservices.WebServiceBindingOperation, com.boomi.connector.ws.WSBrowser.SchemaMapHolder)
. (Note, an operation may choose to not
define a response type by returning a null
value for the response element name.) Once the relevant type
names have been determine, the ObjectDefinitions is finally constructed by inserting the relevant schemas (by
calling toObjectDefinition(com.boomi.webservices.SchemaMap)
), setting the relevant type names, and generating a cookie containing the
relevant WebServiceOperation (via generateCookie(com.boomi.model.connector.common.webservices.WebServiceOperation)
). (Note, no schemas are required for the response type
definition if they are the same schemas as the request type definition).com.boomi.webservices.SchemaModelException
protected boolean useResponseEnvelopeForOperation(WebServiceOperation op)
true
if the given webservice operation should expose the entire SOAP operation as the response
type (as opposed to the content of the body). Called by getExecuteObjectDefinitions(java.lang.String, java.util.Collection<com.boomi.connector.api.ObjectDefinitionRole>)
.
Default implementation returns false
.
Subclasses may wish to override this if a webservice requires custom envelope elements which are not handled by the connector implementation (although this should only be a last resort as it is highly inconvenient to the connector user).
op
- the current webservice operationprotected List<String> getOperations()
getExecuteObjectTypes()
.
Default implementation returns all operations from the wsdl sorted by name.
Subclasses may wish to override this implementation to remove certain operations or otherwise narrow down the returned list of operations.
protected String getOperationLabel(String operationName)
getExecuteObjectTypes()
.
Default implementation returns the given operationName.
Subclasses may wish to override this to provide "friendlier" display names to the user (e.g. convert
"Some_Operation"
to "Some Operation"
).
operationName
- the operation name as given in the wsdlprotected boolean useEnvelopeForOperation(WebServiceOperation op)
true
if the given webservice operation should expose the entire SOAP operation as the request
type (as opposed to the content of the body). Called by getExecuteObjectDefinitions(java.lang.String, java.util.Collection<com.boomi.connector.api.ObjectDefinitionRole>)
.
Default implementation returns false
.
Subclasses may wish to override this if a webservice requires custom envelope elements which are not handled by the connector implementation (although this should only be a last resort as it is highly inconvenient to the connector user).
op
- the current webservice operationprotected boolean doWrapRpcOperation(WebServiceOperation op)
true
if the given operation should be wrapped with a synthetic element (often useful for RPC
style calls with multiple paramters), false
otherwise. Called by getExecuteObjectDefinitions(java.lang.String, java.util.Collection<com.boomi.connector.api.ObjectDefinitionRole>)
.
Default implementation returns true
if the given operation has an RPC binding style.
Subclasses may override this if they wish to handle RPC operations differently.
op
- the current webservice operationprotected boolean doEnhanceSoapArrayTypes(WebServiceOperation op)
true
if the schemas for the given operation should have any soap encoded array types "enhanced".
"Enhancing" involves generating more specific type definitions for the array types (via
WSDLUtil.enhanceSoapArrayTypes(com.boomi.webservices.SchemaMap, java.util.Map<java.lang.String, java.lang.String>)
). This is generally a good thing as it makes the resulting types much more
useable.
Default implementation returns true
.
Subclasses may override this if they wish to handle soap encoded array types differently.
protected boolean useRpcOptionalParameters(WebServiceOperation op)
true
if the given webservice operation will allow optional parameters for RPC style operations.
Not applicable when useEnvelopeForOperation is true. Called by getExecuteObjectDefinitions(java.lang.String, java.util.Collection<com.boomi.connector.api.ObjectDefinitionRole>)
.
Default implementation returns true
.
Subclasses may wish to override this if a webservice wants to allow rpc parameters to be optional based on elements sent in the request XML document
op
- the current webservice operationprotected WebServiceOperation getExecuteWebServiceOperation(javax.wsdl.Definition wsdl, String objectTypeId, com.boomi.webservices.SchemaMap schemaDocMap, com.boomi.webservices.ProtocolHandler protocolHandler)
getExecuteObjectDefinitions(java.lang.String, java.util.Collection<com.boomi.connector.api.ObjectDefinitionRole>)
.
Default implementation returns WSDLUtil.getWSOperation(Definition,String,ProtocolHandler)
for the given
object type id.
Subclasses using customized object type ids may override this to change how the type id is linked to the operation name. Alternately, extra operations may be include in the WebServiceOperation information (e.g. for paging results).
wsdl
- the current web service wsdlobjectTypeId
- the object type id chose by the user from the browsed ObjectTypesschemaDocMap
- the currently defined schemas for the wsdlprotocolHandler
- the current ProtocolHandlerprotected String getOperationRequestElementName(WebServiceBindingOperation bindingOp, com.boomi.webservices.SchemaMap schemaDocMap) throws com.boomi.webservices.SchemaModelException
getExecuteWebServiceOperation(javax.wsdl.Definition, java.lang.String, com.boomi.webservices.SchemaMap, com.boomi.webservices.ProtocolHandler)
.
Default implementation returns the element name of the input body parameter or input message for the given binding operation (which ever is defined).
Subclasses may wish to override this method to do custom type massaging for the webservice.
bindingOp
- the current binding operationschemaDocMap
- the currently defined schemascom.boomi.webservices.SchemaModelException
protected String getOperationResponseElementName(WebServiceBindingOperation bindingOp, WSBrowser.SchemaMapHolder schemaDocMapH) throws com.boomi.webservices.SchemaModelException
null
if there is no response
type. The returned element name must exist in the root schema of the given schemaDocMap. Called by
getExecuteWebServiceOperation(javax.wsdl.Definition, java.lang.String, com.boomi.webservices.SchemaMap, com.boomi.webservices.ProtocolHandler)
.
Default implementation returns the element name of the output body parameter or output message for the given binding operation (which ever is defined).
Subclasses may wish to override this method to do custom type massaging for the webservice.
bindingOp
- the current binding operationschemaDocMapH
- the currently defined schemasnull
if nonecom.boomi.webservices.SchemaModelException
protected String getRpcOperationRequestElementName(WebServiceBindingOperation bindingOp, com.boomi.webservices.SchemaMap schemaDocMap) throws com.boomi.webservices.SchemaModelException
getExecuteWebServiceOperation(javax.wsdl.Definition, java.lang.String, com.boomi.webservices.SchemaMap, com.boomi.webservices.ProtocolHandler)
for RPC style operations.
Default implementation adds a wrapper for the RPC request parameters using
WSDLUtil.addRequestWrapperForRpcOperation(com.boomi.webservices.SchemaMap, com.boomi.model.connector.common.webservices.WebServiceBindingOperation)
, returning the result of this method call.
Subclasses may wish to override this method to do custom type massaging for the webservice.
bindingOp
- the current binding operationschemaDocMap
- the currently defined schemascom.boomi.webservices.SchemaModelException
protected String getRpcOperationResponseElementName(WebServiceBindingOperation bindingOp, WSBrowser.SchemaMapHolder schemaDocMapH) throws com.boomi.webservices.SchemaModelException
getExecuteWebServiceOperation(javax.wsdl.Definition, java.lang.String, com.boomi.webservices.SchemaMap, com.boomi.webservices.ProtocolHandler)
for RPC style operations.
Default implementation adds a wrapper for the RPC response parameters using
WSDLUtil.addResponseWrapperForRpcOperation(com.boomi.webservices.SchemaMap, com.boomi.model.connector.common.webservices.WebServiceBindingOperation)
, returning the result of this method call.
Subclasses may wish to override this method to do custom type massaging for the webservice.
bindingOp
- the current binding operationschemaDocMapH
- the currently defined schemascom.boomi.webservices.SchemaModelException
protected String getEnvelopeOperationRequestElementName(WebServiceBindingOperation bindingOp, WebServiceProtocol soapProtocol, com.boomi.webservices.SchemaMap schemaDocMap) throws com.boomi.webservices.SchemaModelException
getExecuteWebServiceOperation(javax.wsdl.Definition, java.lang.String, com.boomi.webservices.SchemaMap, com.boomi.webservices.ProtocolHandler)
for requests which will
include the entire SOAP envelope in the request type.
Default implementation returns the result of a call to WSDLUtil.addEnvelopeForOperation(com.boomi.webservices.SchemaMap, com.boomi.model.connector.common.webservices.WebServiceProtocol, com.boomi.model.connector.common.webservices.WebServiceBindingOperation)
.
Subclasses may wish to override this method to do custom type massaging for the webservice.
bindingOp
- the current binding operationsoapProtocol
- the current soap protocol versionschemaDocMap
- the currently defined schemascom.boomi.webservices.SchemaModelException
protected String getEnvelopeOperationResponseElementName(WebServiceBindingOperation bindingOp, WebServiceProtocol soapProtocol, WSBrowser.SchemaMapHolder schemaDocMapH) throws com.boomi.webservices.SchemaModelException
getExecuteWebServiceOperation(javax.wsdl.Definition, java.lang.String, com.boomi.webservices.SchemaMap, com.boomi.webservices.ProtocolHandler)
for responses which will
include the entire SOAP envelope in the response type.
Default implementation returns the result of a call to WSDLUtil.addEnvelopeForOperation(com.boomi.webservices.SchemaMap, com.boomi.model.connector.common.webservices.WebServiceProtocol, com.boomi.model.connector.common.webservices.WebServiceBindingOperation)
.
Subclasses may wish to override this method to do custom type massaging for the webservice.
bindingOp
- the current binding operationsoapProtocol
- the current soap protocol versionschemaDocMapH
- the currently defined schemascom.boomi.webservices.SchemaModelException
protected ObjectDefinition toObjectDefinition(com.boomi.webservices.SchemaMap schemaDocMap) throws com.boomi.webservices.SchemaModelException
schemaDocMap
- current collection of schemas, may be null
or emptycom.boomi.webservices.SchemaModelException
public static String generateCookie(WebServiceOperation wsOperation) throws ConnectorException
wsOperation
- the current operation, may be null
null
ConnectorException
public static WebServiceOperation parseCookie(String cookie) throws ConnectorException
generateCookie(com.boomi.model.connector.common.webservices.WebServiceOperation)
.cookie
- the current operation cookie, may be null
null
of the given cookie is
null
or blankConnectorException
protected static String setRootElement(com.boomi.webservices.SchemaMap schemaDocMap, QName elQName)
schemaDocMap
- the current schemaDocMapelQName
- the desired "root" elementprotected static String setRootElement(WSBrowser.SchemaMapHolder schemaDocMapH, QName elQName)
WSBrowser.SchemaMapHolder.setRootSchema(java.lang.String)
) and returns the localName of the given QName.schemaDocMapH
- holder of the current schemaDocMapelQName
- the desired "root" element