I'm trying to connect to a Spring Hessian service. I get this error:
"java.net.ProtocolException: Does not support output" when calling
c.getOutputStream(). Should I be using some other HTTP API for this?
Is there any better way to do remote procedure calls with Android?
Thanks for any help!
private String getHello() throws IOException {
URL url= new
URL("http://localhost:8069/hm/remoting/ServerService");
HttpURLConnection c = (HttpURLConnection) url.openConnection();
OutputStream os = c.getOutputStream();
MicroHessianOutput out = new MicroHessianOutput(os);
out.startCall("hello");
out.writeString("echo");
out.completeCall();
os.flush();
InputStream is = c.getInputStream();
MicroHessianInput in = new MicroHessianInput(is);
in.startReply();
String value = in.readString();
in.completeReply();
return value;
}
09-29 15:26:22.332: WARN/System.err(231): java.net.ProtocolException:
Does not support output
09-29 15:26:22.412: WARN/System.err(231): at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:
1078)
09-29 15:26:22.433: WARN/System.err(231): at
com.hm.hm.getHello(hm.java:94)
09-29 15:26:22.453: WARN/System.err(231): at
com.hm.hm.onCreate(hm.java:38)
09-29 15:26:22.463: WARN/System.err(231): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1122)
09-29 15:26:22.482: WARN/System.err(231): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2103)
09-29 15:26:22.493: WARN/System.err(231): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2156)
09-29 15:26:22.514: WARN/System.err(231): at
android.app.ActivityThread.access$1800(ActivityThread.java:112)
09-29 15:26:22.522: WARN/System.err(231): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1580)
09-29 15:26:22.532: WARN/System.err(231): at
android.os.Handler.dispatchMessage(Handler.java:88)
09-29 15:26:22.542: WARN/System.err(231): at
android.os.Looper.loop(Looper.java:123)
09-29 15:26:22.542: WARN/System.err(231): at
android.app.ActivityThread.main(ActivityThread.java:3742)
09-29 15:26:22.553: WARN/System.err(231): at
java.lang.reflect.Method.invokeNative(Native Method)
09-29 15:26:22.562: WARN/System.err(231): at
java.lang.reflect.Method.invoke(Method.java:515)
09-29 15:26:22.573: WARN/System.err(231): at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:739)
09-29 15:26:22.583: WARN/System.err(231): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497)
09-29 15:26:22.593: WARN/System.err(231): at
dalvik.system.NativeStart.main(Native Method)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---