Class WSConnection<C extends BrowseContext>
- java.lang.Object
- 
- com.boomi.connector.util.BaseConnection<C>
- 
- com.boomi.connector.ws.WSConnection<C>
 
 
- 
- Direct Known Subclasses:
- WSOperationConnection
 
 public class WSConnection<C extends BrowseContext> extends BaseConnection<C> The WSConnection class is used to implement behavior which is common across all types of interactions with the target web service. This class has a handle to the current Browse/OperationContext and can therefore maintain data which is account specific. This class does not need to be thread-safe as it is only used for a single browse/operation.The most common customization of this class will be changing how the WebServiceExecutor is configured before execution. The main entry point for this customization is the WSOperationConnection.configureExecutor(com.boomi.model.connector.common.webservices.WebServiceOperation, java.lang.String, com.boomi.webservices.WebServiceExecutor)method. One common customization is choosing one of the predefined security types, which can be configured by adding a call toconfigureBasicAuthSecurity(com.boomi.webservices.WebServiceExecutor)orconfigureUsernameWSSecurity(com.boomi.model.connector.common.webservices.UserTokenPasswordType, com.boomi.webservices.WebServiceExecutor).
- 
- 
Field SummaryFields Modifier and Type Field Description static StringAUTH_TYPE_PROPERTYconnection property which users can use to set the authentication typestatic StringDEFAULT_SUCCESS_CODEdefault status code used for successful response documentsstatic StringPASSWORD_PROPERTYconnection property which users can use to set the passwordstatic StringURL_PROPERTYconnection property which users can use to change/specify the base urlstatic StringUSERNAME_PROPERTYconnection property which users can use to set the usernamestatic StringWS_SECURITY_PROPERTYconnection property which users can use to set the WS-Security options
 - 
Constructor SummaryConstructors Constructor Description WSConnection(C context)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static voidappendErrorDetail(Element detail, StringBuilder sb, List<String> path)Appends any non-empty details to the given StringBuilder.protected voidconfigureBasicAuthNonPreemptiveSecurity(com.boomi.webservices.WebServiceExecutor executor)Configures the given WebServiceExecutor for "http basic auth" security support using the username and password retrieved from calls togetUsername()andgetPassword().protected voidconfigureBasicAuthSecurity(com.boomi.webservices.WebServiceExecutor executor)Configures the given WebServiceExecutor for "http basic auth" security support using the username and password retrieved from calls togetUsername()andgetPassword().protected voidconfigureCustomWSSecurity(com.boomi.webservices.WebServiceExecutor executor)protected voidconfigureSecurity(com.boomi.webservices.WebServiceExecutor executor)Configures the given WebServiceExecutor for security support based on the auth type retrieved fromgetAuthType(), delegating toconfigureBasicAuthSecurity(com.boomi.webservices.WebServiceExecutor)orconfigureUsernameWSSecurity(com.boomi.model.connector.common.webservices.UserTokenPasswordType, com.boomi.webservices.WebServiceExecutor)as appropriate.protected voidconfigureUsernameWSSecurity(UserTokenPasswordType pwdType, com.boomi.webservices.WebServiceExecutor executor)Configures the given WebServiceExecutor for "WSSecurity username" security support (for the given password type) using the username and password retrieved from calls togetUsername()andgetPassword().NetworkAuthenticatorcreateAuthenticator()This method creates aSimpleNetworkAuthenticatorforWebServiceAuthenticationType.NETWORK_AUTHENTICATIONtype connections.WebServiceAuthenticationTypegetAuthType()The default implementation returns the connector property with the keyAUTH_TYPE_PROPERTY, defaulting toWSCachegetCache()Returns the connector cache for use for this connection, creating it if necessary.WSConnectorgetConnector()Returns a handle to the connector with which this connection is associated.StringgetDefaultUrl()Returns the "default" url for this web service to be used if none has been configured.StringgetErrorCode(com.boomi.webservices.WebServiceResponse wsResponse)Returns the error status code for the given fault response.StringgetErrorMessage(com.boomi.webservices.WebServiceResponse wsResponse)Returns the error status message for the given fault response.StringgetPassword()Returns the password configured for this connection.protected SSLContextgetSSLContext()Gets the SSL Context to set on theWebServiceExecutorduring call toWSOperationConnection.configureExecutor(com.boomi.model.connector.common.webservices.WebServiceOperation, java.lang.String, com.boomi.webservices.WebServiceExecutor).StringgetSuccessCode()Returns the status code to use for successful responses.StringgetSuccessMessage()Returns the status message to use for successful responses.StringgetUrl()Returns the currently configured url for the web service.protected StringgetUrlFromContext()Returns the url configured for this connection.StringgetUsername()Returns the username configured for this connection.com.boomi.webservices.WSSecurityInfogetWSSecurityInfo()booleanisApplicationFault(com.boomi.webservices.WebServiceResponse wsResponse)Called by operation implementations to determine if the given WebServiceResponse (which is a "fault" response) is anOperationStatus.APPLICATION_ERRORor anOperationStatus.FAILURE.booleanisFatalException(Throwable t)Called by operation implementations to determine if the given Throwable is "fatal".PayloadtoPayload(com.boomi.webservices.WebServiceResponse wsResponse)Returns a Payload appropriate for the given WebServiceResponse.- 
Methods inherited from class com.boomi.connector.util.BaseConnectiongenerateConnectionInfo, generateConnectionInfo, getContext, getOperationContext
 
