We will be using JDeveloper IDE to create a WSDL document.
OPen Jdeveloper and create a new application.
Create a project
NOw select the project and right click on it to create a new project.Choose business tier ,web services and then WSDL document as shown below.
Give some name to the WSDL document
NOw select the wsdl document and navigate to the structure tab select types and create a new type.Now select the types right click on it and add inside the type an XSD schema as shown below.
choose the XSD option in the new gui
now go to your wsdl service switch to the source tab and replace
with following
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"/>
This is just to add the namespace for the SOAP message and the target message.
so now your wsdl document should look like this
NOw select the schema you have created and insert inside the schema elements.
Provide the element name
provide the type of the element as string
SO overall your message structure in wsdl source should look like this
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
NOw Click on Message in the structure tab now and create a new message
now select the message created and input a part in to it.
Similarly create messages getOutput of type ouput and getFault of type error.
so now your screen should look like this.
NOw we have defined our message type the next task is to define the port.Port defines the signature of a method which includes the operation and the messages that the method use.
Right click on port types and create a port type
now insert an operation in the port type
Now check in the design tab the wsdl document you will get the input output and the negative value mapped against corresponding messages
The next part in creating the service interface is defining the bindings. You bind the Port Type to a specific protocol (HTTP) and data format (SOAP).
In the Structure window, right-click Bindings and insert a new binding.
so now the screen should look something like this
Now check your wsdl document in source tab you will get an entry like this for the negative value
The parts used for the Negative value should be getError that we have defined for the error so just change it to following,Also it should be a part of fault so it should be changed to following
Now the design should show
Now the Final step is to create service definition. This definition includes the port that specifies the binding that a particular implementer is going to implement and possibly the server where the service will run.
Right click on service and create a new service
Now insert a port inside the service
Now the screen should look like
Now select the port and insert inside the port soap address
Provide any arbitrary as for now we are not sure where exactly our application will run.
Now just validate your WSDL
save all your work and you are done with the creation of wsdl
No comments:
Post a Comment