WSInvokeDL
The WSInvokeDL
function makes web services calls when a Web Services Description Language (WSDL) file is compiled
with nci_compilewsdl
, or when a policy is configured using the Web Services
wizard.
Syntax
This function has the following syntax:
[Return] = WSInvokeDL(WSService, WSEndPoint, WSMethod, WSParams, [callProps])
This function returns the value of your target web services call.
Parameters
The WSInvokeDL
function
has the following parameters:
Parameter |
Format |
Description |
---|---|---|
|
String |
This web service name is defined in the |
|
String |
The web service endpoint URL of the target web service. |
|
String |
The web service method defines which method
you would like to call in |
|
Array |
The web services operation parameters are defined
by |
|
String, Boolean, integer |
The optional container in which you can set any of the properties, which are listed in the callProps properties section. |
callProps properties
callProps
must
precede the actual call to WSInvokeDL
.- CacheStub
-
Caches generated stubs. This value must be set to true if either or both of the following properties are enabled, ReuseHttpClient, MaintainSession.
Examples of usage:callProps.CacheStub=true;
callProps.ReuseHttpClient = true;
- CharSet
-
Sets the encoding other than UTF-8.
- Chunked
-
Divides the packets into small chunks if the server supports the feature. The default property is true.
Tip: If you receive the following error message when running the WSInvokeDL function then set this property to false.Transport error: 11 Error: Length Required in policy
- ConnectionManagerTimeout
-
30000
milliseconds.Example usage:
callProps.ConnectionManagerTimeout=30000;
Starting with 7.1.0.30, the ConnectionManagerTimeout property has been deprecated and you should use WSTimeout instead.
- CustomHeaders
-
Adds custom header values other than the headings that are already supported in the documentation.
- DecryptPassword
-
Enables the decryption of an encrypted password in a policy.
- EnableWSS
-
Enables Web Service Security. If you specify EnableWSS, you must also specify the following properties:
- WSSRepository, which specifies the path location of WSS Repository.
- WSSConfigFile, which specifies configuration file for EnableWSS.
Example:
callProps.EnableWSS = true; callProps.WSSRepository= "/opt/IBM/tivoli/impact/dsa/wsdsa/wss"; callProps.WSSConfigFile = "/opt/IBM/tivoli/impact/dsa/wsdsa/wss/conf/Sample03_wss.xml"; callProps.WSSPolicyFile = "/opt/IBM/tivoli/impact/dsa/wsdsa/wss/conf/policy03.xml"; WSInvokeDL(WSService, WSEndPoint, WSMethod, WSParams, callProps);
Tip: See Web services security for more information on how to configure Web Services Security. - GetHeaders
-
Retrieves the Web Service headers and returns them in the
ResponseHeaders
variable.To retrieve the Web Service headers, use the following:
callProps.GetHeaders = true;
You can access individual headers with dot or bracket notation. For example, to access the
Content-Language
header:Log(ResponseHeaders); ContentLanguage = ResponseHeaders["Content-Language"]; Log(ContentLanguage);
Sample output:
Parser log: "Context"=(Content-Language=en-GB, Date=Fri, 24 Feb 2017 16:41:12 GMT, Content-Length=259, Content-Type=text/xml; charset=UTF-8, X-Powered-By=Servlet/3.0) Parser log: en-GB
- HandleFault
-
Is used to manage faults. Fault messages are returned from the web services server to indicate that there is a problem.
- HTTP
-
The default HTTP version is 1.1. You can use this property to set the protocol version to 1.0.
- KeepAlive
-
Can be used to enable the
KeepAlive
header. If set totrue
, connections are kept alive for reuse by multiple sequential requests and responses. If set tofalse
, connections are closed after the response is sent. It requires HTTP 1.1.Example usage:
callProps.KeepAlive = true;
- LogSoapMessages
-
You can enable logging of outgoing and incoming soap messages, by setting the LogSoapMessages property to
true
. This property should only be used for debugging purposes and should not be enabled permanently in a production environment.callProps = NewObject(); callProps.LogSoapMessages = "true"; WSInvokeDLResult = WSInvokeDL(WSService, WSEndPoint, WSMethod, WSParams, callProps);
The messages will be logged to $IMPACT_HOME/wlp/usr/servers/<server>/logs/messages.log.
- MaintainSession
-
Sets the session management to enabled status. When session management is enabled, the system maintains the session-related objects across the different requests. The parameter must be set to true or false.
- MaxConnectionsPerHost
-
Example usage:
callProps.MaxConnectionsPerHost=10;
- MaxTotalConnections
-
Example usage:
callProps.MaxTotalConnections=20;
- Password
-
Specifies the password for basic authentication.
- PreemptiveAuth
- Enables Preemptive Authentication.
- ReuseHttpClient
-
Enables the underlying infrastructure to reuse the HTTP client if one is available. The ReuseHttpClient is useful if the client is using HTTPS to communicate with the server. The parameter must be set to true or false.
- SocketTimeout
-
Example usage:
callProps.SocketTimeout=9000; // Use SocketTimeout instead
- Timeout
-
This property is used in a blocking scenario. The client system times out after the specified amount of time.
You can optionally set a global web Service DSA call timeout property called
impact.server.dsainvoke.timeout
. The property must be added to the Netcool®/Impact server property file, <servername>_server.props. It is best to use the timeout property on a per policy basis as specified incallProps.Timeout
.The value is set in milliseconds, for example,
impact.server.dsainvoke.timeout=30000
(30 seconds).When you set the properties in any of the .props files, restart theNetcool/Impact server to implement the changes.
If the
impact.server.dsainvoke.timeout
property is set, all WSInvokeDL calls use the same timeout setting. - TrustCertificate
-
callProps.TrustCertificate=true;
- Username
-
Specifies the user name for basic authentication.
- WSTimeout
-
Example usage:
callProps.WSTimeout=60000;
- XMLFactory
-
true
, the function will use an internal XML library to generate the SOAP XML payload. This may be useful in resolving compatibility issues with the default XML library.Example usage:
callProps.XMLFactory=true;
Examples
callProps
must precede the actual
call to WSInvokeDL
.Apart from its primary
usage, the callProps
container can be used to enable
security. For example, if the basic authentication is enabled through
the wizard, the sample policy contains the following lines:
callProps.Username="username";
callProps.Password="password";
The following example
shows how to use the WSInvokeDL
function to send
a message to the target web service.
Example using IPL:
ServiceName = "StockQuote";
EndPointURL = "http://www.webservicex.net/stockquote.asmx";
MethodName = "GetQuote";
ParameterArray = { "IBM" };
callProps = NewObject();
Results = WSInvokeDL(WSService, WSEndPoint, WSMethod, WSParams, callProps);
Example using JavaScript:
ServiceName = "StockQuote";
EndPointURL = "http://www.webservicex.net/stockquote.asmx";
MethodName = "GetQuote";
ParameterArray = [ "IBM" ];
Results = WSInvokeDL(WSService, WSEndPoint, WSMethod, WSParams, [callProps])
Use the DecryptPassword policy parameter to enable the decryption of an
encrypted password in a policy that is used with the callProps
function:
callProps=NewObject();
callProps.Password="<Web Serice encrypted using nci_crypt>";
callProps.DecryptPassword=true;
//default is false and must be plain text password.
The password is decrypted at policy runtime and is used in plain text internally to Netcool/Impact.
Headers = NewObject();
Headers.HeaderName1='HeaderValue1';
Headers.HeaderName2='HeaderValue2';
callProps.CustomHeaders=Headers;
callProps=NewObject();
callProps.HandleFault=true;
When the default value is false, the policy throws an exception. When the value is true, the policy returns only the fault string message. No fault code is returned.
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<Fault>
<faultstring> some message here
</faultstring>
</Fault>
<serverName>_server.props
: impact.wsinvoke.formatfaultmessage=false
The
changes are implemented dynamically without restarting the server.