- 
 
- 
- 
- 
Field Detail- 
URL_PROPERTYpublic static final String URL_PROPERTY connection property which users can use to change/specify the base url- See Also:
- Constant Field Values
 
 - 
USERNAME_PROPERTYpublic static final String USERNAME_PROPERTY connection property which users can use to set the username- See Also:
- Constant Field Values
 
 - 
PASSWORD_PROPERTYpublic static final String PASSWORD_PROPERTY connection property which users can use to set the password- See Also:
- Constant Field Values
 
 - 
AUTH_TYPE_PROPERTYpublic static final String AUTH_TYPE_PROPERTY connection property which users can use to set the authentication type- See Also:
- Constant Field Values
 
 - 
WS_SECURITY_PROPERTYpublic static final String WS_SECURITY_PROPERTY connection property which users can use to set the WS-Security options- See Also:
- Constant Field Values
 
 - 
DEFAULT_SUCCESS_CODEpublic static final String DEFAULT_SUCCESS_CODE default status code used for successful response documents- See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
WSConnectionpublic WSConnection(C context) 
 
- 
 - 
Method Detail- 
getConnectorpublic WSConnector getConnector() Returns a handle to the connector with which this connection is associated.- Overrides:
- getConnectorin class- BaseConnection<C extends BrowseContext>
- Returns:
- the connector
 
 - 
getUrlpublic String getUrl() Returns the currently configured url for the web service.The default implementation generates the value with a call to getUrlFromContextand caches this value for re-use on subsequent calls.
 - 
getUsernamepublic String getUsername() Returns the username configured for this connection.The default implementation returns the connector property with the key USERNAME_PROPERTY.
 - 
getPasswordpublic String getPassword() Returns the password configured for this connection.The default implementation returns the connector property with the key PASSWORD_PROPERTY.
 - 
getWSSecurityInfopublic com.boomi.webservices.WSSecurityInfo getWSSecurityInfo() 
 - 
getAuthTypepublic WebServiceAuthenticationType getAuthType() The default implementation returns the connector property with the keyAUTH_TYPE_PROPERTY, defaulting to- Returns:
- the configured auth type for this connection
- See Also:
- WebServiceAuthenticationType
 
 - 
createAuthenticatorpublic NetworkAuthenticator createAuthenticator() This method creates aSimpleNetworkAuthenticatorforWebServiceAuthenticationType.NETWORK_AUTHENTICATIONtype connections. This method uses the overridablegetAuthType(),getUsername(), andgetPassword()to determine the authentication type and create the authenticator. Implementing classes can override these methods to modify those values but still create a simple authenticator. This method can be overridden if a different implementation is required.- Returns:
- the network authenticator if created, null otherwise
 
 - 
getDefaultUrlpublic String getDefaultUrl() Returns the "default" url for this web service to be used if none has been configured.Default implementation returns null.
 - 
getUrlFromContextprotected String getUrlFromContext() Returns the url configured for this connection.Default implementation returns the connection property with the key URL_PROPERTYif non-blank, otherwise returns the value given bygetDefaultUrl().- Throws:
- ConnectorException- if a valid url can not be found for the web service
 
 - 
getCachepublic WSCache getCache() Returns the connector cache for use for this connection, creating it if necessary. The cache key will be created by a call toWSConnector.createCacheKey(com.boomi.connector.ws.WSConnection<? extends com.boomi.connector.api.BrowseContext>). If the cache needs to be created, this will be done by a call toWSConnector.createCache(com.boomi.connector.ws.WSCache.Key, com.boomi.connector.api.BrowseContext).
 - 
