20 February 2016

OU Webservices Excercises Module 13: JAX-WS only

 Exercise 13-1

  1. Generate SSL artefacts
    • Edit certgen.bat (do not double click). Adapt the paths at the top of the file to reflect the correct paths on your machine.
      • The individual steps that are executed by the script are explained in Practice A-2
    • Run the script from the command line
  2. Configure WebLogic for WS-Security
    • Edit sslconfig.bat (do not double click). Adapt the paths at the top of the file to reflect the correct paths on your machine.
    • Edit sslconfig.py.  Adapt the paths at the top of the file to reflect the correct paths on your machine.
      • The script uses the WebLogic Scripting Tool (WLST). The  same procedure using the administration Console is explained in Practice A-3. 
    • If WebLogic is not running, start it.
    • run sslconfig.bat from the command line 
    • The script stops WebLogic. Start it again afterwards.
    • Connect to the WebLogic Admin Console over SSL, using URL https://localhost:7002/console
      • The browser warns you because it does not know the certificate authority
        •  Verify the certificate
        • Approve the connection
  3. Open theCardDecksWS project
  4. If you did not enable JAX-WS HTTP dumping in Excercise 5-7, do it now.
  5. Add a new library to NetBeans using Tools> Ant Libraries
    • Create a new library
      • Name: WebLogic Web Services API
      • Type:  Server Libraries
    • Press Add JAR/Folder, browse to the WebLogic folder and add modules/ws.api_2.0.0.0.jar
    • Click OK   
  6. Add the "WebLogic Web Services API" library to the CardDecksWS project
  7. View the policy file you will use
    • Expand Libraries> Oracle WebLogic Server> weblogic.jar> weblogic.wsee.policy.runtime
    • Double click Wssp1.2-2007-Wss1.1-UsernameToken-Plain-X509-Basic256.xml 
    • Examine the file
    • Close the file
  8. Open ejbs.CardDeckSessionBean.java
  9. Annotate the class with @Policy to 
    • use the policy you have just viewed 
    • add it to the WSDL
  10. Using the @Policies and   @Policy annotation on every method indicate that
    • webservice calls should be signed
    • webservice calls should be encrypted
    •  this should be added to the WSDL
  11. Correct any errors and save
  12. View the WSDL at http://localhost:7001/CardDeckSessionBean/CardDeckSessionBeanService?wsdl
    •  Notice the wsp1_2:Policy elements that have been added
  13. Open the GenericCardGameWS project in NetBeans
  14. Open games.CardGameService
  15. After the creation of the port in the createCardGame method, add code to use WS-Security, as shown in slides 13-17 to 13-19
  16. Refresh the JAX-WS artefacts and cached WSDL
    • In the Web Service References Node, right click the CardDeckSessionBeanService and choose Refresh
    • Select the checkbox to also replace the WSDL
    • Click Yes
  17. Correct any errors and save
    •  Clear the WebLogic Server Output window (right click>clear)
  18. Open the Weblogic Test Client at http://localhost:7001/wls_utc
  19. Enter WSDL http://localhost:7001/GenericCardGameWS/CardGameService?wsdl
    • Create a cardGame with 1 deck and 2 jokers
    • Inspect the SOAP messages
      • View the Oracle WebLogic Server output window in NetBeans
      • Compare the calls to Try to see the difference between the calls to 
        • CardGameService
        • CardDeckSessionBeanService

 Exercise 13-2

  1. Check the time between the first and last message in a call in the previous exercise
  2. In the CardGameService class, modify the usage of the CarDeckSessionBeanService. Apply the same kind of optimisations on the service as in step 2 in the activity guide.
  3. Apply the same kind of optimisations on the CarDeckSessionBean port as in step 3 in the activity guide
  4. Correct errors and save. 
  5. Check the time again between the calls when creating a card game.

No comments:

Post a Comment