You can specify the behavior of an Http control in Design View by setting the control's properties in the Property Editor. The following attributes specify class- and method-level configuration attributes for the File control.
This topic defines the various Http methods that you can use to specify properties. Each method is described briefly in Table 8-1, and detailed in subsequent sections that are referenced to the methods outlined in the table.
You can use the following methods with the Http control:
Method: Void setProperties(HttpControlPropertiesDocument propsDoc)
To use dynamic properties, pass an XML variable that conforms to the Http control's dynamic-property schema to the Http control's setProperties() method.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="Http://www.bea.com/wli/control/dynamicProperties" xmlns:xs="Http://www.w3.org/2001/XMLSchema" xmlns="Http://www.bea.com/wli/control/dynamicProperties" elementFormDefault="qualified">
<xs:element name="HttpControlProperties">
<xs:complexType>
<xs:sequence>
<xs:element name="URLName" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Note: Using the Dynamic Properties feature, you can modify only the URL during run time. Other properties can be modified using the Property Editor.
Method: SetConnectionTimeOut (int timeoutInMilliSeconds)
This method sets the connection time out for an Http request. The connection time-out is maximum time that a control is allowed to establish a connection - the connection fails after this time elapses. The parameter time-out is set in milliseconds. A time-out value of zero (zero is the default value) indicates that the connection time-out has not been used.
Method: SetConnectionRetrycount (int retryCount)
This method sets the retry count, that is, the number of times your application will retry for the Http request. If this value is not specified, the application will connect only once. If a connection is not established in the first try, the second attempt is likely to succeed. It is recommended that you set this property so that your Http requests go through in the second attempt, if not the first one.
Method: SetServerSideSSL (String trustStoreLocation, boolean hostVerificationFlag)
The WLI Http control provides complete support for Http over Secure Sockets Layer (SSL) and Transport Layer Security (TLS), by leveraging the Java Secure Socket Extension (JSSE). JSSE is integrated into JDK1.4, which is shipped along with WebLogic Integration Platform.
When you run this method, the configuration for server-side authentication is set. By default, JSSE uses (\jdk141_03\jre\lib\security\cacerts) as its Trust Store location, which includes some well-known certificate authorities such as Verisign and CyberTrust. Therefore, you do not need to specify any Trust Store locations for the certificates, which are issued by the certification authority.
Additionally, you can provide a host-name verification flag that ensures that the SSL session's server host-name matches with the host name returned in the server certificates Common Name field of the SubjectDN entry. By default this entry is set to False.
For example, if you specify Https://www.verisign.com/ as the URL for authentication, you do not have to specify the Trust Store location, as Verisign is a trusted authority in certificates of JSSE.
To accept self-signed or SSL certificates that are not trusted, you need to import the server certificates into its Trust Store Location. For more information on JSSE, see the Java Secure Socket Extension (JSSE) Reference Guide at Http://java.sun.com/j2se/1.4.2/docs/guide/security/jsse/JSSERefGuide.html.
The following example shows how to create a store, import a server certificate, and to specify the parameters for this method:
keytool -genkey -alias <aliasname> -keyalg rsa -keystore <keystore name>
The following is an example of the command, including user-input values:
keytool -genkey -alias teststore -keyalg rsa -keystore c:\teststore.jks
For more information, see Creating a Keystore to Use with JSSE, at the following location:
Http://java.sun.com/j2se/1.4.2/docs/guide/security/jsse/JSSERefGuide.html.
keytool -import -alias <aliascertname> -file <certificatename> -keystore <keystore name>
keytool -import -alias testcer -file c:\test.cer -keystore c:\teststore.jks
Method: SetClientSideSSL (String keyStoreType, String keyStoreLocation, String keyStorePassword, String keyPassword)
This method sets the configuration for client-side authentication. You should use this method when both server-side and client-side authentication are required. Before configuring this method, you must configure Configuring Server-side SSL.
In this method, both the keyStoreType and keyPassword fields are optional. If you do not specify the keyStoreType, the method uses the default Keystore type (which is specified in the java.security file).
For some Keystores, the Keystore password differs from the key password. In such cases, you must specify both the Keystore password and key password.
If you want both server-side and client-side configuration, the server certificate should be in the Client Trust Store. Similarly, the client certificate should be in the Server Trust Store and the client should specify the Keystore location and passwords appropriately.
Method: SetProxyConfig (String host, int port, String userName, String password)
This method configures parameters for a proxy server. To send an Http request using a proxy server, you must properly configure the host, port, user name, and password.
Note that the Http control supports the Basic Scheme protocol. It does not support NTLM protocol. You need to configure your proxy settings accordingly.
Method: Cookies (CookiesDocument cookies)
The Http control allows you to manually set the cookies sent to the server. There are several standards for handling cookies, such as the Netscape Cookie Draft, RFC2109, RFC2965 and a large number of vendor specific implementations. The Http control uses the default cookie policy of the Http client, which is the compatibility policy. To send the cookies to an Http request, you have to pass an XML variable that conforms to the Http control's cookies document schema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="Http://www.w3.org/2001/XMLSchema" xmlns="Http://www.bea.com/wli/control/HttpCookies" elementFormDefault="qualified" targetNamespace="Http://www.bea.com/wli/control/HttpCookies">
<xs:element name="Cookies">
<xs:complexType>
<xs:sequence>
<xs:element name="Cookie" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string"
minOccurs="0"/>
<xs:element name="Value" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<?xml version="1.0" encoding="UTF-8"?>
<Cookies xmlns="Http://www.bea.com/wli/control/HttpCookies">
<Cookie>
<Name>CookieName1</Name>
<Value>CookieValue1</Value>
</Cookie>
<Cookie>
<Name>CookieName2</Name>
<Value>CookieValue2</Value>
</Cookie>
</Cookies>
Method: SetHeadersForHttpPost (HeadersDocument headers)
This method sets the request header for an Http Post. To set the request header, you have to pass an XML variable that conforms to the Http control's headers document schema. You can overwrite the default header's values by specifying them in the following manner:
User-agent, Content-Type, and so on.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="Http://www.w3.org/2001/XMLSchema" xmlns="Http://www.bea.com/wli/control/HttpHeaders" elementFormDefault="qualified" targetNamespace="Http://www.bea.com/wli/control/HttpHeaders">
<xs:element name="Headers">
<xs:complexType>
<xs:sequence>
<xs:element name="Header" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string" minOccurs="0"/>
<xs:element name="value" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<?xml version="1.0" encoding="UTF-8"?>
<xyz:Headers xmlns:xyz="Http://www.bea.com/wli/control/HttpHeaders">
<xyz:Header>
<xyz:name>Content-Type</xyz:name>
<xyz:value>text/*</xyz:value>
</xyz:Header>
<xyz:Header>
<xyz:name>header</xyz:name>
<xyz:value>h1</xyz:value>
</xyz:Header>
</xyz:Headers>
Method: ResponseDocument sendDataAsHttpGet (ParametersDocument parameters)
Use this method when you want to send an Http request as Http Get and receive a response. Typically, the Get method is used to download a document from a Web server. You can also send Http Get parameters with a URL, by passing the parameters in an XML variable that conforms to the Http control's parameter document schema, as follows:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="Http://www.w3.org/2001/XMLSchema" xmlns="Http://www.bea.com/wli/control/HttpParameter" elementFormDefault="qualified" targetNamespace="Http://www.bea.com/wli/control/HttpParameter">
<xs:element name="Parameters">
<xs:complexType>
<xs:sequence>
<xs:element name="Parameter" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string"
minOccurs="0"/>
<xs:element name="Value" type="xs:string"
minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<?xml version="1.0" encoding="UTF-8"?>
<xyz:Parameters xmlns:xyz="Http://www.bea.com/wli/control/HttpParameter">
<xyz:Parameter>
<xyz:Name>Customer Id</xyz:Name>
<xyz:Value>1000</xyz:Value>
</xyz:Parameter>
<xyz:Parameter>
<xyz:Name>Customer Name</xyz:Name>
<xyz:Value>Robert</xyz:Value>
</xyz:Parameter>
</xyz:Parameters>
The ResponseDocument sendDataAsHttpGet (ParametersDocument parameters) method returns the Http response, that is, the Http response code and corresponding message back in a ResponseDocument.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="Http://www.bea.com/wli/control/HttpResponse" xmlns:xs="Http://www.w3.org/2001/XMLSchema" xmlns="Http://www.bea.com/wli/control/HttpResponse" elementFormDefault="qualified">
<xs:element name="Response">
<xs:complexType>
<xs:sequence>
<xs:element name="ResponseCode" type="xs:int"/>
<xs:element name="ResponseMessage" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Method: ResponseDocument sendDataAsHttpPost (String/XmlObject/byte[ ] bodyData)
Use the Http Post method to post data to a server. The Http control allows you to post data of three different data types: String, XmlObject, and byte.
The Http Post method returns the Http response, that is, the Http response code and corresponding message in a ResponseDocument. The schema of the response document is the same as described in The Schema of the Response Document for Http Get.
Method: HeadersDocument getResponseHeaders
Use this method to receive the Http response headers. The response headers are returned in an XML variable of a pre-defined schema.
The schema for the response headers is same as request headers schema described inSetting Headers for Http Post.
Method: CookiesDocument getCookies
Use this method to receive the cookies from the server. The cookies are returned in an XML document of a pre-defined schema.
The schema for the response cookies is same as the request cookies schema described in Schema for Setting Cookie Policies.
Method: String getResponseBodyAsString / XmlObject getResponseBodyAsXml / byte[ ] getResponseBodyAsBytes
The Http control can return response data in three different data types: String, XmlObject, and byte. Therefore, when you create an Http control using the Post mode, you must select the response body data type that you want. If the response body type that you select in the Creating a New WLI Http Control process is not available or cannot be read, you will receive a null value for body type, and the default body type will be returned.
Note: When the response body data is read as a string value, the Http control uses the character encoding in the Content specified in the Content-Type header. If the character encoding is not -1, then the Http control using the default Http content encoding (ISO-8859-Type header.
This indicates that the server should appropriately set the response headers for the Content-Type. For example:
Content-type="text/xml; charset=ISO-8859-1"
![]() |
![]() |