title: CXF JAXRS - How to POST more than one parameter
body: <p>How do I send more than one parameter in request body in a POST request?</p>
  
  <pre class="lang-java prettyprint-override"><code>@POST
  @Consumes("multipart/form-data")
  @Produces("application/json")
  public String addForm1(@FormParam("i1") Integer i1, @FormParam("i2") Integer i2);
  </code></pre>
  
  <p>Above code returns HTTP 415.</p>
  
  <p>Replacing <code>@FormParam</code> with <code>@Multipart</code> results in <code>Resource method has more than one parameter representing a request body</code> error, as shown below.</p>
  
  <pre><code>SEVERE: Resource method service.rs.TestService.postData2 has more than one parameter representing a request body
  Exception in thread "main" org.apache.cxf.jaxrs.client.ClientWebApplicationException: Resource method service.rs.TestService.postData2 has more than one parameter representing a request body
  at org.apache.cxf.jaxrs.client.ClientProxyImpl.reportInvalidResourceMethod(ClientProxyImpl.java:546)
  at org.apache.cxf.jaxrs.client.ClientProxyImpl.getParametersInfo(ClientProxyImpl.java:214)
  at org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:138)
  at $Proxy20.postData2(Unknown Source)
  at service.TestServiceClient.main(TestServiceClient.java:82)
  </code></pre>
  
  <p>Also, what do I need to do in order to pass multiple complex types such as <code>List&lt;Map&lt;String, String&gt;&gt;' or 'List&lt;MyNestedCustomObject&gt;</code> in a POST method? I'm able to pass such parameter by using <code>JAXB</code> and annotating it with <code>@XmlJavaTypeAdapter</code>, but I guess that doesn't work in case of passing multiple parameters? Would I be required to define my own message body readers &amp; writers? Any sample code would be useful.</p>
  
  <p>Thanks</p>