0
votes

I need to consume an Axis2 web service with an Android application. The Axis2 service is using JDK1.5 if it makes any difference.

I made Axis2 give JSON outputs. This turned out to be relatively simple, simply by modifying axis2.xml and adding the correct MessageFormatter and MessageBuilder.

Calling the service with the URL now results in a JSON output, and I can pass parameters in by modifying the request url:

http://myServer.com/axis2/Services/myService/myOperation?
    param1=asdf&response=application/json/badgerfish

However, I can't seem to make calls that are accepted by actually sending JSON requests. The requests seem to be well-formed JSON, but the service rejects them. Looking at the Axis2 documentation, it looks like it would be easy if I was using the Axis2 stub (steps 2 and 3). However, I'm not (I can't seem to get Axis2 client code to work on Android, but that's a different story).

How can I send JSON requests to a JSON enabled Axis2 service?

1

1 Answers

0
votes

The only way you can do this is by using the RawXMLInOutMessageReceiver, and parse the XML payload yourself. Axis2 JSON support is very weak, and you can't use it along with data binding.

See the comment from the author himself. http://isurues.wordpress.com/2009/10/06/how-to-use-axis2-json/