> #### 6.7.2 Web Services Java Action

> This Java Action is used to call a Web Service from Interstage BPM.

> To call a Web Service using a Java Action:

> 1. Follow the instructions in the Assigning Java Actions section. Expand the Integration Actions folder. Then, double-click the Web Service Call icon.

> The Action editor - WebServices dialog box appears.

> 2. Enter a name for your JavaAction in the Action name field, identifying notes in the Notes field (optional), and either enter WSDL URL in the WSDL Location field manually or click the Browse button and select a WSDL from the UDDI Registry. If you know the WSDL and enter it manually, you can skip Steps 3-6.

> Note: A UDDI Registry must be available to Interstage BPM to be able to successfully use the Search UDDI Registry dialog box (which appears when you click the Browse button in Step 2. Any registry that is compliant to the UDDI Specification is acceptable. To perform Steps 3-6, you must have a local UDDI Registry configured for use with Interstage BPM. For instructions in setting up a local UDDI Registry to use with Interstage BPM, see the Interstage BPM Administration and Installation Guide for the Advanced Edition.

> The action displayed in the following figure calls the Interstage BPM Web Service. In the later steps of these instructions, this action performs the getTemplateState operation of the BPM Web Service. It gets the state of the BPM process definition with the ID specified by TemplateID. The WSDL to enter manually for this example is as follows:

> http://localhost:49950/iflowws/services/IFWebServices?wsdl

> This WSDL will work whether you have a UDDI-compliant Registry configured or not.

> Note: If you want to call a Web Service that is external to your Intranet environment and you access the Internet through a Proxy Server, you must configure Interstage BPM to use the Proxy Server by setting your Proxy Server Parameters in the ibpm.properties file. You must configure your Proxy Server in this case to be able to connect to the external Web Service. For more information, see the WSHttpProxyHost parameter in the Interstage Business Process Manager Administration Guide.

> Figure 87: Action Editor (General Tab) - WebServices

> 3. Clicking the Browse button opens the Search UDDI Registry dialog box. If a compliant UDDI Registry is configured on your system, you can search for and select a Web Service based on the services, providers and tModels criteria defined there. The example shows the WSDL of the Interstage BPM Web Service that is published to a local UDDI Registry. This WSDL can be displayed by entering a percentage character (%) in the Search field, clicking the Search button, and then clicking IFWebServicesService in the Service list. The BPM Web Services example continues in Step 6. If you want more information on how to use the Search UDDI Registry dialog box, continue on to Step 4.

> Note: The Interstage BPM Web Service is published to a local UDDI Registry by synchronizing Interstage BPM with the UDDI Registry. This is an administrative function that must be performed by an Interstage BPM Administrator using the Administration Facility. See the Interstage BPM Administration and Installation Guide for details.

> Figure 88: Search UDDI Registry Dialog Box

> 4. Use the UDDI Query Server drop-down list box to enter the URL of the UDDI server you wish to query. Multiple server locations can be configured for use in this drop-down list box. To configure multiple server locations, see the instructions listed under the UddiInquiryURL parameter in Appendix B of the Administration and Installation Guide for your particular version of Interstage BPM.

> Use the guidelines in the table below to complete the remainder of the Search UDDI Registry dialog box.

> 5. Use any of the three tabbed areas-Services, Providers, or tModels-to specify specific search criteria for locating published services. Follow the guidelines in the table below when completing the fields in the tabbed areas.

> Section | Field Name | Description
> UDDI Query Server | UDDI Query Server | The URL of the UDDI registry that you wish to search. The local UDDI registry configured in Interstage BPM is available by default. IBM, Microsoft, and IMR UDDI Registries can also be used.
> Services tab | Service Name | Select or type a service name for which you would like to search, and then click Search. The Service Name drop-down list box remembers up to five previous searches that you have performed. When entering a value in the Service Name field, you may use the percent symbol (%) as a wildcard character to represent any character or set of characters. Note: Searches are case-sensitive.
> | Result | Displays the results of service name searches.
> | WSDL URL | Displays the URL of the service name selected in the Result table.
> | Type | Displays the type of service-document or RPC-selected in the Result table.
> | Description | Displays a description of the service name selected in the Result table.
> Providers tab | Provider Name | Select or type a provider that offers one or more web services, and then click Search. A provider represents the parent entity under which all contact and service information is stored and organized. The Provider Name drop-down list box remembers provider names that you have entered previously. When entering a value in the Provider Name field, you may use the percent symbol (%) as a wildcard character to represent any character or set of characters. Note: Searches are case-sensitive.
> | Result | Displays all of the services published by the provider.
> | WSDL URL | Displays the URL of the service name selected in the Result table.
> | Type | Displays the type of service-document or RPC-selected in the Result table.
> | Description | Displays a description of the service name selected in the Result table.
> tModels tab | tModel Name | Select or type a tModel name associated with one or more web services, and then click Search. The tModel Name drop-down list box remembers tModel names that you have entered previously. When entering a value in the tModel Name field, you may use the percent symbol (%) as a wildcard character to represent any character or set of characters. Note: Searches are case-sensitive.
> | Result | Displays all of the services that match the tModel name entered.
> | WSDL URL | Displays the URL of the service name selected in the Result table.
> | Type | Displays the type of service-document or RPC-selected in the Result table.
> | Description | Displays a description of the service name selected in the Result table.

> 6. Once you have found the Web Service that you want to use in your JavaAction, make sure that the URL of the Web Service's WSDL appears in the WSDL URL field. Then, click OK. This returns the WSDL of the selected Web Service to your JavaAction Editor. If you are following the example, the Action Editor dialog box should be identical to the one displayed in Figure 82.

> 7. Click the Operations tab on the JavaAction Editor and select an operation from the list of operations that are available on the given service and port. The getTemplateList Operation, selected in the example, will be used in the remaining steps of these instructions.

> Figure 89: Web Services Action Editor Operations Tab

> 8. Click the Input tab on the JavaAction Editor.

> A table that can be used for mapping SOAP Request Message XPath expressions to user-defined attribute (process variable) values appears. To be able to map these XPath expressions, you must have previously defined user-defined attributes (UDAs) on the process definition to which you are adding this JavaAction.

> Figure 90: Web Services Action Editor Input Tab

> A SOAP Request message for the operation that was selected in the previous step will be automatically generated. Add special tags (explained below) that will be used to transfer real data from the referenced Interstage BPM UDAs. In the example (below), the value of the CodeUDA UDA will be substituted for the highlighted field.

> {{Field codeUda}} : The value of the UDA will be substituted and will be encoded in the Request message. See Figure 5.
> {{xml xmlUDA1}} : The value of the UDA (which will be a XML) will be substituted and will not be encoded in the Request message. See Figure 6.
> {{js expression1}} : The Result of the Evaluated expression will be substituted and will be encoded in the Request Message. See Figure 7.
> {{JsXml uda.xmlUDA1 + uda.xmlUDA2}}: The Result of the Evaluated expression will be substituted and will not be encoded in the Request Message. See Figure 8.

> In some cases there might be some other application that will construct the soap request message. So in that case user can supply the UDA name for the SOAP request message.

> Clicking on the "Pick Soap message from UDA" will disable the Soap request message text area and if the user needs to use the UI generated SOAP request Message then the user has to uncheck the checkbox.

> The following figure shows the actual SOAP message with the UDA values described in the previous figure mapped into it.

> Figure 91: Input Tab: SOAP Response Message

> 9. Click the Output tab on the JavaAction Editor and define Xpath expressions for use in mapping the SOAP Response message to UDAs.

> Click Add to add a new row for XPATH expression.

> Click Remove to removes the selected XPATH expression.

> The following XPath expression is mapped to the UDA named ResponseMsg in the figure below:

> /soapenv:Envelope/soapenv:Body/*[namespace-uri()='http://www.fsw.fujitsu.com' and local-name()='getTemplateStateResponse']/*[namespace-uri()='http://www.fsw.fujitsu.com' and local-name()='getTemplateStateReturn']/text()

> This XPath expression represents the contents of the getTemplateStateReturn tag.

> Figure 92: Web Services Action Editor Output Tab

> 10. You can test real values in your Web Service JavaAction by adding them directly to the request message, clicking the Test tab, then the Test button. To test real values in your Web Service JavaAction:

> 1. Change the variable and expression tags in the SOAP Request Message (XML) view of the Input tab. There are four types of variable and expression tags that appear in the XML View under the Input tab.
>    The figures below show before and after illustrations where the {{Field UDA}} tags have been replaced by actual UDA values. iflow replaces {{Field username}}. iflow replaces {{Field password}}. 11 replaces {{Field TemplateID}}. After testing, you can restore the SOAP Request Message to its original condition by right-clicking the value and selecting the original expression.
>    On the system where this was created, I knew that the process definition with an ID of 11 is in the published state.

> Figure 93: Input Tab XML View (Before)

> Figure 94: Input Tab XML View (After)
> 1. Click the Test tab, then the Test button displayed on the Test pane. The example shows the Test pane with the Response SOAP message that resulted when these values were tested.

> Figure 95: Response SOAP Message from Test
> 1. The state of the process definition with an ID of 11 is highlighted. From this response message, you can better determine the XPath expression that you need to use to populate your response UDA with the template state. Note that this response SOAP message corresponds to the XPath expression used in Step 9.

> 11. Click OK to close the Web Services JavaAction Editor.

> 12. Click OK to close the properties dialog box.

> Your Web Services Java Action is now assigned to the process definition.

Business Process Manager Help-Fujitsu Computer Systems Corporation Interstage Website Voice: (888) 248-9273 Interstage BPM Information