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 "Harbarth, Juliane" <Ju...@softwareag.com> on 2006/07/28 10:59:58 UTC
Problems with the REST POST Example
Hi,
I am still struggeling to compile the REST POST sample contained in
the Axis2 docu page 'RESTful Web services Support', see
http://ws.apache.org/axis2/0_94/rest-ws.html.
I tried my best to add appropriate import statements, but failed.
My current imports are:
import org.apache.axis2.*;
import org.apache.axis2.client.*;
import org.apache.axis2.transport.http.*;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axiom.om.*;
import javax.xml.stream.*;
import org.apache.axis.client.*;
I have also replaced the line:
options.setListenerTransportProtocol(Constants.TRANSPORT_HTTP);
with:
options.setListener(new SimpleHTTPServer());
and:
Call call = new Call();
with
Service service = new Service();
Call call = (Call)service.createCall();
The result is as follows:
E:\local\axis2>javac RESTClient.java
RESTClient.java:24: cannot resolve symbol
symbol : method setClientOptions (org.apache.axis2.client.Options)
location: class org.apache.axis.client.Call
call.setClientOptions(options);
^
RESTClient.java:26: cannot resolve symbol
symbol : method invokeBlocking
(java.lang.String,org.apache.axiom.om.OMElement)
location: class org.apache.axis.client.Call
OMElement result = call.invokeBlocking("echo", getPayload());
^
RESTClient.java:46: cannot resolve symbol
symbol : method createText
(org.apache.axiom.om.OMElement,java.lang.String)
location: interface org.apache.axiom.om.OMFactory
value.addChild(fac.createText(value, "Axis2 Echo String "));
^
3 errors
I am especially bewildered by the Call class. Taking the one from axis
seems
odd, since importing stuff from both axis and axis2 is rather unusual. I
tried
jaxrpc.jar but this did not work neither.
What am I doing wrong ?
Regards,
Juliane.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: Problems with the REST POST Example
Posted by Eran Chinthaka <ch...@opensource.lk>.
Hi Harbath,
Which version of Axis2 are you using?
If(AXIS2_VERSION < 1.0){
// please switch to Axis2 1.0 or later
} else {
Seems there is a problem in the document. For the time being, you first
invoke the web service using SOAP call, then add the following line. You
will get REST invocation over POST.
options.setProperty(org.apache.axis2.transport.http.Constants.Configuration.ENABLE_REST,
"true")
}
-- Chinthaka
Harbarth, Juliane wrote:
>
>
> Hi,
>
> I am still struggeling to compile the REST POST sample contained in
> the Axis2 docu page 'RESTful Web services Support', see
> http://ws.apache.org/axis2/0_94/rest-ws.html.
>
> I tried my best to add appropriate import statements, but failed.
>
> My current imports are:
>
> import org.apache.axis2.*;
> import org.apache.axis2.client.*;
> import org.apache.axis2.transport.http.*;
> import org.apache.axis2.addressing.EndpointReference;
> import org.apache.axiom.om.*;
> import javax.xml.stream.*;
> import org.apache.axis.client.*;
>
> I have also replaced the line:
> options.setListenerTransportProtocol(Constants.TRANSPORT_HTTP);
> with:
> options.setListener(new SimpleHTTPServer());
> and:
> Call call = new Call();
> with
> Service service = new Service();
> Call call = (Call)service.createCall();
>
> The result is as follows:
>
> E:\local\axis2>javac RESTClient.java
> RESTClient.java:24: cannot resolve symbol
> symbol : method setClientOptions (org.apache.axis2.client.Options)
> location: class org.apache.axis.client.Call
> call.setClientOptions(options);
> ^
> RESTClient.java:26: cannot resolve symbol
> symbol : method invokeBlocking
> (java.lang.String,org.apache.axiom.om.OMElement)
> location: class org.apache.axis.client.Call
> OMElement result = call.invokeBlocking("echo", getPayload());
> ^
> RESTClient.java:46: cannot resolve symbol
> symbol : method createText
> (org.apache.axiom.om.OMElement,java.lang.String)
> location: interface org.apache.axiom.om.OMFactory
> value.addChild(fac.createText(value, "Axis2 Echo String "));
> ^
> 3 errors
>
> I am especially bewildered by the Call class. Taking the one from axis
> seems
> odd, since importing stuff from both axis and axis2 is rather unusual. I
> tried
> jaxrpc.jar but this did not work neither.
>
> What am I doing wrong ?
>
> Regards,
> Juliane.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>