1 / 93

Developing, Deploying and Managing Web Services Using JDeveloper and Oracle Application Server

Learn how to develop, deploy, and manage web services using JDeveloper and Oracle Application Server. This tutorial will guide you through the process step-by-step.

aallen
Télécharger la présentation

Developing, Deploying and Managing Web Services Using JDeveloper and Oracle Application Server

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Developing, Deploying and Managing Web Services Using JDeveloper and Oracle Application Server Nisha Stephen CIS764 – Enterprise Databases Kansas State University

  2. Before starting this tutorial, you should have the following prerequisites:1) Have installed the JDeveloper 10g (10.1.3).2) Have started JDeveloper by double-clicking <JDEV_HOME>\jdeveloper.exe. If you receive a message asking if you want to migrate from a previous version, click No.

  3. Start Oracle Application Server Containers for J2EE (OC4J) by double-clicking <JDEV_HOME>\jdev\bin\start_oc4j.bat.

  4. When prompted for a password, enter welcome1.

  5. Watch the resulting command window and wait until you see the message 'Oracle Containers for J2EE 10g (10.1.3.0.0) initialized'. Then you can minimize the window, but do not close it.

  6. Creating the Java ClassJDeveloper enables you to use an existing web service or to create one with Java or PL/SQL.In this tutorial tutorial,you create a web service that is based on a Java class.In the Application Navigator, right-click the Applications node and select New Application from the context menu.

  7. Click Next when the “Create Application Server Connection” page is displayed

  8. Enter the Connection Name as oc4jconn and click Next

  9. In the Authentication step, Enter the username as oc4jadmin and the password as welcome1

  10. Click Next in the Connection page

  11. Click Test Connection to get a success in the Status box. Click Next

  12. Click the Finish Button to complete the Server Connection

  13. The connection has been established and we get a oc4jconn Application Server

  14. Click the Application Navigator and right click the New Application

  15. Enter the Application Name as JavaWebService and select No Template[All Technologies] and click Next

  16. Now Enter the Project name as GetDates and click OK

  17. Right-Click the GetDates and select New

  18. From the Catagories, select General and from Items select Java Classand click OK

  19. Enter the Name as GetDates and the Package as datespackage and click OK

  20. In the editor, create a method getDate() that uses java.util.Calendar to return the date and time.public Calendar getDate() { return Calendar.getInstance(); }

  21. Because the code refers to a class that is not yet available to this package, you are prompted to import the class. Press [Alt]+[Enter] to import the suggested class java.util.Calendar

  22. In the editor, create a second method getDateHence() that uses java.util.GregorianCalendar to add a user-defined number of days, specified as the int parameter daysHence, to today's date. Add the following code below the getDate() method. public Calendar getDateHence( int daysHence) { GregorianCalendar myCalendar = new GregorianCalendar();  myCalendar.add(GregorianCalendar.DATE, daysHence);  return myCalendar; }

  23. Pressing [Alt]+[Enter] when prompted will import java.util.GregorianCalendar:

  24. Click the Make Button or (Ctrl+F9)

  25. The log should show successful compilation. In the Message- Log editor

  26. Creating a Web Service on the Java Class.Right-click the GetDates project and select New from the context menu

  27. Click the Bussiness Tier in the Catagories to expand it and click on the Web Services option. On the right side click on the Java Web Service and click OK

  28. Select the J2EE 1.4(JAX+RCP) WebService option and click OK

  29. Click the Next Button

  30. Enter GetDatesWS for the Web Service Name. Select datespackage.GetDates from the Component To Publish dropdown list. Select the Generate annotations into class check box. Click Next.

  31. On the Message Format page of the wizard, click Next.

  32. On the Specify Custom DataType Serializers page of the wizard, click Next.

  33. On the Methods page of the wizard, select the check boxes next to both methods from the Available Methods list and click Finish.

  34. The design that is created

  35. Also the source code in XML is generated.

  36. Scroll to the bottom of the WSDL file and copy the URL defined in the soap:address node.

  37. If the file is still open, click the GetDates.java tab at the top of the editor, or reopen the GetDates.java file by double-clicking it in the Application Navigator: (JavaWebService > GetDates > Application Sources > datespackage > GetDates.java).

  38. Click Save All to save your work.

  39. Exploring the WSDL EditorIf the file is still open, click the GetDatesWS.wsdl tab at the top of the editor, or reopen the GetDatesWS.wsdl file by double-clicking it in the Application Navigator: (JavaWebService > GetDates > Web Content > WEB-INF\wsdl > GetDatesWS.wsdl). Click the Design tab at the bottom of the editor to view the visual editor. In the Services column, select the GetDatesWSSoapHttpPort node.

  40. In the Bindings column, select the getDate node.

  41. Expand the getDateHence binding node, and select the input node.

  42. Observe how the GetDatesWS_getDateHence message is connected to getDateHence operation which is in turn connected to the input node of the getDateHence binding

  43. The getDateHence operation would be in turn connected to the input node of the getDateHence binding.

  44. Deploying and Testing the Web Service In the Application Navigator, expand the Resources node. Right-click WebServices.deploy, and select Deploy to > oc4jconn from the context menu.

  45. In the Configure Application dialog, click OK.

  46. The log window should show successful deployment.

More Related