axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shmulik <s...@softov.co.il>
Subject How can I set up a REST web service that returns HTML
Date Wed, 12 Aug 2009 08:55:58 GMT
Hi,

I have followed the manual and was able to create the REST service.

I have used the calendar wsdl + modification. (I have added the echo method
see the Calculator.wsdl bellow).

The echo method gets a string and then returns HTML as result.

Instead of returning the HTML I get an XML with the HTML embedded (see the
tcpmon.txt bellow which was recorded by TCPMON.exe).

Is returning bare HTML possible under axis2/c?

 

-Sam.

 

================================= Start tcpmon.txt:

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= = = = = =

SENDING DATA..

/* sending time = 10:13:51*/

/* message uuid = 99539dfe-d446-4eff-befd-f6cce231de78*/

---------------------

GET /axis2/services/Calculator/echo/test3 HTTP/1.1

Host: localhost:18080

User-Agent: Mozilla/5.0 (Windows;

            U;

            Windows NT 5.1;

            en-US;

            rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729)

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Language: en-us,en;q=0.5

Accept-Encoding: gzip,deflate

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive: 300

Connection: keep-alive

 

 

 

 

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= = = = = =

RETRIEVING DATA..

/* retrieving time = 10:13:51*/

/* time throughput = 0 sec(s)*/

---------------------

HTTP/1.1 200 OK

Date: Wed, 12 Aug 2009 07:13:51 GMT

Server: Apache/2.0.63 (Win32) Axis2C/1.6.0

Content-Length: 644

Keep-Alive: timeout=15, max=100

Connection: Keep-Alive

Content-Type: text/xml

 

<n:echoResponse
xmlns:n="http://ws.apache.org/axis2/services/Calculator/types">&lt;!DOCTYPE
html PUBLIC &quot;-//IETF//DTD HTML
2.0//EN&quot;&gt;&lt;html&gt;&lt;head&gt;&lt;title&gt;Hello
World
Demonstration
Document&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;h1&gt;Hello,
World!&lt;/h1&gt;&lt;p&gt;This is a minimal &quot;hello world&quot;
HTML
document. It demonstrates the basic structure of an HTML file and
anchors.&lt;/p&gt;&lt;p&gt;For more information, see the HTML Station at:
&lt;a href=
&quot;http://www.december.com/html/&quot;&gt;http://www.december.com/html/&l
t;/a&gt;&lt;/p&gt;&lt;hr&gt;&lt;/body&gt;&lt;/html&gt;</n:echoResponse>

 

================================= End tcpmon.txt:

 

================================= Start Calculator.wsdl

<?xml version="1.0" encoding="UTF-8"?>

<wsdl:definitions

    targetNamespace="http://ws.apache.org/axis2/services/Calculator" 

    xmlns:impl="http://ws.apache.org/axis2/services/Calculator"

    xmlns:type="http://ws.apache.org/axis2/services/Calculator/types" 

    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 

    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 

    xmlns:xsd="http://www.w3.org/2001/XMLSchema"

            xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/">

    <wsdl:types>

        <schema

 
