You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by James Gan <ga...@gmail.com> on 2006/07/05 03:38:53 UTC

[REST] Can I input parameter in URL when using REST style?

Hi, dear all

After installing AXIS war in Websphere Application Server, I can visit
Version service by inputting its address in the address bar of browser. But
I'm wondering if I can input parameters while visiting follow service
created by me.

public class MyService1 {
    public void ping(int element) {

    }

    public int echo(int element) {
        return element * element;
    }
}

I input http://localhost:9080/axis2/rest/MyService1/ping?element=15 in the
address bar of firefox. Then I got follow error information:

*Error Message: *Invalid message addition , operation context completed;
nested exception is: org.apache.axis2.AxisFault: Invalid message addition ,
operation context completed
*Error Code: *500
*Target Servlet: *AxisRESTServlet
*Error Stack: *
org.apache.axis2.AxisFault: Invalid message addition , operation context
completed; nested exception is:
     org.apache.axis2.AxisFault: Invalid message addition , operation
context completed
     at org.apache.axis2.transport.http.util.RESTUtil.processGetRequest(
RESTUtil.java:141)
     at org.apache.axis2.transport.http.AxisRESTServlet.doGet(
AxisRESTServlet.java:36)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
     at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(
ServletWrapper.java:1282)
     at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(
ServletWrapper.java:673)

Is it feasible in AXIS2?

Thanks a lot!
James Gan

Re: [REST] Can I input parameter in URL when using REST style?

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Hi James;
I did the following and got the correct result
  - create a service archive file using your service impl class;
      - services.xml look like follows;

     <service name="axisversion">
    <messageReceivers>
        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
                        
class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
                        
class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
    </messageReceivers>
    <parameter name="ServiceClass" locked="false">org.MyService1</parameter>
  </service>

and I my service impl class is follows

public class MyService1 {

    public void ping(int element) {

    }

    public int echo(int element) {
        return element * element;
    }
}


- I deploy the service archive file in tomcat (which is running in port
8080)
- and then I type
http://127.0.0.1:8080/axis2/rest/axisversion/echo?element=15
- got the following output
   <ns:echoResponse>
    <return>225</return>
  </ns:echoResponse>

James Gan wrote:

> Hi, dear all
>
> After installing AXIS war in Websphere Application Server, I can visit
> Version service by inputting its address in the address bar of
> browser. But I'm wondering if I can input parameters while visiting
> follow service created by me.
>
> public class MyService1 {
>     public void ping(int element) {
>
>     }
>
>     public int echo(int element) {
>         return element * element;
>     }
> }
>
> I input http://localhost:9080/axis2/rest/MyService1/ping?element=15 in
> the address bar of firefox. Then I got follow error information:
>
> *Error Message: *Invalid message addition , operation context
> completed; nested exception is: org.apache.axis2.AxisFault: Invalid
> message addition , operation context completed
> *Error Code: *500
> *Target Servlet: *AxisRESTServlet
> *Error Stack: *
> org.apache.axis2.AxisFault: Invalid message addition , operation
> context completed; nested exception is:
>      org.apache.axis2.AxisFault: Invalid message addition , operation
> context completed
>      at
> org.apache.axis2.transport.http.util.RESTUtil.processGetRequest(RESTUtil.java:141)
>
>      at
> org.apache.axis2.transport.http.AxisRESTServlet.doGet(AxisRESTServlet.java:36)
>
>      at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
>      at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
>      at
> com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1282)
>
>      at
> com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:673)
>
>
> Is it feasible in AXIS2?
>
> Thanks a lot!
> James Gan
>

-- 
Thanks,
Deepal
................................................................
~Future is Open~ 



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: [REST] Can I input parameter in URL when using REST style?

Posted by James Gan <ga...@gmail.com>.
Hi, Deepal and Kinichiro

I repeat Deepal's work. It works well! :)

Thank you


