Setting encoding to application/json

Hi all,

I’m doing a mobile app that connects to an IS which has the xWmJSON package content handlers running.

For the content handlers to activate, the post data from the mobile app must be sent using application/json in Content-Type.

How can I do this in wMMD? There are only four encoding formats in the HttpConnectionHandler and application/json is not one of those.



Jesper Loell | Solution Architect | Software AG | +45 2245 7356

Hi Jesper,

If you take a look inside the class you’ll see those headers from the encoding formats are set using the setPostHeaders() method. If you want to customize that routine, I’d guess the simplest way would be to create a class which extends HttpConnectionHandler and implements that method. Something like this:

public class HttpConnectionHandlerCustom extends HttpConnectionHandler


        public static final int Encoding_JSON = 4;

        public void setPostHeaders() throws IOException



                    if (init_encoding_format == Encoding_JSON)


                                conn.setRequestProperty ("Content-Type", "application/json");

                                conn.setRequestProperty ("Accept", "*/*");




I’ll also look to see if we can add this to our current list where appropriate.



I believe you may also be able to override this by passing in custom "String request_properties []" to the existing openHttpConnection… method.