Sergey,

Do you maybe have any example of a WADL including such multiparts which do not only generate as MultipartBody?

Best regards,
Johannes


Am 18.08.2016 um 17:05 schrieb Sergey Beryozkin:
WADL is currently underspecified with respect to handling complex multiparts, that is why MultipartBody is generated. In some simple cases @Multipart parameters can be generated to repesent simple multiparts, or have InputStream as a parameter

Sergey
On 18/08/16 15:21, J. Fiala wrote:
p.s. a basic multipart like

<representation mediaType="multipart/form-data" />

works, but then I only get the generic MultipartBody generated without
any hint to the client how to assemble it correctly.

Best regards,
Johannes


Am 18.08.2016 um 16:13 schrieb J. Fiala:
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







Reply via email to