In this third part of getting started with SOA Suite 11g we will continue the example that we started in part two by introducing a Web Service binding to our project.
Main Theme
Start by opening the EmployeeInquirer project in JDeveloper. Prior to creating the Web Service binding for our project, the necessary XML schema definition (XSD) file describing the web service request, reply and error must be constructed. We will create a new XSD file by selecting File | New... and XML Schema from the General | XML category of the New Gallery dialog.
In the Create XML Schema dialog enter the schema File Name and Target Namespace as it is shown below and click OK.
JDeveloper will proceed with creating the XSD file and it will open it in the Design editor:
The first thing we will do is rename the exampleElement generated by default to employeeInfoRequest. You can do this by selecting the element in the Design editor and changing its name attribute in the Property Inspector. If the Property Inspector is not shown, select View | Property Inspector from the menu to display it.
Next, right-click on the employeeInfoRequest element and select Insert inside element | sequence to create a xsd:sequence.
Similarly right-click on the newly created sequence and select Insert inside sequence | element to create the employee's id element for the request.
Select the newly created element and change its name to EmployeeId and its type to xsd:string in the Property Inspector.
Now let's create two more XSD elements: one for the web service reply and another to store an error message. Your final XSD should look like this:
Now we are ready to create the web service binding. Switch to the composite Design, grab the Web Service icon from the Component Palette and drop it on the Exposed Services of the design canvas. This will initiate the Create Web Service wizard.
Enter getEmployeeInfoById for the name of the web service and click the gear icon next to the WSDL URL edit box to generate the web service WSDL. This will bring up the Create WSDL dialog where we will specify the web service message schemas.
With the Request tab selected, click on the magnifying glass icon next to the URL edit field and browse for the XSD file that you created earlier. In the Type Chooser dialog that is presented, expand the Project Schema Files and the EmployeeInquirer.xsd nodes and select employeeInfoRequest.
Repeat for the Reply and Fault tabs of the Create WSDL dialog selecting employeeInfoReply and employeeInfoError respectively. When done click OK on the Create WSDL dialog. The Create Web Service dialog should look like this:
Finally click OK on the Create Web Service dialog to complete the creation of the web service. The composite should now look as it is shown below with the getEmployeeInfoById web service shown on the Exposed Services part of the design canvas.
This concludes the creation of the Web Service binding.
Conclusion
In this part we created a Web Service binding for our EmployeeInquirer composite. We will complete and test the composite in the next part by wiring the web service to the Database Adapter that we developed previously using a Mediator component.
Until the next time keep on JDeveloping!
No comments:
Post a Comment