Код: Выделить всё
VeryLongDataBlobInHere
pdf
Код: Выделить всё
pdf
Код: Выделить всё
pdf
Код: Выделить всё
@Configuration
public class Jaxb2MarshallerConfig {
@Bean
public Jaxb2Marshaller myMarshaller() {
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
marshaller.setContextPath("com.company.project.xsd.some_portal.v4_0");
marshaller.setMtomEnabled(true);
return marshaller;
}
}
Код: Выделить всё
private BinaryData buildBinaryData(byte[] documentData) {
BinaryData binaryData = new BinaryData();
byte[] encodedData = Base64.getEncoder().encode(documentData);
DataHandler dataHandler = new DataHandler(encodedData, "application/pdf");
binaryData.setBlob(dataHandler);
binaryData.setExtension("pdf");
return binaryData;
}
Код: Выделить всё
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "BinaryData", propOrder = {
"blob",
"extension"
})
public class BinaryData {
@XmlElement(required = true)
@XmlMimeType("application/octet-stream")
protected DataHandler blob;
@XmlElement(required = true)
protected String extension;
[...]
}
Код: Выделить всё
@Component
@Log4j2
public class MySoapClient extends WebServiceGatewaySupport {
private final WebServiceTemplate template;
public MySoapClient (
MyServiceProperties properties,
Jaxb2Marshaller marshaller
) {
setMarshaller(marshaller);
setUnmarshaller(marshaller);
setDefaultUri(properties.getTargetUrl());
template = getWebServiceTemplate();
}
@Override
public void sendDocuments(MyRequest request) {
try {
template.marshalSendAndReceive(request);
} catch (Exception e) {
log.error(e, e.getCause());
throw new RuntimeException(e);
}
}
}
Есть ли у кого-нибудь идеи, как заставить маршаллер записать встроенный объект blob? Или проблема где-то в другом?
Подробнее здесь: https://stackoverflow.com/questions/791 ... a-jaxb2-mt
Мобильная версия