Lets assume we have a WSDL file called as AreaService.wsdl
1:- AreaService.wsdl
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://tempuri.org/AreaService/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="AreaService" targetNamespace="http://tempuri.org/AreaService/">
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/AreaService/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="area" type="xsd:float"/>
<xsd:element name="parameters" type="tns:dimensions"/>
<xsd:complexType name="dimensions">
<xsd:sequence>
<xsd:element name="width" type="xsd:float"></xsd:element>
<xsd:element name="height" type="xsd:float"></xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="CalculateRectAreaResponse">
<wsdl:part element="tns:area" name="area"/>
</wsdl:message>
<wsdl:message name="CalculateRectAreaRequest">
<wsdl:part element="tns:parameters" name="parameters"/>
</wsdl:message>
<wsdl:portType name="AreaService">
<wsdl:operation name="CalculateRectArea">
<wsdl:input message="tns:CalculateRectAreaRequest"/>
<wsdl:output message="tns:CalculateRectAreaResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="AreaServiceSOAP" type="tns:AreaService">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="CalculateRectArea">
<soap:operation soapAction="http://tempuri.org/AreaService/NewOperation"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="AreaService">
<wsdl:port binding="tns:AreaServiceSOAP" name="AreaServiceSOAP">
<soap:address location="http://tempuri.org"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Follow below given step to expose this wsdl file as SOAP W/S using Apache Axis2.
Make sure you have WTP and Axis plug in Eclipse and also have Axis2 set up in your machine.
1- Create Dynamic Project
Click on Modify and select Axis2
Click save and next
Click on Finish Button.
Now create new folder wsdl as shown below
and click finish button.
Copy your wsdl in this wsdl folder
Now lets exposed this wsdl as webservice using following steps given below
Right Click on WSDL file --> Other --> Web Service--> Web Service
Click on web service runtime:Apache Axis2
Click on start server button and wait for server to start
Now modify the response of the code generated from the wsdl so that we can get the desired output in this case we have file called AreaServiceSkeleton.java
Area objArea = new Area();
objArea.setArea(parameters.getParameters().getHeight()*parameters.getParameters().getWidth());
return objArea;
//throw new java.lang.UnsupportedOperationException("Please implement " + this.getClass().getName() + "#calculateRectArea");
Now deploy the applicaiton on the server i.e. right click the project and select run as and tomcat and next and deploy
Now lets check our WSDL files exposed using this url
Click on service
Now if you hover your mouser cursor on AreaService you will get the WSDL url copy it
http://localhost:8181/SiddhuExposedWsdl/services/AreaService?wsdl
We will use this to check if the service is working or not. To test the SOAP WS we are using SOAP UI tool
1:- AreaService.wsdl
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://tempuri.org/AreaService/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="AreaService" targetNamespace="http://tempuri.org/AreaService/">
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/AreaService/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="area" type="xsd:float"/>
<xsd:element name="parameters" type="tns:dimensions"/>
<xsd:complexType name="dimensions">
<xsd:sequence>
<xsd:element name="width" type="xsd:float"></xsd:element>
<xsd:element name="height" type="xsd:float"></xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="CalculateRectAreaResponse">
<wsdl:part element="tns:area" name="area"/>
</wsdl:message>
<wsdl:message name="CalculateRectAreaRequest">
<wsdl:part element="tns:parameters" name="parameters"/>
</wsdl:message>
<wsdl:portType name="AreaService">
<wsdl:operation name="CalculateRectArea">
<wsdl:input message="tns:CalculateRectAreaRequest"/>
<wsdl:output message="tns:CalculateRectAreaResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="AreaServiceSOAP" type="tns:AreaService">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="CalculateRectArea">
<soap:operation soapAction="http://tempuri.org/AreaService/NewOperation"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="AreaService">
<wsdl:port binding="tns:AreaServiceSOAP" name="AreaServiceSOAP">
<soap:address location="http://tempuri.org"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Follow below given step to expose this wsdl file as SOAP W/S using Apache Axis2.
Make sure you have WTP and Axis plug in Eclipse and also have Axis2 set up in your machine.
1- Create Dynamic Project
Click on Modify and select Axis2
Click save and next
Click on Finish Button.
Now create new folder wsdl as shown below
and click finish button.
Copy your wsdl in this wsdl folder
Now lets exposed this wsdl as webservice using following steps given below
Right Click on WSDL file --> Other --> Web Service--> Web Service
Click on web service runtime:Apache Axis2
Click on start server button and wait for server to start
Now modify the response of the code generated from the wsdl so that we can get the desired output in this case we have file called AreaServiceSkeleton.java
Area objArea = new Area();
objArea.setArea(parameters.getParameters().getHeight()*parameters.getParameters().getWidth());
return objArea;
//throw new java.lang.UnsupportedOperationException("Please implement " + this.getClass().getName() + "#calculateRectArea");
Now deploy the applicaiton on the server i.e. right click the project and select run as and tomcat and next and deploy
Now lets check our WSDL files exposed using this url
Click on service
Now if you hover your mouser cursor on AreaService you will get the WSDL url copy it
http://localhost:8181/SiddhuExposedWsdl/services/AreaService?wsdl
We will use this to check if the service is working or not. To test the SOAP WS we are using SOAP UI tool