soapexceptionimpl:保存多部分消息期间的错误
我正在使用Springboot 2.7.0使用Java 8。我有一些WSDL文件使用Maven-Jaxb2-Plugin
插件来生成一些代码。然后,我创建一个SOAP客户端来尝试调用SOAP服务:
SOAP客户端
public List<SupplierInfo> getAvailableSuppliers() {
ObjectFactory factory = new ObjectFactory();
GetAvailableSuppliersRequest req = new GetAvailableSuppliersRequest();
JAXBElement<GetAvailableSuppliersRequest> request = factory.createGetAvailableSuppliersRequest(req);
GetAvailableSuppliersResponse response = (GetAvailableSuppliersResponse) getWebServiceTemplate().marshalSendAndReceive(request);
return response.getSupplierInfo();
}
配置
@Configuration
public class AvailabilitySOAPClientConfig {
@Bean
public Jaxb2Marshaller marshaller() {
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
//marshaller.setContextPath("com.mycompany.restosgi.soap.generated");
marshaller.setPackagesToScan("com.mycompany.restosgi.soap.generated", "com.mycompany.transit._2008a.availability");
return marshaller;
}
@Bean
public AvailabilitySOAPClient availabilitySOAPClient(Jaxb2Marshaller marshaller) {
AvailabilitySOAPClient client = new AvailabilitySOAPClient();
client.setDefaultUri("http://localhost:8080/ws");
client.setMarshaller(marshaller);
client.setUnmarshaller(marshaller);
return client;
}
}
当我调用SOAP客户端时,我会收到以下错误:
无法处理错误domsource:检查saxon8-dom.jar是 在classPath上
SAAJ0539:无法在Savechanges中获得标题流
SAAJ0540:保存多部分消息期间的错误
org.springframework.ws.soap.saaj.saajsoapmessageexception:不能 将消息写入outputStream:保存多部分期间的错误 信息;嵌套异常是 com.sun.xml.internal.messaging.saaj.soapexceptionimpl:错误 保存多部分消息
I am using Java 8 with SpringBoot 2.7.0. I have some WSDL files that I use to generate some code using the maven-jaxb2-plugin
plugin. I then create a SOAP client to try invoke the SOAP services:
SOAP Client
public List<SupplierInfo> getAvailableSuppliers() {
ObjectFactory factory = new ObjectFactory();
GetAvailableSuppliersRequest req = new GetAvailableSuppliersRequest();
JAXBElement<GetAvailableSuppliersRequest> request = factory.createGetAvailableSuppliersRequest(req);
GetAvailableSuppliersResponse response = (GetAvailableSuppliersResponse) getWebServiceTemplate().marshalSendAndReceive(request);
return response.getSupplierInfo();
}
Config
@Configuration
public class AvailabilitySOAPClientConfig {
@Bean
public Jaxb2Marshaller marshaller() {
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
//marshaller.setContextPath("com.mycompany.restosgi.soap.generated");
marshaller.setPackagesToScan("com.mycompany.restosgi.soap.generated", "com.mycompany.transit._2008a.availability");
return marshaller;
}
@Bean
public AvailabilitySOAPClient availabilitySOAPClient(Jaxb2Marshaller marshaller) {
AvailabilitySOAPClient client = new AvailabilitySOAPClient();
client.setDefaultUri("http://localhost:8080/ws");
client.setMarshaller(marshaller);
client.setUnmarshaller(marshaller);
return client;
}
}
When I call the SOAP client, I get the following error:
Error DOMSource cannot be processed: check that saxon8-dom.jar is
on the classpathSAAJ0539: Unable to get header stream in saveChanges
SAAJ0540: Error during saving a multipart message
org.springframework.ws.soap.saaj.SaajSoapMessageException: Could not
write message to OutputStream: Error during saving a multipart
message; nested exception is
com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Error during
saving a multipart message
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将以下内容添加到我的POM中,解决了我的问题。
Adding the following to my pom, fixed my issue.
我在Springboot 3中面临同样的错误。
不包括以下依赖关系对我有所帮助。
I was facing same error in springboot 3.
Excluding below dependencies helped me.