SoapPBCookie

Description

Use the SoapPBCookie class to get or set cookies for the Web service.

Methods

SoapPBCookie has the following methods:


GetComment

Description

Gets a comment that the server provides with a cookie.

Syntax

acookie.GetComment ( ) 

Argument

Description

acookie

The name of an instance of the SoapPBCookie object


Return value

String.

Returns a comment provided with the cookie.

Usage

An optional comment added by the server typically includes information about privacy policy or intended uses of the cookie.

GetCommentUri

Description

Gets a URI comment that the server provides with a cookie.

Syntax

acookie.GetCommentUri ( ) 

Argument

Description

acookie

The name of an instance of the SoapPBCookie object


Return value

String.

Returns a URI comment provided with the cookie.

Usage

An optional comment added by the server that represents the intended use of the URI reference for the cookie.

GetExpired

Description

Gets the current state of a cookie.

Syntax

acookie.GetExpired ( ) 

Argument

Description

acookie

The name of an instance of the SoapPBCookie object


Return value

Boolean.

Returns true if the cookie has expired. Otherwise, returns false.

GetExpires

Description

Gets the expiration date and time for a cookie.

Syntax

acookie.GetExpires ( ) 

Argument

Description

acookie

The name of an instance of the SoapPBCookie object


Return value

DateTime.

Gets the expiration date and time of a cookie.

Usage

A session cookie returns a DateTime value of January 1, 0001, 00:00:00.0000000.

GetHttpOnly

Description

Gets the accessibility of a cookie to page scripts or other active content.

Syntax

acookie.GetHttpOnly ( ) 

Argument

Description

acookie

The name of an instance of the SoapPBCookie object


Return value

Boolean.

Returns false when a page script or other active content is able to access the cookie. Otherwise, returns true.

GetName

Description

Gets the name of a cookie.

Syntax

acookie.GetName ( ) 

Argument

Description

acookie

The name of an instance of the SoapPBCookie object


Return value

String.

Returns the name of the cookie.

Usage

For an example using GetName, see the section called “PBGetCookies (Deprecated)” in PowerScript Reference.

GetSecure

Description

Gets the security level of a cookie.

Syntax

acookie.GetSecure ( ) 

Argument

Description

acookie

The name of an instance of the SoapPBCookie object


Return value

Boolean.

Returns true if HTTPS is required. Otherwise, returns false.

GetTimeStamp

Description

Gets the time when the cookie was issued.

Syntax

acookie.GetTimeStamp ( ) 

Argument

Description

acookie

The name of an instance of the SoapPBCookie object


Return value

DateTime.

Gets the date and time when the cookie was issued.

GetURI

Description

Gets the URI for which the cookie is valid.

Syntax

acookie.GetURI ( ) 

Argument

Description

acookie

The name of an instance of the SoapPBCookie object


Return value

String.

Returns the URI.

GetValue

Description

Gets the value of the cookie.

Syntax

acookie.GetValue ( ) 

Argument

Description

acookie

The name of an instance of the SoapPBCookie object


Return value

String.

Returns the cookie value.

GetVersion

Description

Gets the version of the HTTP state maintenance to which a cookie conforms.

Syntax

acookie.GetVersion ( ) 

Argument

Description

acookie

The name of an instance of the SoapPBCookie object


Return value

Integer.

Returns 1 if the cookie conforms to RFC 2109, and 2 if the cookie conforms to RFC 2965.

SetComment

Description

Sets a comment that the server can add to a cookie.

Syntax

acookie.SetComment ( string comment ) 

Argument

Description

acookie

The name of an instance of the SoapPBCookie object

comment

String for a comment that you want the server to provide with a cookie


Return value

Long.

Returns 0 for success, and 50 for failure.

Usage

Comments are optional. Typical comments include information about privacy policy and intended use of a cookie.

SetCommentUri

Description

Sets a comment.

Syntax

acookie.SetCommentURI ( string commentUri ) 

