Convert SOPA webservice to REST style in AXIS2

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Convert SOPA webservice to REST style in AXIS2

sunilragidi
Hi,
I have a webservice, which is SOAP based. I want to convert it to REST based in AXIS2 itself. I have gone thru lot of websites but ended up with nothing. I should not go with JERSEY.

If we change the SOAP binding to HTTP Binding, Will it become REST based..?
If so, How can I pass the input to the REST service. My webservice takes a huge XML document as input. How can I provide the XML input(complex object) to the REST service...?

Can anyone provide a detailed solution in achieving this...?

I can provide my WSDL of SOAP Webservice.


<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:tns="http://www.abc.com/interfaces/XYZ.wsdl"
    targetNamespace="http://www.abc.com/interfaces/XYZ.wsdl"

    xmlns:r0="http://www.abc.com/interfaces/Request.xsd"
    xmlns:r1="http://www.abc.com/interfaces/Response.xsd"
    >
    <wsdl:types>
        <xs:schema>
            <xs:import namespace="http://www.abc.com/interfaces/Request.xsd" schemaLocation="Request.xsd"/>
            <xs:import namespace="http://www.abc.com/interfaces/Response.xsd" schemaLocation="Response.xsd"/>           
        </xs:schema>
    </wsdl:types>
   
    <wsdl:message name="WSRequest">
        <wsdl:part name="WSRequest" element="r0:WSRequest"/>
    </wsdl:message>
    <wsdl:message name="WSResponse">
        <wsdl:part name="WSResponse" element="r1:WSResponse"/>
    </wsdl:message>

    <wsdl:portType name="WSWebServicePort">       
        <wsdl:operation name="operation-1">
            <wsdl:input name="WSRequest" message="tns:WSRequest"/>
            <wsdl:output name="WSResponse" message="tns:WSResponse"/>
        </wsdl:operation>
    </wsdl:portType>

     <wsdl:binding name="WSWebServiceSoapBinding" type="tns:WSWebServicePort">
        <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>       
        <wsdl:operation name="operation-1">
            <wsdlsoap:operation soapAction="WS" style="document"/>
            <wsdl:input>
                <wsdlsoap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <wsdlsoap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>   
   
    <wsdl:service name="WS">
        <wsdl:port name="WSWebService" binding="tns:WSWebServiceSoapBinding">
            <wsdlsoap:address location="http://localhost:8080/MyApp/services/WS"/>
        </wsdl:port>
    </wsdl:service>
   
</wsdl:definitions>




Request and Response has XSDs. Request itself will take huge amount of data and response is also huge.
I am wondering how can we provide this XML input as JSON input after it gets converted to REST style.
We are using wsdl 1.x and we should strict to that.

Sample Request:
Request

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rep="http://www.mwvis.com/interfaces/Request.xsd">
   <soapenv:Header/>
   <soapenv:Body>
      <rep:Request name="name" code="code">
         <Specification ReturnPageSizedSegment="false" returnTotalRecords="true">
           <DataSetType>datasettype</DataSetType>
           <CountPerSegment>30</CountPerSegment>
           <OmitUnselectedAttributes>true</OmitUnselectedAttributes>
            <SortFields>
               <SortField>
                  <Name>Date</Name>
                  <SortOrder>1</SortOrder>
                  <Direction>desc</Direction>
               </SortField>
            </SortFields>
            <LogonId>admin</LogonId>
            <Locations>
               <LocationId>1</LocationId>
               <LocationId>2</LocationId>
               <LocationId>3</LocationId>
           </Locations>
           <FilterByParentNodeId>0</FilterByParentNodeId>
           <RollupByNodeType>Site</RollupByNodeType>
        </Specification>
        <Filters>
          <DateTime>
            <Operator>greaterThanEquals</Operator>
            <Value>2013-03-20 00:00:00</Value>
          </DateTime>
          <DateTime>
           <Operator>lessThanEquals</Operator>
           <Value>2013-06-17 23:59:59</Value>
          </DateTime>
       </Filters>
      </rep:Request>
   </soapenv:Body>
</soapenv:Envelope>





Sample Response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <rep:Response Date="2013-06-19T12:56:39.098+05:30" xmlns:rep="http://www.mwvis.com/interfaces/Response.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <Data dateTime="2013-06-19T12:56:39.095+05:30" xsi:type="gen:GenericData" xmlns:gen="http://www.mwvis.com/interfaces/GenericData.xsd">
            <SessionId>0641177c-beeb-4979-a1cf-8873c406a292</SessionId>
            <Segments>0</Segments>
            <Total>7</Total>
            <categoryData id="0" value="Monday">
               <valueData value="620"/>
            </categoryData>
            <categoryData id="1" value="Sunday">
               <valueData value="620"/>
            </categoryData>
            <categoryData id="2" value="Saturday">
               <valueData value="625"/>
            </categoryData>
            <categoryData id="3" value="Friday">
               <valueData value="625"/>
            </categoryData>
            <categoryData id="4" value="Thursday">
               <valueData value="625"/>
            </categoryData>
            <categoryData id="5" value="Wednesday">
               <valueData value="615"/>
            </categoryData>
            <categoryData id="6" value="Tuesday">
               <valueData value="650"/>
            </categoryData>
         </Data>
      </rep:Response>
   </soapenv:Body>
</soapenv:Envelope>


Please tell me what all changes I have to do in
1. WSDL
2. AXIS2.xml
3. Once it is RESTFul, How to provide the above shown XML input as JSON to the service in the URL
4. Make it complete JSON oriented(request and response should be JSON)

Thanks in advance....

Loading...