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 Amit Sharma01 <am...@irissoftware.com> on 2013/08/20 12:31:35 UTC

Axis2 REST client with non-Axis2 Server implementation

Hi,

I need to develop a REST client application that consumes a REST based web service written in some non-Axis2 framework like Apache Slign or Jersey. As far as I can think, this should not be possible as from what I've read from online docs is that Axis2 treats a REST request internally as a SOAP message. If the server side is also Axis2, then it would understand this and handle it gracefully but a non-Axis2 framework should not understand it as a valid REST call and therefore should fail.

Can someone suggest or atleast provide some pointers?
--
Thanks & Regards,
Amit Sharma (amit.sharma01)
|Senior Solutions Consultant|
|IRIS Software Pvt. Ltd.| www.irissoftware.com<applewebdata://43FBE75F-6682-4B3B-BF7A-C37D83574D73/www.irissoftware.com> |
| Ph: 91-11-4209 1000 x 416 | Cell: 91 9910062894 | USA: +1 732-412-9350 x 416 |  Fax: 91-11-416 77501 |
| B-1/G-8 Mohan Cooperative Industrial Estate, Mathura Road, New Delhi 110044, INDIA.|

A CMMI ML3, ISO 9001 and ISO 27001 Company
Ranked on the Inc 500 list, Deloitte & Touche Fast Technology Companies, and NJ Finest Companies



Disclaimer: This email message may contain confidential, proprietary and/or
privileged information. It is intended only for the use of the intended
recipient(s). If you have received it in error, please immediately advise the
sender by reply email and then delete this email message. Any disclosure,
copying, distribution or use of the information contained in this email message
to or by anyone other than the intended recipient is strictly prohibited.

Re: Axis2 REST client with non-Axis2 Server implementation

Posted by Amit Sharma01 <am...@irissoftware.com>.
Yashwant,

I checked it out but it is written assuming Axis2 both on the client as well as server. Online docs clearly suggest that Axis2 will convert the outgoing request from client to SOAP. On the server if the implementation is axis2, it'll know the semantics but other framework like jersey won't.

I created a PoC to see if it works but I'm not successful as of now. I'm still digging through.
--
Thanks & Regards,
Amit Sharma
From: "Yashwanth Rajaram -X (yrajaram - ZENSAR TECHNOLOGIES INC at Cisco)" <yr...@cisco.com>>
Reply-To: "java-user@axis.apache.org<ma...@axis.apache.org>" <ja...@axis.apache.org>>
Date: Wednesday 21 August 2013 5:12 AM
To: "java-user@axis.apache.org<ma...@axis.apache.org>" <ja...@axis.apache.org>>
Subject: RE: Axis2 REST client with non-Axis2 Server implementation

Amit,

While I have not tried that personally the docs seem to suggest that it is possible. See the example under your  AXIS2_HOME/samples/userguide/src/clients/RESTClient.java
It does something like this – do let us know if this works for you.

