Port
WebReference2
WSUtil
DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!
Let us know so we can improve!
A utility class for performing SOAP-based operations for Web Services for use with WebReference2. This class provides methods for setting SOAP headers and a set of constants representing the well-known supported header names. You also use this class to set connection and request timeout values for Web Service calls.
See Also:
| Constant | Description |
|---|---|
| KEY_ID_TYPE_DIRECT_REFERENCE: String = “DirectReference” | This key identifier method is used when the X.509 Certificate is included in the message. |
| KEY_ID_TYPE_ENC_KEY_SHA1: String = “EncryptedKeySHA1” | This Key Identifier method only applies for Encryption. |
| KEY_ID_TYPE_ISSUE_SERIAL: String = “IssuerSerial” | This key identifier method means that the Issuer Name and Serial Number of a X.509 Certificate is included directly in the KeyInfo Element. |
| KEY_ID_TYPE_SKI_IDENTIFIER: String = “SKIKeyIdentifier” | This Key Identifier method refers to a Certificate via a Base-64 encoding of the Subject Key Identifier. |
| KEY_ID_TYPE_THUMBPRINT: String = “Thumbprint” | This Key Identifier method refers to the Certificate via a SHA-1 Thumbprint. |
| KEY_ID_TYPE_X509_KEY_IDENTIFIER: String = “X509KeyIdentifier” | This key identifier method is similar to KEY_ID_TYPE_DIRECT_REFERENCE, in that the certificate is included in the request. |
| WS_ACTION: String = “action” | WS-Security action property name. |
| WS_ENCRYPT: String = “Encrypt” | WS-Security action: Encrypt the message. |
| WS_ENCRYPTION_PARTS: String = “encryptionParts” | WS-Security Encryption: Defines which parts of the request shall be encrypted. |
| WS_ENCRYPTION_USER: String = “encryptionUser” | WS-Security Encryption: The user’s name for encryption. |
| WS_ENC_KEY_ID: String = “encryptionKeyIdentifier” | Defines which key identifier type to use for encryption. |
| WS_ENC_PROP_KEYSTORE_ALIAS: String = “__EncryptionPropKeystoreAlias” | WS-Security Encryption: The encryption and decryption keystore alias name |
| WS_ENC_PROP_KEYSTORE_PW: String = “__EncryptionPropKeystorePassword” | WS-Security Encryption: The encryption and decryption keystore password |
| WS_ENC_PROP_KEYSTORE_TYPE: String = “__EncryptionPropKeystoreType” | WS-Security Encryption: The signature keystore type ( jks, pkcs12, or managed ). |
| WS_NO_SECURITY: String = “NoSecurity” | WS-Security action: No security. |
| WS_PASSWORD_TYPE: String = “passwordType” | WS-Security password type: Parameter for UsernameToken action to define the encoding of the password. |
| WS_PW_DIGEST: String = “PasswordDigest” | WS-Security password type “digest”: Use a password digest to send the password information. |
| WS_PW_TEXT: String = “PasswordText” | WS-Security password type “text”: Send the password information in clear. |
| WS_SECRETS_MAP: String = “__SecretsMap” | A secrets map with the username and password entries needed to create the password callback object. |
| WS_SIGNATURE: String = “Signature” | WS-Security action: Sign the message. |
| WS_SIGNATURE_PARTS: String = “signatureParts” | WS-Security Signature: Defines which parts of the request shall be signed. |
| WS_SIGNATURE_USER: String = “signatureUser” | WS-Security Signature: The user’s name for signature. |
| WS_SIG_DIGEST_ALGO: String = “signatureDigestAlgorithm” | WS-Security Signature: Defines which signature digest algorithm to use. |
| WS_SIG_KEY_ID: String = “signatureKeyIdentifier” | Defines which key identifier type to use for signature. |
| WS_SIG_PROP_KEYSTORE_ALIAS: String = “__SignaturePropKeystoreAlias” | WS-Security Signature: The signature keystore alias name. |
| WS_SIG_PROP_KEYSTORE_PW: String = “__SignaturePropKeystorePassword” | WS-Security Signature: The signature keystore password. |
| WS_SIG_PROP_KEYSTORE_TYPE: String = “__SignaturePropKeystoreType” | WS-Security: The signature keystore type ( jks, pkcs12, or managed ). |
| WS_TIMESTAMP: String = “Timestamp” | WS-Security action: Add a timestamp to the security header. |
| WS_USER: String = “user” | WS-Security user name. |
| WS_USERNAME_TOKEN: String = “UsernameToken” | WS-Security action: Add a UsernameToken identification. |
| Constructor | Description |
|---|---|
| WSUtil() |
| Method | Description |
|---|---|
| static addSOAPHeader(Object, Object, Boolean, String) | Adds a header element to the SOAP Header. |
| static addSOAPHeader(Object, String, Boolean, String) | Adds a header element to the SOAP Header. |
| static clearSOAPHeaders(Object) | Removes all SOAP header elements from the port’s request context. |
| static createHolder(Object) | Creates an javax.xml.ws.Holder instance that wraps the specified element. |
| static getConnectionTimeout(Object) | Returns the connection timeout value for the port. |
| static getHTTPRequestHeader(Object, String) | Returns an HTTP request header property value using the specified key. |
| static getProperty(String, Object) | Returns the value of the SOAP request property using the specified key on a port returned from one of the WebReference2 getService methods. |
| static getRequestTimeout(Object) | Returns the read timeout value for a request made on the specified port. |
| static getResponseProperty(String, Object) | Returns the property value using the specified key and on a port returned from one of the WebReference2 getService methods. |
| static isAllowChunking(Object) | Returns true if the HTTP request may be chunked, false otherwise |
| static setAllowChunking(Object, Boolean) | Indicate that HTTP chunked Transfer-Encoding may be used. |
| static setConnectionTimeout(Number, Object) | Sets the connection timeout for the port. |
| static setHTTPRequestHeader(Object, String, String) | Sets an HTTP request header property using the specified key and value. |
| static setProperty(String, Object, Object) | Set the SOAP request property using the specified key and value on a port returned from one of the WebReference2 getService() methods. |
| static setRequestTimeout(Number, Object) | Sets the read timeout value for a request made on the specified port. |
| static setUserNamePassword(String, String, Object) | Set the user name and password to use with Basic authentication. |
| static setWSSecurityConfig(Object, Object, Object) | Set the WS-Security configuration for the request and response based on the constants defined (see above). |
assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values
This key identifier method is used when the X.509 Certificate is included in the message. The certificate is Base-64 encoded and included in the request via a BinarySecurityToken element
See Also:
This Key Identifier method only applies for Encryption. Unlike the previous methods it refers to the way the EncryptedData references the EncryptedKey Element, rather than the way the EncryptedKey Element refers to the public key.
See Also:
This key identifier method means that the Issuer Name and Serial Number of a X.509 Certificate is included directly in the KeyInfo Element.
See Also:
This Key Identifier method refers to a Certificate via a Base-64 encoding of the Subject Key Identifier.
See Also:
This Key Identifier method refers to the Certificate via a SHA-1 Thumbprint. The certificate may or may not be included in the request.
See Also:
This key identifier method is similar to KEY_ID_TYPE_DIRECT_REFERENCE, in that the certificate is included in the request. However, instead of referring to a certificate, the certificate is included directly in the KeyInfo element.
See Also:
WS-Security action property name. Allowed property values are WS_NO_SECURITY, WS_TIMESTAMP, WS_ENCRYPT, WS_SIGNATURE, WS_USERNAME_TOKEN or a space separated list of these values.
WS-Security action: Encrypt the message. The encryption specific parameters define how to encrypt.
WS-Security Encryption: Defines which parts of the request shall be encrypted.
WS-Security Encryption: The user's name for encryption.
Defines which key identifier type to use for encryption. Permissible values are:
KEY_ID_TYPE_ISSUE_SERIAL(default value)KEY_ID_TYPE_DIRECT_REFERENCEKEY_ID_TYPE_X509_KEY_IDENTIFIERKEY_ID_TYPE_THUMBPRINTKEY_ID_TYPE_SKI_IDENTIFIERKEY_ID_TYPE_ENC_KEY_SHA1See Also:
WS-Security Encryption: The encryption and decryption keystore alias name
WS-Security Encryption: The encryption and decryption keystore password
WS-Security Encryption: The signature keystore type ( jks, pkcs12, or managed ).
The default is jks.
The "managed" type will resolve aliases against the names of certificates and keys in Business Manager.
Note: For non-managed types, the keystore file has the basename of the WSDL file and the file extension based on the keystore type (e.g. MyService.jks). The keystore file has to be placed in the same cartridge directory as the WSDL file.
WS-Security action: No security.
WS-Security password type: Parameter for UsernameToken action to define the encoding of the password. Allowed values are PW_DIGEST or PW_TEXT.
WS-Security password type "digest": Use a password digest to send the password information.
WS-Security password type "text": Send the password information in clear.
A secrets map with the username and password entries needed to create the password callback object.
WS-Security action: Sign the message. The signature specific parameters define how to sign and which keys to use.
WS-Security Signature: Defines which parts of the request shall be signed.
WS-Security Signature: The user's name for signature.
WS-Security Signature: Defines which signature digest algorithm to use.
Defines which key identifier type to use for signature.
Permissible values are:
KEY_ID_TYPE_ISSUE_SERIALKEY_ID_TYPE_DIRECT_REFERENCE(default value)KEY_ID_TYPE_X509_KEY_ID_IDENTIFIERKEY_ID_TYPE_THUMBPRINTKEY_ID_TYPE_SKI_IDENTIFIERSee Also:
WS-Security Signature: The signature keystore alias name.
WS-Security Signature: The signature keystore password.
WS-Security: The signature keystore type ( jks, pkcs12, or managed ).
The default is jks.
The "managed" type will resolve aliases against the names of certificates and keys in Business Manager.
Note: For non-managed types, the keystore file has the basename of the WSDL file and the file extension based on the keystore type (e.g. MyService.jks). The keystore file has to be placed in the same cartridge directory as the WSDL file.
WS-Security action: Add a timestamp to the security header.
WS-Security user name.
WS-Security action: Add a UsernameToken identification.
Adds a header element to the SOAP Header. Each header element should be XML and it should typically contain a namespace URI.
Parameters:
Adds a header element to the SOAP Header. Each header element should be XML and it should typically contain a namespace URI.
Parameters:
Removes all SOAP header elements from the port's request context.
Parameters:
See Also:
Creates an javax.xml.ws.Holder instance that wraps the specified element. When a WSDL operation is defined to have an input and output message using the same type, the operation may require the operation's object to be wrapped in a holder.
Parameters:
Returns:
Returns the connection timeout value for the port.
Parameters:
Returns:
See Also:
Returns an HTTP request header property value using the specified key. Null is returned if the key does not represent an HTTP header property.
Parameters:
Returns:
Returns the value of the SOAP request property using the specified key on a port returned from one of the WebReference2 getService methods. The property keys are defined as constants in Port.
Parameters:
Returns:
See Also:
Returns the read timeout value for a request made on the specified port. If the request exceeds the timeout value, an error is thrown.
Parameters:
Returns:
See Also:
Returns the property value using the specified key and on a port returned from one of the WebReference2 getService methods.
Parameters:
Returns:
See Also:
Returns true if the HTTP request may be chunked, false otherwise
Parameters:
Returns:
Indicate that HTTP chunked Transfer-Encoding may be used.
The default behavior is true. If false then the request will not be chunked and the Content-Length will always be sent.
Parameters:
Sets the connection timeout for the port.
Parameters:
See Also:
Sets an HTTP request header property using the specified key and value.
Parameters:
Set the SOAP request property using the specified key and value on a port returned from one of the WebReference2 getService() methods. The property keys are defined as constants in Port.
Parameters:
See Also:
Sets the read timeout value for a request made on the specified port. If the request exceeds the timeout value, an error is thrown.
Parameters:
See Also:
Set the user name and password to use with Basic authentication. For stronger authentication, use the setWSSecurityConfig(Object, Object, Object) method.
Parameters:
See Also:
Set the WS-Security configuration for the request and response based on the constants defined (see above).
Parameters:
See Also: