WSDL program

Make a project in Netbeans.Develop an Simple WSDL document in rpc/literal using NetBeans WSDL Designer

WSDL program

WSDL program

     

Project Requirement

Make a  project in Netbeans.Develop an Simple WSDL document in rpc/literal using NetBeans WSDL Designer.Create a operation for calculator named int add(int x, int y)
Solution

  • Develop  a web project
  • Take a WSDL file
  • Develop code for WSDL file

Create Project

  • Make a new web project
  • Give the project name as WSDL-project as given in below in Figure.1.

WSDL program

Figure. 1

  • Now select the server as the glassfish as give below in Figure. 2.

WSDL program

Figure. 2

Create WSDL file

  • Right-click on the project node WSDL-project -> New -> File/Folder
  • Then select xml. From xml tab select WSDL Document as given below in Figure.3.

WSDL program

   Figure.3

  • Give the file name  as WSDL1 for the WSDL-project. as given below in Figure.4.

WSDL program

    Figure.4

Click on the Browser Button and Select  the folder WSDL-project as given below in Figure5

WSDL program

     Figure.5

  • Now in figure below change the input and output part name as given below in Figure.6.

WSDL program
   
     Figure.6

  • Give the input Message part name as x   with element or Type as xsd:int
  • Give the input Message part name as y   with element or Type as xsd:int
  • Give the output Message part name as result  with element or Type as xsd:int

   As given below in Figure.7

WSDL program

   Figure.7

  • Now Click   on the Next
  • In the next step give Binding name as WSDL1Binding
  • Binding type as SOAP
  • Binding subtype as RPC Literal as shown below in Figure.8

WSDL program

      Figure.8

  • It  generates the WSDL  file as given in WSDL tab as shown below in Figure. 9.

WSDL program
     Figure. 9

  • In the source view click
  • You will  find source generated
WSDL1.wsdl

<?xml version="1.0" encoding="UTF-8"?>
<definitions name="WSDL1" targetNamespace="http://j2ee.netbeans.org/wsdl/WSDL1"
  xmlns="http://schemas.xmlsoap.org/wsdl/"
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://j2ee.netbeans.org/wsdl/WSDL1" xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
  <types/>
  <message name="addRequest">
  <part name="x" type="xsd:int"/>
  <part name="y" type="xsd:int"/>
  </message>
  <message name="addResponse">
  <part name="result" type="xsd:int"/>
  </message>
  <portType name="WSDL1PortType">
  <operation name="add">
  <input name="input1" message="tns:addRequest"/>
  <output name="output1" message="tns:addResponse"/>
  </operation>
  </portType>
  <binding name="WSDL1Binding" type="tns:WSDL1PortType">
  <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
  <operation name="add">
  <soap:operation/>
  <input name="input1">
  <soap:body use="literal" namespace="http://j2ee.netbeans.org/wsdl/WSDL1"/>
  </input>
  <output name="output1">
  <soap:body use="literal" namespace="http://j2ee.netbeans.org/wsdl/WSDL1"/>
  </output>
  </operation>
  </binding>
  <service name="WSDL1Service">
  <port name="WSDL1Port" binding="tns:WSDL1Binding">
  <soap:address location="http://localhost:${HttpDefaultPort}/WSDL1Service/WSDL1Port"/>
  </port>
  </service>
  <plnk:partnerLinkType name="WSDL1">
  <!-- A partner link type is automatically generated when a new port type is added. Partner link types are used by BPEL processes.
In a BPEL process, a partner link represents the interaction between the BPEL process and a partner service. Each partner link is associated with a partner link type.
A partner link type characterizes the conversational relationship between two services. The partner link type can have one or two roles.-->
  <plnk:role name="WSDL1PortTypeRole" portType="tns:WSDL1PortType"/>
  </plnk:partnerLinkType>
</definitions>

Download Code