I currently have a SOAP Web service in Axis2!
For using the web services for mobile applications I'm trying to send the messages in JSON. This way, less text has to be send. (I know it's probably better for using rest + json, but now I'm looking for a quick temporary fix)

I have a generated client (with a stub), which generates soap messages, sends the messages and parses the response. All this in xml.

I'm trying to alter this so I can send JSON messages instead of xml.

What have I done? :

- in axis2.xml : added
Java Code:
                <messageFormatter contentType="application/json"
                <!-- more message formatters -->

                <messageBuilder contentType="application/json"
                <!-- more message builders -->
- In the client code:
Java Code:
File configFile = new File("axis2.xml");
		ConfigurationContext confContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, configFile.getAbsolutePath());
		this._webservice = new Tunify2Stub(confContext, tunifyURL);
		this._webservice._getServiceClient().getOptions().setProperty(Constants.Configuration.MESSAGE_TYPE, "application/json");

the Tunify2Stub constructor uses the configurationContext and the url of the WSDL
- the loginUser method basically does:
Java Code:
 LoginUserResponse response = this._webservice.loginUser(loginUser);
with the correct loginUser object.

When I run this code with de messageType "application/soap+xml" there is no problem. The request is handled perfectly.
But when I change the messageType to "application/json" (used in axis2.xml), I guess the request is parsed to JSON and sent to the server, but then I receive a fault of "unexpected subelement ..." , which is the case when the server receives a request which is in conflict with the wsdl.

Does anyone know a possible reason for this ?
I tried many things and searched a long time on the web, but no solution.

my json request looks like this:
Java Code:
Is there something wrong with the construction of the generated JSON ?

Thanks in advance!!