soapexceptionimpl:保存多部分消息期间的错误

发布于 2025-01-22 18:51:25 字数 1798 浏览 1 评论 0原文

我正在使用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 classpath

SAAJ0539: 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

意中人 2025-01-29 18:51:25

将以下内容添加到我的POM中,解决了我的问题。

<!-- https://mvnrepository.com/artifact/net.sf.saxon/saxon-dom -->
<dependency>
    <groupId>net.sf.saxon</groupId>
    <artifactId>saxon-dom</artifactId>
    <version>8.7</version>
</dependency>

Adding the following to my pom, fixed my issue.

<!-- https://mvnrepository.com/artifact/net.sf.saxon/saxon-dom -->
<dependency>
    <groupId>net.sf.saxon</groupId>
    <artifactId>saxon-dom</artifactId>
    <version>8.7</version>
</dependency>
遥远的她 2025-01-29 18:51:25

我在Springboot 3中面临同样的错误。

不包括以下依赖关系对我有所帮助。

        <exclusions>
            <exclusion>
                <artifactId>xalan</artifactId>
                <groupId>xalan</groupId>
            </exclusion>
            <exclusion>
                <artifactId>xercesImpl</artifactId>
                <groupId>xerces</groupId>
            </exclusion>
        </exclusions>

I was facing same error in springboot 3.

Excluding below dependencies helped me.

        <exclusions>
            <exclusion>
                <artifactId>xalan</artifactId>
                <groupId>xalan</groupId>
            </exclusion>
            <exclusion>
                <artifactId>xercesImpl</artifactId>
                <groupId>xerces</groupId>
            </exclusion>
        </exclusions>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文