MTOM附件Base64 WebService

时间:2019-05-09 19:20:44

标签: mtom

我正在尝试将附件添加为Base64,而不是内联。我可以毫无疑问地将附件添加为MTOM binaryBase64,但是我不能仅仅将其作为Base64。反正有指定吗?感谢您的反馈

import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlMimeType;

public class TestClass {

    @XmlElement
    String message = "HI THERE";
    @XmlMimeType("application/octet-stream")
    DataHandler image;
    @XmlMimeType("text/plain")
    DataHandler pdf;

    TestClass() {
        image = new DataHandler(new FileDataSource("D://images//nacho.jpg"));
        pdf = new DataHandler(new FileDataSource("D://testPdf.pdf"));
    }

}

WebService

public class AdditionalServiceImpl {

    @Override
    public TestClass getStuff(String xml) {
        TestClass t = new TestClass();
        return t;
    }
}

0 个答案:

没有答案