How to input the payload into a custom connector mule 4

Viewed 15

Trying to pass my custom connector the payload as a argument. Currently I've given it the type of a byte array, as that is the format I need it in. It worked when I was using it as an invoke static. But now it doesn't like taking the payload as an argument.

@MediaType(value = ANY, strict = false)
public void uploadFileStream(@Config WebDAVConfiguration configuration, String directoryName, String filename, byte[] data) throws IOException {
        Sardine sardine = SardineFactory.begin(configuration.getUserName(),configuration.getPassword());
        sardine.put(searchForResource(sardine, configuration.getbasePath(), directoryName)+filename,data);
    }

Error I recieve:

Message : "Cannot instantiate class '[B' Caused by: [B" evaluating expression: "payload". Element : pricebook_putdatastream_flow/processors/4 @ pricebook_conversion:pricebook_conversion.xml:48 (Upload file stream) Element DSL : <webdav:upload-file-stream doc:name="Upload file stream" doc:id="981aded3-0aa8-4e44-a8aa-7ed44fda1894" config-ref="Webdav_Config" directoryName="#[vars.dirname]" filename="#[vars.filename]" data="#[payload]"></webdav:upload-file-stream> Error type : MULE:EXPRESSION FlowStack : at pricebook_putdatastream_flow(pricebook_putdatastream_flow/processors/4 @ pricebook_conversion:pricebook_conversion.xml:48 (Upload file stream))

0 Answers
Related