title: IBM MobileFirst Sending JSON Body from iOS SDK to Java Adapter
body: <p>Using IBM Mobile First PlatForm Version 7.1 I am trying to call a Java Adapter from iOS Application using following code.</p>
  
  <pre><code>    [[WLResourceRequest requestWithURL:url method:WLHttpMethodPost] sendWithJSON:@{@"one":@"two"} completionHandler:^(WLResponse *response, NSError *error) {
  
      NSLog(@"%@",response);
      NSLog(@"%@",error);
  
      }];
  </code></pre>
  
  <p>Java Method on adapter side looks as following.</p>
  
  <pre><code>@POST
  @Consumes("application/json")
  @Produces("application/json")
  public String hello(JSONObject body){
      return body.toString();
  }
  </code></pre>
  
  <p>But I get Following error in response </p>
  
  <blockquote>
    <p>2016-04-20 11:31:15.520 mbs-call[15092:3787968] Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: unsupported media type (415)" UserInfo={com.alamofire.serialization.response.error.response= { URL: http:/0.0.0.0:10080/mbs-api/adapters/basicadpt/users } { status code: 415, headers {
        Connection = Close;
        "Content-Language" = "en-US";
        "Content-Length" = 0;
        Date = "Wed, 20 Apr 2016 02:31:15 GMT";
        "X-Powered-By" = "Servlet/3.0";
    } }, NSErrorFailingURLKey=<a href="http://0.0.0.0:10080/mbs-api/adapters/basicadpt/users" rel="nofollow">http://0.0.0.0:10080/mbs-api/adapters/basicadpt/users</a>, com.alamofire.serialization.response.error.data=&lt;>, NSLocalizedDescription=Request failed: unsupported media type (415)}</p>
  </blockquote>
  
  <p>And it seems that in iOS SDK it adds header <code>application/x-www-url-form-urlencoded</code> in request when any method is called.</p>
  
  <p><strong>I have following 2 questions.</strong></p>
  
  <ol>
  <li>How to pass JSON Body to Java adapter?</li>
  <li>Behaviour of <code>sendWithJSON</code> is different on iOS and Android. On Android it seems to add <code>application/json</code> header when we call adapter. Is that a bug or part of behaviour?</li>
  </ol>