Argument

Description

acookie

The name of an instance of the SoapPBCookie object

commentUri

String for a URI comment that you want the server to provide with a cookie


Return value

Long.

Returns 0 for success, and 50 for failure.

Usage

URI comments are optional, but must conform to the URI format when used. Typical URI comments include information about how the server uses a cookie.

SetExpired

Description

Sets the state of a cookie.

Syntax

acookie.SetExpired ( boolean expired ) 

Argument

Description

acookie

The name of an instance of the SoapPBCookie object

expired

Set to true if you want to terminate the cookie. The expired value is false by default.


Return value

Long.

Returns 0 for success, and 50 for failure.

SetExpires

Description

Sets the expiration date and time for a cookie.

Syntax

acookie.SetExpires ( datetime expires ) 

Argument

Description

acookie

The name of an instance of the SoapPBCookie object

expires

A DateTime value for the expiration date and time you want to set for a cookie


Return value

Long.

Returns 0 for success, and 50 for failure.

Usage

You set a session cookie by entering a DateTime value of January 1, 0001, 00:00:00.0000000.

SetHttpOnly

Description

Determines whether a cookie can be accessed by page scripts or other active content.

Syntax

acookie.SetHttpOnly ( boolean httpOnly ) 

Argument

Description

acookie

The name of an instance of the SoapPBCookie object

httpOnly

Set to true if you want to restrict cookie to HTTP access only. Set to false if you want page scripts or other active content to be able to access the cookie.


Return value

Long.

Returns 0 for success, and 50 for failure.

SetName

Description

Sets the name for a cookie.

Syntax

acookie.SetName ( string name ) 

Argument

Description

acookie

The name of an instance of the SoapPBCookie object

name

The name that you want to set for the cookie


Return value

Long.

Returns 0 for success, and 50 for failure.

Usage

The name must be initialized before setting an instance of the Cookie class. The following characters cannot be used for the cookie name: equal sign (=), semicolon (;), comma (,), new line (\n), return (\r), and tab (\t). The dollar sign ($) cannot be used as the first character in the name.

Cookies are considered the same if the values of both their URI and name are the same. If a cookie already exists in the Web service with the same name and URI, it will be replaced with the new cookie when you call a Web service method.

For an example using SetName, see the section called “PBAddCookie (Deprecated)” in PowerScript Reference.

SetSecure

Description

Sets the security level for a cookie.

Syntax

acookie.SetSecure ( boolean secure ) 

Argument

Description

acookie

The name of an instance of the SoapPBCookie object

secure

Set this to true if you want the client to return the cookie only when Secure Hypertext Transfer Protocol (HTTPS) is used.


Return value

Long.

Returns 0 for success, and 50 for failure.

Usage

SetSecure is false by default.

SetURI

Description

Sets the URI for which the cookie is valid.

Syntax

acookie.SetURI ( string uri ) 

Argument

Description

acookie

The name of an instance of the SoapPBCookie object

uri

The URI for which the cookie is valid


Return value

Long.

Returns 0 for success, and 50 for failure.

Usage

The URI value you set must conform to the URI format.

SetValue

Description

Sets the value for a cookie.

Syntax

acookie.SetValue ( string value ) 

Argument

Description

acookie

The name of an instance of the SoapPBCookie object

value

A string value that you want to set for the cookie


Return value

Long.

Returns 0 for success, and 50 for failure.

Usage

Semicolons and commas cannot be used in the value that you set for a cookie.

SetVersion

Description

Sets the HTTP state maintenance version to which a cookie conforms.

Syntax

acookie.SetVersion ( int version ) 

Argument

Description

acookie

The name of an instance of the SoapPBCookie object

version

The HTTP version to which you want the cookie to conform.


Return value

Long.

Returns 0 for success, and 50 for failure.

Usage

If you set version to 1, the cookie must conform to RFC 2109. If you set the cookie to 2, the cookie must conform too RFC 2965.