General properties you need to pass in to the message context must be set
via this method. This method can only be used for properties which do not
have specific get/set methods.
Here are some of the properties supported in Axis2.
Generic Constants
- org.apache.axis2.Constants.Configuration.TRANSPORT_URL
Sometimes you want to send your SOAP message through a node, before it reaches to its destination. This means you want to give transport URL different from the URL of the ultimate destination. A typical example would be wanting to send this SOAP (or REST)message through a transparent proxy or through a message monitoring applet. How can that be done using the ServiceClient API?
options.setTo("http://destination.org");
options.setProperty(MessageContextConstants.TRANSPORT_URL, "http://myProxy.org");
This will send your SOAP message to "http://myProxy.org", but if WS-Addressing is enabled, wsa:To will contain "http://destination.org" as To address.
- org.apache.axis2.Constants.Configuration.CHARACTER_SET_ENCODING
This will enable user to set the character set encoding scheme to be used when sending the message. Default is set to "UTF-8"
- org.apache.axis2.Constants.Configuration.ENABLE_MTOM
This will enable/disable MTOM support for outgoing messages.
Possible values are:
"true"/"false" or Boolean.TRUE/Boolean.FALSE
WS-Addressing Module Specific Constants
- org.apache.axis2.addressing.AddressingConstants.WS_ADDRESSING_VERSION
This will enable to select one of the two WS-Addressing versions available, if WS-Addressing is engaged.
Possible values are:
org.apache.axis2.addressing.AddressingConstants.Final.WSA_NAMESPACE
and
org.apache.axis2.addressing.AddressingConstants.Submission.WSA_NAMESPACE
- org.apache.axis2.addressing.AddressingConstants.REPLACE_ADDRESSING_HEADERS
AddressingOutHandler picks up the addressing information from the message context and set them to the outgoing message. But someone may have already put some addressing headers, before the AddressingOutHandler. This flag will notify the handler whether to override them or not.
Possible values are:
"true"/"false" or Boolean.TRUE/Boolean.FALSE
- org.apache.axis2.addressing.AddressingConstants.
DISABLE_ADDRESSING_FOR_OUT_MESSAGES
If WS-Addressing is engaged globally or some how in effect for this particular invocation, this will disable Axis2 from putting WS-Addressing headers in to the out going SOAP message. (Note that Axis2 will not put addressing headers to the outgoing message, irrespective of the above flag, if the incoming message did not contain addressing headers).
Possible values are:
"true"/"false" or Boolean.TRUE/Boolean.FALSE
HTTP Constants
- org.apache.axis2.transport.http.HTTPConstants.CHUNKED
This will enable/disable chunking support.
Possible values are:
"true"/"false" or Boolean.TRUE/Boolean.FALSE
- org.apache.axis2.transport.http.HTTPConstants.NTLM_AUTHENTICATION
This enables the user to pass in NTLM authentication information, such as host, port, realm, username, password to be used with HTTP transport sender.
The value should always be an instance of:
org.apache.axis2.transport.http.HttpTransportProperties.
NTLMAuthentication
- org.apache.axis2.transport.http.HTTPConstants.PROXY
This enables the user to pass in proxy information, such as proxy host name, port, domain, username, password to be used with HTTP transport sender.
The value should always be an instance of:
org.apache.axis2.transport.http.HttpTransportProperties.ProxyProperties
The value should always be an instance of:
org.apache.axis2.transport.http.HttpTransportProperties.BasicAuthentication
org.apache.axis2.transport.http.HTTPConstants.SO_TIMEOUT
This enables the user to pass in socket timeout value as an Integer. If nothing is set, the default value is 60000 milliseconds.
org.apache.axis2.transport.http.HTTPConstants.CONNECTION_TIMEOUT
This enables the user to pass in connection timeout value as an Integer. If nothing is set, the default value is 60000 milliseconds.
org.apache.axis2.transport.http.HTTPConstants.USER_AGENT
This enables the user to set the user agent header in the outgoing HTTP request. Default value is "Axis2"
org.apache.axis2.transport.http.HTTPConstants.MC_GZIP_REQUEST
If set this will GZip your request and send over to the destination. Before doing this, you must make sure that the receiving end supports GZip compressed streams.
Possible values are:
"true"/"false" or Boolean.TRUE/Boolean.FALSE
org.apache.axis2.transport.http.HTTPConstants.MC_ACCEPT_GZIP
Whether or not you send a gzip-ped request, you can choose to receive GZIP back from the server using this flag.
Possible values are:
"true"/"false" or Boolean.TRUE/Boolean.FALSE
org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING
This enables the user to set the cookie string header in the outgoing HTTP request.
org.apache.axis2.transport.http.HTTPConstants.HTTP_PROTOCOL_VERSION
This will set the HTTP protocol version to be used in sending the SOAP requests.
Possible values are :
HTTP/1.1 - HTTPConstants.HEADER_PROTOCOL_11
HTTP/1.0 - HTTPConstants.HEADER_PROTOCOL_10
Default is to use HTTP/1.1.
org.apache.axis2.transport.http.HTTPConstants.HTTP_HEADERS
You might sometimes want to send your own custom HTTP headers. You can set an ArrayList filled with
org.apache.commons.httpclient.Header
objects using the above property. You must not try to override the Headers the Axis2 engine is setting to the outgoing message.
org.apache.axis2.transport.http.HTTPConstants.REUSE_HTTP_CLIENT
You might want to use the same HTTPClient instance for multiple invocations. This flag will notify the engine to use the same HTTPClient between invocations.
org.apache.axis2.transport.http.HTTPConstants.CACHED_HTTP_CLIENT
If user had requested to re-use an HTTPClient using the above property, this property can be used to set a custom HTTPClient to be re-used.
Constants to be used in a REST Invocation
- org.apache.axis2.transport.http.Constants.Configuration.ENABLE_REST
Enabling REST using the above flag will send your request as a REST invocation.
Possible values are:
"true"/"false" or Boolean.TRUE/Boolean.FALSE
- org.apache.axis2.transport.http.Constants.Configuration.HTTP_METHOD
This will help the user to pick the HTTP method to be used during a REST invocation.
Possible values are :
org.apache.axis2.Constants.Configuration.HTTP_METHOD_GET
and
org.apache.axis2.Constants.Configuration.HTTP_METHOD_POST
Default is to use POST method.
- org.apache.axis2.transport.http.Constants.Configuration.CONTENT_TYPE
This will help the user to pick the content type to be used during a REST
invocation.
Possible values are :
- application/xml -
HTTPConstants.MEDIA_TYPE_APPLICATION_XML
- application/x-www-form-urlencoded -
HTTPConstants.MEDIA_TYPE_X_WWW_FORM
- text/xml -
MEDIA_TYPE_TEXT_XML
- multipart/related -
MEDIA_TYPE_MULTIPART_RELATED