On 7/5/06, Kinichiro Inoguchi <in...@yahoo.com> wrote:
>
> Hi,
>
> I'm wrong, let me correct.
>
> > This error is caused because of NULL response SOAP body, I think.
> > I'm not sure though, Axis2 does NOT permit NULL response SOAP body.
>
> With RPCInOnlyMessageReceiver, Axis2 is able to support NULL SOAP body
> response.
> I noticed by Deepal's reply.
>
> I verified with services.xml like this.
> <service name="ComplexTest">
>     <description>test service.</description>
>     <parameter name="ServiceClass"
> locked="false">test.MyService1</parameter>
>     <operation name="ping">
>         <messageReceiver
> class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
>     </operation>
>     <operation name="echo">
>         <messageReceiver
> class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
>     </operation>
> </service>
>
> Regards,
> kinichiro
>
> --- Kinichiro Inoguchi <in...@yahoo.com> wrote:
>
> > Hi, James.
> >
> > Yes you can put parameters like you mentioned.
> > Your http://localhost:9080/axis2/rest/MyService1/echo?element=15
> > will work fine.
> >
> > This error is caused because of NULL response SOAP body, I think.
> > I'm not sure though, Axis2 does NOT permit NULL response SOAP body.
> >
> > Regards,
> > kinichiro
> >
> > --- James Gan <ga...@gmail.com> wrote:
> >
> > > Hi, dear all
> > >
> > > After installing AXIS war in Websphere Application Server, I can
> > > visit
> > > Version service by inputting its address in the address bar of
> > > browser. But
> > > I'm wondering if I can input parameters while visiting follow
> > service
> > > created by me.
> > >
> > > public class MyService1 {
> > >     public void ping(int element) {
> > >
> > >     }
> > >
> > >     public int echo(int element) {
> > >         return element * element;
> > >     }
> > > }
> > >
> > > I input http://localhost:9080/axis2/rest/MyService1/ping?element=15
> > > in the
> > > address bar of firefox. Then I got follow error information:
> > >
> > > *Error Message: *Invalid message addition , operation context
> > > completed;
> > > nested exception is: org.apache.axis2.AxisFault: Invalid message
> > > addition ,
> > > operation context completed
> > > *Error Code: *500
> > > *Target Servlet: *AxisRESTServlet
> > > *Error Stack: *
> > > org.apache.axis2.AxisFault: Invalid message addition , operation
> > > context
> > > completed; nested exception is:
> > >      org.apache.axis2.AxisFault: Invalid message addition ,
> > operation
> > > context completed
> > >      at
> > > org.apache.axis2.transport.http.util.RESTUtil.processGetRequest(
> > > RESTUtil.java:141)
> > >      at org.apache.axis2.transport.http.AxisRESTServlet.doGet(
> > > AxisRESTServlet.java:36)
> > >      at
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
> > >      at
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
> > >      at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(
> > > ServletWrapper.java:1282)
> > >      at
> > com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(
> > > ServletWrapper.java:673)
> > >
> > > Is it feasible in AXIS2?
> > >
> > > Thanks a lot!
> > > James Gan
> > >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam protection around
> > http://mail.yahoo.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

Re: [REST] Can I input parameter in URL when using REST style?

Posted by Kinichiro Inoguchi <in...@yahoo.com>.
Hi,

I'm wrong, let me correct.

> This error is caused because of NULL response SOAP body, I think.
> I'm not sure though, Axis2 does NOT permit NULL response SOAP body.

With RPCInOnlyMessageReceiver, Axis2 is able to support NULL SOAP body
response.
I noticed by Deepal's reply.

I verified with services.xml like this.
<service name="ComplexTest">
    <description>test service.</description>
    <parameter name="ServiceClass"
locked="false">test.MyService1</parameter>
    <operation name="ping">
        <messageReceiver
class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
    </operation>
    <operation name="echo">
        <messageReceiver
class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
    </operation>
</service>

Regards,
kinichiro

--- Kinichiro Inoguchi <in...@yahoo.com> wrote:

