Hello,
I defined a Multipart in the WADL (I'd like to use a multipart with both
json data + binary data):
<resource path="/createMultipart">
<method name="POST">
<request>
<param name="name" style="query"
type="xs:string" required="true"/>
<representation mediaType="application/json"
element="mytypes:CreateMultipartRequestType"/>
</request>
<response status="200">
<representation mediaType="application/json"
element="xs:string"/>
</response>
</method>
</resource>
<xs:complexType name="CreateMultipartRequestType">
<xs:sequence>
<xs:element name="requestModel"
type="mytypes:CreateRequestType" />
<xs:element name="payload" type="xs:base64Binary"
xmime:expectedContentTypes="application/octet-stream"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="CreateRequestType">
<xs:sequence>
<xs:element minOccurs="1" name="description"
type="xs:string" />
</xs:sequence>
</xs:complexType>
The generated Java code looks fine:
@POST
@Consumes("application/json")
@Produces({"application/json" })
@Path("/createMultipart")
String postCreateMultipart(@QueryParam("name") String name,
CreateRequestType createRequestType);
public class CreateMultipartRequestType {
@XmlElement(required = true)
@NotNull
@Valid
protected CreateRequestType requestModel;
@XmlElement(required = true)
@XmlMimeType("application/octet-stream")
@NotNull
protected DataHandler payload;
}
However, when I try to invoke the service using JacksonProvider, I get:
WARNING: Interceptor for {http://myns/}MyResource has thrown exception,
unwinding now
org.apache.cxf.interceptor.Fault: No message body writer has been found
for class at.hello.CreateMultipartRequestType, ContentType: application/json
Any idea how I have to specify the Multipart in the WADL to get it working?
Best regards,
Johannes