This section demonstrates capability of WSStub and WSConsumer (4.0) to send/receive secured SOAP messages using UsernameToken Web Service Security action.
Scenario
Expose a simple Web Service using WSStub. Using UsernameToken WS-Security mechanism, configure the WSStub component to ascertain the identity of sender (WebserviceConsumer 4.0) of SOAP requests. Similarly, using UsernameToken mechanism, configure the WebserviceConsumer component to check the identity of sender (WSStub) of SOAP responses.
Password Callback Class is required for the UsernameToken security function to specify password for username as well as for private keys in keystore. Private keys will be used to sign and/or decrypt a message. To specify password, an implementation of javax.security.auth.callback.CallbackHandler is needed. A fully qualified class name of this implementation should be provided in CPS.
When WSStub receives a message secured by UsernameToken, it will verify the username and password. To verify, UsernameToken action must be enabled in WSStub Configuration Property Sheet (CPS). To configure WSStub component, perform the following action in eStudio:
Add a new Event Process with name 'WSSecurity_Example'.
Drag the WSStub component from the WebService category in the Micro Service Palette to the Fiorano Orchestrator.
Figure 1: Adding WSStub component to Fiorano Orchestrator
Double-click the WSStub component in the orchestrator to open Configuration Property Sheet (CPS).
In the Configuration screen, click WSDL Configuration button
Figure 2: WSDL Configuration
In the WSDL Configuration dialog box, select Auto_created_Operataion present in the left pane to enable input (request) and output (response).
Figure 3: Selecting Auto_created_Operation
Under Input tab, perform the below actions:
Click Add button to add Name 'PartName1'.
Click the Ellipsis button to open Select Type/Element dialog box. Select string option to configure the WSStub component to send a string message and then click OK.
Figure 4: Adding Input attributes under Auto_created_Opretaion
Perform the same actions (as performed under Input tab) under Output tab to add a part 'PartName1' and 'string' under Name and Type/Element respectively and click OK in the WSDL Configuration dialog box.
Fiorano Mapper will be used to configure Route Transformation between Input and Output. This is explained in Configuring Route Transformation section.
Click Next to navigate to Security Configuration screen. Under WS-Security Configuration section, click WS-Security button to configure WS-Security settings.
Figure 5: Security Configuration
In the Request WS-Security tab, perform the following actions:
Under Security Actions section, select Username Token check box.
If the class hav a package, then provide absolute class, that is, if the password Callback Class name is 'PWCallback' in packagecom.wsSecurity package, then absolute class name is 'com.wsSecurity.PWCallback'. This class will provide the necessary password which will then be added along with the User in Security Header of the message.
Figure 6: Security settings in Request WS-Security
Other actions such as the following can also be used:
A Timestamp value can be added to Request/Response to carry Created and Expires values indicating when a request or response is created and when it will expire. While adding timestamp to security header, Created element will have current time in GMT and Expires element will have current time + time to live in GMT.
Signature configuration is similar to that of Encryption. Here, client should have a keystore which has its own private key and server should have a keystore with client’s public key in it.
When more than one action is chosen, the order of actions can be managed by selecting the action and using the scroll buttons on the right side.
In Response WS-Security tab, select Username Token check box under Security Actions section to enable Username Token security action and then provide the following values:
User: Username that has to be used in Username token security function.
Password Type: Provide 'PasswordText' for a plain text password to be sent in the message (as a Password Callback class is provided). If a password is not required, provide 'PasswordNone'.
Figure 7: Security settings in Response WS-Security
Click OK to save WS-Security settings and click Finish to save WSStub component configuration.
In the three ports that get generated after WSStub configuration, connect the output port 'REQUEST' to the input port 'RESPONSE'.
Figure 8: Connecting WSStub output port to input port
Configuring Route Transformation
To configure transformation between input and output port, perform the following actions in the Fiorano Orchestrator:
Right-click route1, point to Configure Transformation and select Mapper Project to open Fiorano Mapper editor.
Figure 9: Opening Mapper Project editor
In the Output Structures panel in Mapper Project, click PartName1 element as it appears in Funclet View.
Figure 10: Adding PartName1 to Funclet View
In the Funclet View panel, drag the function element Constant to the Funclet easel and double-click it to change the name to 'Secure_ACK' to give a logical meaning to the scenario (acknowledgement message of secured message received).
Figure 11: Adding Constant and renaming it
Connect the Source node of the constant 'Secure_ACK' to the destination node of PartName1.
Figure 12: Connecting the Constant with PartName1
Click Save icon (or File >Save) to save the transformation configuration and close the Mapper Project editor.
Launching Web Service
To launch the webservice, perform the following actions:
Click Check Resource and Connectivity icon (or press ALT+SHIFT+C) to check resource and connectivity.
Click Run Event Process icon (ALT+SHIFT+R).
Right-click WSStub component and click Copy WSDL URL to copy the URL to clipboard, which is used in the next section.
Figure 13: Copying WSDL URL to clipboard
Configuring WebSeriveConsumer component
Setting up the Security Configurations in WebServiceConsumer component, corresponding to the WSStub security configurations, is essential to access the webservice. To configure the component, perform the following actions:
Drag the WebserviceConsumer component from the WebService category in the Micro Service Palette to the Fiorano Orchestrator.
Figure 14: Adding WebServiceConsumer to Orchestrator
Double-click the WebserviceConsumer component in the orchestrator to open Configuration Property Sheet (CPS).
In the Managed Connection Factory, click WSDL Ellipsis button. In Wsdl dialog box, paste the copied WSDL URL in the URL text field and click OK.
Figure 15: Pasting the copied WSDL URL
Click Next. In the Interaction Configurations page, click WebService Operation Ellipsis button and select the operation with prefix 'Auto_created_Operation' from OperationName dialog box. Click OK to configure Web Service Security settings.
Figure 16: Selecting Auto created operation
To verify username and password, UsernameToken action must be enabled in WSConsumer too (as configured in WSStud). So, scroll down the screen and provide the following values under Security – Request section:
UsernameToken WS-Security (Request): Select this check box to enable adding of the respective action to security header.
User, Password Callback class (Request) and Password type: Same values as used in Response WS-Security section mentioned in theWSStub Configuration section, that is, fiorano, PWCallback and PasswordText respectively.
Specify Order of UsernameToken (Request) when more actions are enabled.
Figure 17: Security Request settings
Scroll further down the screen and provide the following values under Security – Response section:
Password Callback Class (Response): Same value as used in Password Callback class (Request) section above, that is, PWCallback .
Select Is Password Required checkbox.
Figure 18: Security Response settings
Click Finish in the Interaction Configurations panel to save WebServiceConsumer component configuration.
Composing the Event Process and Configuring Feeder component
Drag a Feeder component and Display component from Util category in the Micro Service Palette to the WSSecurity_Example Fiorano Orchestrator.
Connect the components in the below manner:
Feeder output port to WebServiceConsumer input port.
WebServiceConsumer output port to Display input port.
Figure 19: Connecting Feeder and Display to WebServiceConsumer component
Double-click Feeder component and perform the following actions to configure it:
In the Message Type Configuration page, retain Output Message Format option as 'XML' and click the Connected Port Schemas button.
In the Connected ports dialog box, select IN_PORT to enable connection between output port of Feeder and input port of WebServiceConsumer component. Click OK and then click Next.
Schema appears in the Message Type Configuration panel after connecting the ports in the Connected ports pop-up window.
Figure 20: Enabling connection between input and output ports
In the Message Details Configuration page, click the Generate Sample button to load sample input.
Under No.of Repeatable elements to be generated section in the XSD Sample Generation Dialog window, replace max value '3' with '1' so that only one output is generated, and click OK.
Figure 21: Reducing maximum number of output to '1'
Click Finish to save Feeder configuration.
Figure 22: Loading Sample Input
Running the Example
To run the example, perform the following actions in the WSSecurity_Example event process:
Click Synchronize Event Process icon to apply the modifications made to the event process that is already running. Two windows get opened for Feeder and Display components.
In the Feeder, click the Send button to send the message "Input".
Figure 23: Sending message from Feeder
In the Display window, click the second tab () at the lower-left part of the window. UsernameToken header indicates that Username Token security action is enabled on response in WSStub with the username and password configured and that WebserviceConsumer authenticates using values provided under Security-Response. PartName1 'SecureACK' can also be found.
Figure 24: Message received in Display with the UsernameToken header and PartName1
Reference
Please note that the component options used in this example are specific to WS-Security. To explore other options present in WSStub and WebServiceConsumer components, refer the sections WSStub and WebServiceConsumer4.0 respectively.
JavaScript errors detected
Please note, these errors can depend on your browser setup.
If this problem persists, please contact our support.