targetNamespace="http://ws.apache.org/axis2/services/Calculator/types"

            xmlns="http://www.w3.org/2001/XMLSchema" 

            xmlns:impl="http://ws.apache.org/axis2/services/Calculator"

            xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

            <element name="echo" type="xsd:string"/>

            <element name="echoResponse" type="xsd:string"/>

            <element name="add">

                <complexType>

                    <sequence>

                        <element name="param_1" type="xsd:int"/>

                        <element name="param_2" type="xsd:int"/>

                    </sequence>

                </complexType>

            </element>

            <element name="addResponse">

                <complexType>

                    <sequence>

                        <element name="result" type="xsd:int"/>

                    </sequence>

                </complexType>

            </element>

            <element name="sub">

                <complexType>

                    <sequence>

                        <element name="param_1" type="xsd:int"/>

                        <element name="param_2" type="xsd:int"/>

                    </sequence>

                </complexType>

            </element>

            <element name="subResponse">

                <complexType>

                    <sequence>

                        <element name="result" type="xsd:int"/>

                    </sequence>

                </complexType>

            </element>

            <element name="mul">

                <complexType>

                    <sequence>

                        <element name="param_1" type="xsd:int"/>

                        <element name="param_2" type="xsd:int"/>

                    </sequence>

                </complexType>

            </element>

            <element name="mulResponse">

                <complexType>

                    <sequence>

                        <element name="result" type="xsd:int"/>

                    </sequence>

                </complexType>

            </element>

            <element name="div">

                <complexType>

                    <sequence>

                        <element name="param_1" type="xsd:int"/>

                        <element name="param_2" type="xsd:int"/>

                    </sequence>

                </complexType>

            </element>

            <element name="divResponse">

                <complexType>

                    <sequence>

                        <element name="result" type="xsd:int"/>

                    </sequence>

                </complexType>

            </element>

        </schema>

    </wsdl:types>

 

    <wsdl:message name="echoResponse">

                        <wsdl:part element="type:echoResponse" name="docs"/>

    </wsdl:message>

    <wsdl:message name="echoRequest">

        <wsdl:part element="type:echo" name="parameters"/>

    </wsdl:message>

    <wsdl:message name="addResponse">

        <wsdl:part element="type:addResponse" name="parameters"/>

    </wsdl:message>

    <wsdl:message name="addRequest">

        <wsdl:part element="type:add" name="parameters"/>

    </wsdl:message>

    <wsdl:message name="subResponse">

        <wsdl:part element="type:subResponse" name="parameters"/>

    </wsdl:message>

    <wsdl:message name="subRequest">

        <wsdl:part element="type:sub" name="parameters"/>

    </wsdl:message>

    <wsdl:message name="divResponse">

        <wsdl:part element="type:divResponse" name="parameters"/>

    </wsdl:message>

    <wsdl:message name="divRequest">

        <wsdl:part element="type:div" name="parameters"/>

    </wsdl:message>

    <wsdl:message name="mulResponse">

        <wsdl:part element="type:mulResponse" name="parameters"/>

    </wsdl:message>

    <wsdl:message name="mulRequest">

        <wsdl:part element="type:mul" name="parameters"/>

    </wsdl:message>

 

    <wsdl:portType name="CalculatorPortType">

        <wsdl:operation name="echo">

            <wsdl:input message="impl:echoRequest" name="echoRequest"/>

            <wsdl:output message="impl:echoResponse" name="echoResponse"/>

        </wsdl:operation>

        <wsdl:operation name="add">

            <wsdl:input message="impl:addRequest" name="addRequest"/>

            <wsdl:output message="impl:addResponse" name="addResponse"/>

        </wsdl:operation>

        <wsdl:operation name="sub">

            <wsdl:input message="impl:subRequest" name="subRequest"/>

            <wsdl:output message="impl:subResponse" name="subResponse"/>

        </wsdl:operation>

        <wsdl:operation name="mul">

            <wsdl:input message="impl:mulRequest" name="mulRequest"/>

            <wsdl:output message="impl:mulResponse" name="mulResponse"/>

        </wsdl:operation>

        <wsdl:operation name="div">

            <wsdl:input message="impl:divRequest" name="divRequest"/>

            <wsdl:output message="impl:divResponse" name="divResponse"/>

        </wsdl:operation>

    </wsdl:portType>

 

    <wsdl:binding name="CalculatorSoapBinding"
type="impl:CalculatorPortType">

        <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>

        <wsdl:operation name="echo">

            <soap:operation soapAction="Calculator/echo"/>

            <wsdl:input name="echoRequest">

                <soap:body use="literal"/>

            </wsdl:input>

            <wsdl:output name="echoResponse">

                <mime:content type="text/html"/>

            </wsdl:output>

        </wsdl:operation>

        <wsdl:operation name="add">

            <soap:operation soapAction="Calculator#add"/>

            <wsdl:input name="addRequest">

                <soap:body use="literal"/>

            </wsdl:input>

            <wsdl:output name="addResponse">

                <soap:body use="literal"/>

            </wsdl:output>

        </wsdl:operation>

        <wsdl:operation name="sub">

            <soap:operation soapAction="Calculator#sub"/>

            <wsdl:input name="subRequest">

                <soap:body use="literal"/>

            </wsdl:input>

            <wsdl:output name="subResponse">

                <soap:body use="literal"/>

            </wsdl:output>

        </wsdl:operation>

        <wsdl:operation name="mul">

            <soap:operation soapAction="Calculator#mul"/>

            <wsdl:input name="mulRequest">

                <soap:body use="literal"/>

            </wsdl:input>

            <wsdl:output name="mulResponse">

                <soap:body use="literal"/>

            </wsdl:output>

        </wsdl:operation>

        <wsdl:operation name="div">

            <soap:operation soapAction="Calculator#div"/>

            <wsdl:input name="divRequest">

                <soap:body use="literal"/>

            </wsdl:input>

            <wsdl:output name="divResponse">

                <soap:body use="literal"/>

            </wsdl:output>

        </wsdl:operation>

    </wsdl:binding>

 

    <wsdl:service name="Calculator">

        <wsdl:port binding="impl:CalculatorSoapBinding"
name="CalculatorSOAPport_http">

            <soap:address
location="http://localhost:9090/axis2/services/Calculator"/>

        </wsdl:port>

    </wsdl:service>

</wsdl:definitions>

 

================================= End Calculator.wsdl

 

 

 

 

  _____  

From: Dimuthu Gamage [mailto:dimuthuc@gmail.com] 
Sent: Wednesday, August 12, 2009 5:31 AM
To: Apache AXIS C User List
Subject: Re: How can I set up a REST web service that returns HTML

 

Try follow http://ws.apache.org/axis2/c/docs/axis2c_manual.html#rest

On Tue, Aug 11, 2009 at 4:58 PM, shmulik <samb@softov.co.il> wrote:

I need to set up a web service that returns the result as an HTML.
Currently, the returned value gets embedded inside a soap message.

-Sam.




-- 
Thanks,
Dimuthu Gamage

http://www.dimuthu.org
http://www.wso2.org


Mime
View raw message