> Hi, James.
> 
> Yes you can put parameters like you mentioned.
> Your http://localhost:9080/axis2/rest/MyService1/echo?element=15
> will work fine.
> 
> This error is caused because of NULL response SOAP body, I think.
> I'm not sure though, Axis2 does NOT permit NULL response SOAP body.
> 
> Regards,
> kinichiro
> 
> --- James Gan <ga...@gmail.com> wrote:
> 
> > Hi, dear all
> > 
> > After installing AXIS war in Websphere Application Server, I can
> > visit
> > Version service by inputting its address in the address bar of
> > browser. But
> > I'm wondering if I can input parameters while visiting follow
> service
> > created by me.
> > 
> > public class MyService1 {
> >     public void ping(int element) {
> > 
> >     }
> > 
> >     public int echo(int element) {
> >         return element * element;
> >     }
> > }
> > 
> > I input http://localhost:9080/axis2/rest/MyService1/ping?element=15
> > in the
> > address bar of firefox. Then I got follow error information:
> > 
> > *Error Message: *Invalid message addition , operation context
> > completed;
> > nested exception is: org.apache.axis2.AxisFault: Invalid message
> > addition ,
> > operation context completed
> > *Error Code: *500
> > *Target Servlet: *AxisRESTServlet
> > *Error Stack: *
> > org.apache.axis2.AxisFault: Invalid message addition , operation
> > context
> > completed; nested exception is:
> >      org.apache.axis2.AxisFault: Invalid message addition ,
> operation
> > context completed
> >      at
> > org.apache.axis2.transport.http.util.RESTUtil.processGetRequest(
> > RESTUtil.java:141)
> >      at org.apache.axis2.transport.http.AxisRESTServlet.doGet(
> > AxisRESTServlet.java:36)
> >      at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
> >      at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
> >      at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(
> > ServletWrapper.java:1282)
> >      at
> com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(
> > ServletWrapper.java:673)
> > 
> > Is it feasible in AXIS2?
> > 
> > Thanks a lot!
> > James Gan
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: [REST] Can I input parameter in URL when using REST style?

Posted by Kinichiro Inoguchi <in...@yahoo.com>.
Hi, James.

Yes you can put parameters like you mentioned.
Your http://localhost:9080/axis2/rest/MyService1/echo?element=15
will work fine.

This error is caused because of NULL response SOAP body, I think.
I'm not sure though, Axis2 does NOT permit NULL response SOAP body.

Regards,
kinichiro

--- James Gan <ga...@gmail.com> wrote:

> Hi, dear all
> 
> After installing AXIS war in Websphere Application Server, I can
> visit
> Version service by inputting its address in the address bar of
> browser. But
> I'm wondering if I can input parameters while visiting follow service
> created by me.
> 
> public class MyService1 {
>     public void ping(int element) {
> 
>     }
> 
>     public int echo(int element) {
>         return element * element;
>     }
> }
> 
> I input http://localhost:9080/axis2/rest/MyService1/ping?element=15
> in the
> address bar of firefox. Then I got follow error information:
> 
> *Error Message: *Invalid message addition , operation context
> completed;
> nested exception is: org.apache.axis2.AxisFault: Invalid message
> addition ,
> operation context completed
> *Error Code: *500
> *Target Servlet: *AxisRESTServlet
> *Error Stack: *
> org.apache.axis2.AxisFault: Invalid message addition , operation
> context
> completed; nested exception is:
>      org.apache.axis2.AxisFault: Invalid message addition , operation
> context completed
>      at
> org.apache.axis2.transport.http.util.RESTUtil.processGetRequest(
> RESTUtil.java:141)
>      at org.apache.axis2.transport.http.AxisRESTServlet.doGet(
> AxisRESTServlet.java:36)
>      at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
>      at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
>      at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(
> ServletWrapper.java:1282)
>      at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(
> ServletWrapper.java:673)
> 
> Is it feasible in AXIS2?
> 
> Thanks a lot!
> James Gan
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org