publicstatic voidmain(String[] args)throws AxisFault {

        Options options = new Options();
        options.setTo(new EndpointReference(toEpr));
        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);

        options.setProperty(Constants.Configuration.ENABLE_REST, Constants.VALUE_TRUE);

        ServiceClient sender = new ServiceClient();
        sender.engageModule(Constants.MODULE_ADDRESSING);
        sender.setOptions(options);
        OMElement result = sender.sendReceive(getPayload());

        try{
            XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
            result.serialize(writer);
            writer.flush();



Sincerely, Yashwanth
Technical Architect, EBIS

From: Amit Sharma01 [mailto:amit.sharma01@irissoftware.com]
Sent: Tuesday, August 20, 2013 3:21 PM
To: java-user@axis.apache.org<ma...@axis.apache.org>
Subject: Re: Axis2 REST client with non-Axis2 Server implementation

Yashwant,

Thanks for the response. May be I did not put it clearly enough. First let me disclose that in my case, SOAP is out of picture as I'm only talking about REST support. Imagine there is a REST web service written using Jersey and I want to consume that REST web service using Axis2 client. This means that there is no Axis2 on the server side but only the client side is Axis2. I have my doubts about the feasibility of this client written using Axis2 been able to invoke the Jersey REST service correctly.

Anyone having different view???
--
Thanks & Regards,
Amit Sharma


From: "Yashwanth Rajaram -X (yrajaram - ZENSAR TECHNOLOGIES INC at Cisco)" <yr...@cisco.com>>
Reply-To: "java-user@axis.apache.org<ma...@axis.apache.org>" <ja...@axis.apache.org>>
Date: Tuesday 20 August 2013 11:31 PM
To: "java-user@axis.apache.org<ma...@axis.apache.org>" <ja...@axis.apache.org>>
Subject: RE: Axis2 REST client with non-Axis2 Server implementation

Your question is not clear. Are you telling that it is not possible to write a client using Axis2 to consume a service written in non-Axis2 framework?

Anyway if all you are interested in is to find out if it is possible to have one web service written in Axis2 and invoke the very same implementation either as a SOAP call (web service invocation) or ReST call – then be assured that  it is definitely possible.

Sincerely, Yashwanth
Technical Architect, EBIS

From: Amit Sharma01 [mailto:amit.sharma01@irissoftware.com]
Sent: Tuesday, August 20, 2013 3:32 AM
To: java-user@axis.apache.org<ma...@axis.apache.org>
Subject: Axis2 REST client with non-Axis2 Server implementation

Hi,

I need to develop a REST client application that consumes a REST based web service written in some non-Axis2 framework like Apache Slign or Jersey. As far as I can think, this should not be possible as from what I've read from online docs is that Axis2 treats a REST request internally as a SOAP message. If the server side is also Axis2, then it would understand this and handle it gracefully but a non-Axis2 framework should not understand it as a valid REST call and therefore should fail.

Can someone suggest or atleast provide some pointers?
--
Thanks & Regards,
Amit Sharma (amit.sharma01)
|Senior Solutions Consultant|
|IRIS Software Pvt. Ltd.| www.irissoftware.com<applewebdata://43FBE75F-6682-4B3B-BF7A-C37D83574D73/www.irissoftware.com> |
| Ph: 91-11-4209 1000 x 416 | Cell: 91 9910062894 | USA: +1 732-412-9350 x 416 |  Fax: 91-11-416 77501 |
| B-1/G-8 Mohan Cooperative Industrial Estate, Mathura Road, New Delhi 110044, INDIA.|

A CMMI ML3, ISO 9001 and ISO 27001 Company
Ranked on the Inc 500 list, Deloitte & Touche Fast Technology Companies, and NJ Finest Companies





Disclaimer: This email message may contain confidential, proprietary and/or

privileged information. It is intended only for the use of the intended

recipient(s). If you have received it in error, please immediately advise the

sender by reply email and then delete this email message. Any disclosure,

copying, distribution or use of the information contained in this email message

to or by anyone other than the intended recipient is strictly prohibited.





Disclaimer: This email message may contain confidential, proprietary and/or

privileged information. It is intended only for the use of the intended

recipient(s). If you have received it in error, please immediately advise the

sender by reply email and then delete this email message. Any disclosure,

copying, distribution or use of the information contained in this email message

to or by anyone other than the intended recipient is strictly prohibited.



Disclaimer: This email message may contain confidential, proprietary and/or
privileged information. It is intended only for the use of the intended
recipient(s). If you have received it in error, please immediately advise the
sender by reply email and then delete this email message. Any disclosure,
copying, distribution or use of the information contained in this email message
to or by anyone other than the intended recipient is strictly prohibited.

RE: Axis2 REST client with non-Axis2 Server implementation

Posted by "Yashwanth Rajaram -X (yrajaram - ZENSAR TECHNOLOGIES INC at Cisco)" <yr...@cisco.com>.
Amit,

While I have not tried that personally the docs seem to suggest that it is possible. See the example under your  AXIS2_HOME/samples/userguide/src/clients/RESTClient.java
It does something like this - do let us know if this works for you.

public static void main(String[] args) throws AxisFault {

        Options options = new Options();
        options.setTo(new EndpointReference(toEpr));
        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);

        options.setProperty(Constants.Configuration.ENABLE_REST, Constants.VALUE_TRUE);

        ServiceClient sender = new ServiceClient();
        sender.engageModule(Constants.MODULE_ADDRESSING);
        sender.setOptions(options);
        OMElement result = sender.sendReceive(getPayload());

        try {
            XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
            result.serialize(writer);
            writer.flush();



Sincerely, Yashwanth
Technical Architect, EBIS

From: Amit Sharma01 [mailto:amit.sharma01@irissoftware.com]
Sent: Tuesday, August 20, 2013 3:21 PM
To: java-user@axis.apache.org
Subject: Re: Axis2 REST client with non-Axis2 Server implementation

Yashwant,

Thanks for the response. May be I did not put it clearly enough. First let me disclose that in my case, SOAP is out of picture as I'm only talking about REST support. Imagine there is a REST web service written using Jersey and I want to consume that REST web service using Axis2 client. This means that there is no Axis2 on the server side but only the client side is Axis2. I have my doubts about the feasibility of this client written using Axis2 been able to invoke the Jersey REST service correctly.

Anyone having different view???
--
Thanks & Regards,
Amit Sharma


From: "Yashwanth Rajaram -X (yrajaram - ZENSAR TECHNOLOGIES INC at Cisco)" <yr...@cisco.com>>
Reply-To: "java-user@axis.apache.org<ma...@axis.apache.org>" <ja...@axis.apache.org>>
Date: Tuesday 20 August 2013 11:31 PM
To: "java-user@axis.apache.org<ma...@axis.apache.org>" <ja...@axis.apache.org>>
Subject: RE: Axis2 REST client with non-Axis2 Server implementation

Your question is not clear. Are you telling that it is not possible to write a client using Axis2 to consume a service written in non-Axis2 framework?

Anyway if all you are interested in is to find out if it is possible to have one web service written in Axis2 and invoke the very same implementation either as a SOAP call (web service invocation) or ReST call - then be assured that  it is definitely possible.

Sincerely, Yashwanth
Technical Architect, EBIS

From: Amit Sharma01 [mailto:amit.sharma01@irissoftware.com]
Sent: Tuesday, August 20, 2013 3:32 AM
To: java-user@axis.apache.org<ma...@axis.apache.org>
Subject: Axis2 REST client with non-Axis2 Server implementation

Hi,

I need to develop a REST client application that consumes a REST based web service written in some non-Axis2 framework like Apache Slign or Jersey. As far as I can think, this should not be possible as from what I've read from online docs is that Axis2 treats a REST request internally as a SOAP message. If the server side is also Axis2, then it would understand this and handle it gracefully but a non-Axis2 framework should not understand it as a valid REST call and therefore should fail.

Can someone suggest or atleast provide some pointers?
--
Thanks & Regards,
Amit Sharma (amit.sharma01)
|Senior Solutions Consultant|
|IRIS Software Pvt. Ltd.| www.irissoftware.com<applewebdata://43FBE75F-6682-4B3B-BF7A-C37D83574D73/www.irissoftware.com> |
| Ph: 91-11-4209 1000 x 416 | Cell: 91 9910062894 | USA: +1 732-412-9350 x 416 |  Fax: 91-11-416 77501 |
| B-1/G-8 Mohan Cooperative Industrial Estate, Mathura Road, New Delhi 110044, INDIA.|

A CMMI ML3, ISO 9001 and ISO 27001 Company
Ranked on the Inc 500 list, Deloitte & Touche Fast Technology Companies, and NJ Finest Companies





Disclaimer: This email message may contain confidential, proprietary and/or

privileged information. It is intended only for the use of the intended

recipient(s). If you have received it in error, please immediately advise the

sender by reply email and then delete this email message. Any disclosure,

copying, distribution or use of the information contained in this email message

to or by anyone other than the intended recipient is strictly prohibited.





Disclaimer: This email message may contain confidential, proprietary and/or

privileged information. It is intended only for the use of the intended

recipient(s). If you have received it in error, please immediately advise the

sender by reply email and then delete this email message. Any disclosure,

copying, distribution or use of the information contained in this email message

to or by anyone other than the intended recipient is strictly prohibited.

Re: Axis2 REST client with non-Axis2 Server implementation

Posted by Amit Sharma01 <am...@irissoftware.com>.
Yashwant,

Thanks for the response. May be I did not put it clearly enough. First let me disclose that in my case, SOAP is out of picture as I'm only talking about REST support. Imagine there is a REST web service written using Jersey and I want to consume that REST web service using Axis2 client. This means that there is no Axis2 on the server side but only the client side is Axis2. I have my doubts about the feasibility of this client written using Axis2 been able to invoke the Jersey REST service correctly.

Anyone having different view???
--
Thanks & Regards,
Amit Sharma


From: "Yashwanth Rajaram -X (yrajaram - ZENSAR TECHNOLOGIES INC at Cisco)" <yr...@cisco.com>>
Reply-To: "java-user@axis.apache.org<ma...@axis.apache.org>" <ja...@axis.apache.org>>
Date: Tuesday 20 August 2013 11:31 PM
To: "java-user@axis.apache.org<ma...@axis.apache.org>" <ja...@axis.apache.org>>
Subject: RE: Axis2 REST client with non-Axis2 Server implementation

Your question is not clear. Are you telling that it is not possible to write a client using Axis2 to consume a service written in non-Axis2 framework?

Anyway if all you are interested in is to find out if it is possible to have one web service written in Axis2 and invoke the very same implementation either as a SOAP call (web service invocation) or ReST call – then be assured that  it is definitely possible.

Sincerely, Yashwanth
Technical Architect, EBIS

From: Amit Sharma01 [mailto:amit.sharma01@irissoftware.com]
Sent: Tuesday, August 20, 2013 3:32 AM
To: java-user@axis.apache.org<ma...@axis.apache.org>
Subject: Axis2 REST client with non-Axis2 Server implementation

Hi,

I need to develop a REST client application that consumes a REST based web service written in some non-Axis2 framework like Apache Slign or Jersey. As far as I can think, this should not be possible as from what I've read from online docs is that Axis2 treats a REST request internally as a SOAP message. If the server side is also Axis2, then it would understand this and handle it gracefully but a non-Axis2 framework should not understand it as a valid REST call and therefore should fail.

Can someone suggest or atleast provide some pointers?
--
Thanks & Regards,
Amit Sharma (amit.sharma01)
|Senior Solutions Consultant|
|IRIS Software Pvt. Ltd.| www.irissoftware.com<applewebdata://43FBE75F-6682-4B3B-BF7A-C37D83574D73/www.irissoftware.com> |
| Ph: 91-11-4209 1000 x 416 | Cell: 91 9910062894 | USA: +1 732-412-9350 x 416 |  Fax: 91-11-416 77501 |
| B-1/G-8 Mohan Cooperative Industrial Estate, Mathura Road, New Delhi 110044, INDIA.|

A CMMI ML3, ISO 9001 and ISO 27001 Company
Ranked on the Inc 500 list, Deloitte & Touche Fast Technology Companies, and NJ Finest Companies





Disclaimer: This email message may contain confidential, proprietary and/or

privileged information. It is intended only for the use of the intended

recipient(s). If you have received it in error, please immediately advise the

sender by reply email and then delete this email message. Any disclosure,

copying, distribution or use of the information contained in this email message

to or by anyone other than the intended recipient is strictly prohibited.



Disclaimer: This email message may contain confidential, proprietary and/or
privileged information. It is intended only for the use of the intended
recipient(s). If you have received it in error, please immediately advise the
sender by reply email and then delete this email message. Any disclosure,
copying, distribution or use of the information contained in this email message
to or by anyone other than the intended recipient is strictly prohibited.

RE: Axis2 REST client with non-Axis2 Server implementation

Posted by "Yashwanth Rajaram -X (yrajaram - ZENSAR TECHNOLOGIES INC at Cisco)" <yr...@cisco.com>.
Your question is not clear. Are you telling that it is not possible to write a client using Axis2 to consume a service written in non-Axis2 framework?

Anyway if all you are interested in is to find out if it is possible to have one web service written in Axis2 and invoke the very same implementation either as a SOAP call (web service invocation) or ReST call - then be assured that  it is definitely possible.

Sincerely, Yashwanth
Technical Architect, EBIS

From: Amit Sharma01 [mailto:amit.sharma01@irissoftware.com]
Sent: Tuesday, August 20, 2013 3:32 AM
To: java-user@axis.apache.org
Subject: Axis2 REST client with non-Axis2 Server implementation

Hi,

I need to develop a REST client application that consumes a REST based web service written in some non-Axis2 framework like Apache Slign or Jersey. As far as I can think, this should not be possible as from what I've read from online docs is that Axis2 treats a REST request internally as a SOAP message. If the server side is also Axis2, then it would understand this and handle it gracefully but a non-Axis2 framework should not understand it as a valid REST call and therefore should fail.

Can someone suggest or atleast provide some pointers?
--
Thanks & Regards,
Amit Sharma (amit.sharma01)
|Senior Solutions Consultant|
|IRIS Software Pvt. Ltd.| www.irissoftware.com<applewebdata://43FBE75F-6682-4B3B-BF7A-C37D83574D73/www.irissoftware.com> |
| Ph: 91-11-4209 1000 x 416 | Cell: 91 9910062894 | USA: +1 732-412-9350 x 416 |  Fax: 91-11-416 77501 |
| B-1/G-8 Mohan Cooperative Industrial Estate, Mathura Road, New Delhi 110044, INDIA.|

A CMMI ML3, ISO 9001 and ISO 27001 Company
Ranked on the Inc 500 list, Deloitte & Touche Fast Technology Companies, and NJ Finest Companies





Disclaimer: This email message may contain confidential, proprietary and/or

privileged information. It is intended only for the use of the intended

recipient(s). If you have received it in error, please immediately advise the

sender by reply email and then delete this email message. Any disclosure,

copying, distribution or use of the information contained in this email message

to or by anyone other than the intended recipient is strictly prohibited.