Académique Documents
Professionnel Documents
Culture Documents
Solution
Copyright http://soatraining.hpage.com
Right click the Project1, and select New. Select All Items. Then enter WSDL in the top
left search box. It will show the following items.
Copyright http://soatraining.hpage.com
It opens a wizard dialog. Enter the value as follows
WSDL Name: Student
Directory Name: Remove public-html/web-inf etc. Place the WSDL directly under the
project file.
Target Namespace: Usually we give some URL here. So enter
http://soatraining.hpage.com/Student
Create Port Type Checkbox: Check it
Name: ProcessStudent
Service Style: Document (default)
Copyright http://soatraining.hpage.com
The design view is as follows
As you can see here, the wizard has created a porttype containing an operation named
NewOperation input and output messages as NewMessage and NewReturnMessage.
We would like to change these values.
Open the WSDL in source mode as its easy to modify it in this mode.
Change as follows
1 = StudentMessage
2 = StudentReturnMessage
3 = CreateStudent
4 = StudentMessage
5 = StudentReturnMessage
Copyright http://soatraining.hpage.com
Now, we need to define the structure of Student element. As of now, the in part is
defined as xsd:any, while we would like to have a student element here.
We would create the student definition in a separate xsd, and then import that xsd in
this wsdl document.
Creation of XSD
We explore the first one. JDeveloper has a feature that it can generate an xsd file from
an xml document. To use this feature, lets add an XML document to our project.
Right click Project 1 > All Items > Enter XML in the search text box and select XML
Document
Copyright http://soatraining.hpage.com
The xml file is added to the project
Copyright http://soatraining.hpage.com
JDeveloper opens the empty xml file
Now Right click Project 1 > All Items > Enter XML in the search text box and select XML
Document
Copyright http://soatraining.hpage.com
Directory: default
Target Namespace: http://soatraining.hpage.com/Student/types
XML Document, Browse: Select the sample xml file
Press OK.
In source mode
Copyright http://soatraining.hpage.com
The xsd looks fine. Note, JDeveloper has even intelligently given integer type to marks !.
If you need any modification, you can always do that now.
Now we would import this xsd in our wsdl. Open wsdl file and select the Schema tab
Open the property inspector too. If it is not visible, select it from View > Property
Inspector.
Right click <schema> node and select Insert inside schema > import
Copyright http://soatraining.hpage.com
In the source code things look like this
3. Select the import node and enter the following values in the Property inspector
Select the next to the schemaLocation > Select Edit
Copyright http://soatraining.hpage.com
Browse to select Student.xsd
Copyright http://soatraining.hpage.com
In source tab, it’s as follows, after all modifications
Now, we want to change the StudentMessage so that it takes a Student as input. This
can be done from the design view. Select the part- xsd-any in and modify the element
from the property inspector, choosing Student.
Copyright http://soatraining.hpage.com
This is coming because Student is in a different namespace
(http://soatraining.hpage.com/Student/types) than this WSDL document’s
targetNamespace (http://soatraining.hpage.com/Student). So the WSDL cannot find this
element.
Now modify the part as follows. Type “client:” in front of Student. It will show a popup.
You can select the client:Student.
The return is a simple string. So we can use the string datatype from XSD standard.
Modify the part name return as follows
Copyright http://soatraining.hpage.com
This completes the definition of the WSDL. Note, this WSDL is called Abstract WSDL as
it does not yet have bindings and service elements. These get usually added by the tools
(such as jdeveloper) during compilation.
Copyright http://soatraining.hpage.com