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

Convert SOPA webservice to REST style in AXIS2

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"?>

            <xs:import namespace="" schemaLocation="Request.xsd"/>
            <xs:import namespace="" schemaLocation="Response.xsd"/>           
    <wsdl:message name="WSRequest">
        <wsdl:part name="WSRequest" element="r0:WSRequest"/>
    <wsdl:message name="WSResponse">
        <wsdl:part name="WSResponse" element="r1:WSResponse"/>

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

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

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:

<soapenv:Envelope xmlns:soapenv="" xmlns:rep="">
      <rep:Request name="name" code="code">
         <Specification ReturnPageSizedSegment="false" returnTotalRecords="true">
            <Value>2013-03-20 00:00:00</Value>
           <Value>2013-06-17 23:59:59</Value>

Sample Response:

<soapenv:Envelope xmlns:soapenv="">
      <rep:Response Date="2013-06-19T12:56:39.098+05:30" xmlns:rep="" xmlns:xsi="">
         <Data dateTime="2013-06-19T12:56:39.095+05:30" xsi:type="gen:GenericData" xmlns:gen="">
            <categoryData id="0" value="Monday">
               <valueData value="620"/>
            <categoryData id="1" value="Sunday">
               <valueData value="620"/>
            <categoryData id="2" value="Saturday">
               <valueData value="625"/>
            <categoryData id="3" value="Friday">
               <valueData value="625"/>
            <categoryData id="4" value="Thursday">
               <valueData value="625"/>
            <categoryData id="5" value="Wednesday">
               <valueData value="615"/>
            <categoryData id="6" value="Tuesday">
               <valueData value="650"/>

Please tell me what all changes I have to do in
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....