getSSLContextprotected SSLContext getSSLContext() Gets the SSL Context to set on theWebServiceExecutorduring call toWSOperationConnection.configureExecutor(com.boomi.model.connector.common.webservices.WebServiceOperation, java.lang.String, com.boomi.webservices.WebServiceExecutor). Default implementation sets the SSL Context to use trusted JVM and deployed atom certificates.- Returns:
- SSLContext to set on WebServiceExecutor.
 
 - 
configureSecurityprotected void configureSecurity(com.boomi.webservices.WebServiceExecutor executor) Configures the given WebServiceExecutor for security support based on the auth type retrieved fromgetAuthType(), delegating toconfigureBasicAuthSecurity(com.boomi.webservices.WebServiceExecutor)orconfigureUsernameWSSecurity(com.boomi.model.connector.common.webservices.UserTokenPasswordType, com.boomi.webservices.WebServiceExecutor)as appropriate. Security forWebServiceAuthenticationType.NETWORK_AUTHENTICATIONis handled byWSConnector.createAuthenticator(BrowseContext)so nothing is done to "configure" it here.
 - 
configureCustomWSSecurityprotected void configureCustomWSSecurity(com.boomi.webservices.WebServiceExecutor executor) 
 - 
configureBasicAuthSecurityprotected void configureBasicAuthSecurity(com.boomi.webservices.WebServiceExecutor executor) Configures the given WebServiceExecutor for "http basic auth" security support using the username and password retrieved from calls togetUsername()andgetPassword().
 - 
configureBasicAuthNonPreemptiveSecurityprotected void configureBasicAuthNonPreemptiveSecurity(com.boomi.webservices.WebServiceExecutor executor) Configures the given WebServiceExecutor for "http basic auth" security support using the username and password retrieved from calls togetUsername()andgetPassword().
 - 
configureUsernameWSSecurityprotected void configureUsernameWSSecurity(UserTokenPasswordType pwdType, com.boomi.webservices.WebServiceExecutor executor) Configures the given WebServiceExecutor for "WSSecurity username" security support (for the given password type) using the username and password retrieved from calls togetUsername()andgetPassword().
 - 
isFatalExceptionpublic boolean isFatalException(Throwable t) Called by operation implementations to determine if the given Throwable is "fatal". Fatal exceptions will cause the entire operation to be aborted, whereas non-fatal exceptions will only fail the current input data.Default implementation returns false.
 - 
isApplicationFaultpublic boolean isApplicationFault(com.boomi.webservices.WebServiceResponse wsResponse) Called by operation implementations to determine if the given WebServiceResponse (which is a "fault" response) is anOperationStatus.APPLICATION_ERRORor anOperationStatus.FAILURE. See the sdk documentation for more details on application errors.Default implementation returns true.
 - 
getSuccessCodepublic String getSuccessCode() Returns the status code to use for successful responses. Called by operation implementations when returning successful results.Default implementation returns DEFAULT_SUCCESS_CODE.
 - 
getSuccessMessagepublic String getSuccessMessage() Returns the status message to use for successful responses. Called by operation implementations when returning successful results.Default implementation returns null.
 - 
getErrorCodepublic String getErrorCode(com.boomi.webservices.WebServiceResponse wsResponse) Returns the error status code for the given fault response. Called by operation implementations when returning error results.Detail implementation returns WebServiceResponse.getErrorCode().
 - 
getErrorMessagepublic String getErrorMessage(com.boomi.webservices.WebServiceResponse wsResponse) Returns the error status message for the given fault response. Called by operation implementations when returning error results.Detail implementation returns WebServiceResponse.getRawErrorMessage()with any detail strings appended to it.
 - 
toPayloadpublic Payload toPayload(com.boomi.webservices.WebServiceResponse wsResponse) throws com.boomi.webservices.WebServiceException Returns a Payload appropriate for the given WebServiceResponse. Called by operation implementations to convert a WebServiceResponse into a result document. May returnnull.Default implementation returns the response body converted to a Payload (using the most efficient conversion possible) if there is a body, nullotherwise.- Throws:
- com.boomi.webservices.WebServiceException
 
 - 
appendErrorDetailprotected static void appendErrorDetail(Element detail, StringBuilder sb, List<String> path) Appends any non-empty details to the given StringBuilder. Details will be appended using the format: ";<detailName>=<detailValue>". Detail names will be generated by joining the element names with a '.' character. For example, the detail element of"<error><code>1234</code></error>"will result in the appended string "; error.code=1234".
 
- 
 
-