在 Spring Boot 中使用 SOAP Web 服务时面临 SoapFaultClientException

问题描述 投票:0回答:1

在 Spring Boot 中更改此插件生成的 package-info.java 文件

<plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>org.jvnet.jaxb2.maven2</groupId>
            <artifactId>maven-jaxb2-plugin</artifactId>
            <version>0.13.2</version>
            <executions>
                <execution>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <generatePackage>com.example.demo.schemas.eligibility.test</generatePackage>
                <generateDirectory>${project.basedir}/src/main/java</generateDirectory>
                <schemaDirectory>${project.basedir}/src/main/resources/wsdl</schemaDirectory>
                <schemaIncludes>
                    <include>*.wsdl</include>
                </schemaIncludes>
            </configuration>
        </plugin>

我收到此异常,表明我们无法更改 SOAP Xml 类的 package-info.java 文件。

org.springframework.ws.soap.client.SoapFaultClientException: BIP3113E: Exception detected in message flow gen.CRMEligibilityGS.SOAP Input (broker PTCLDEVBK01) 
    at org.springframework.ws.soap.client.core.SoapFaultMessageResolver.resolveFault(SoapFaultMessageResolver.java:38) ~[spring-ws-core-3.0.7.RELEASE.jar:na]
    at org.springframework.ws.client.core.WebServiceTemplate.handleFault(WebServiceTemplate.java:830) ~[spring-ws-core-3.0.7.RELEASE.jar:na]
    at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:624) ~[spring-ws-core-3.0.7.RELEASE.jar:na]
    at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:555) ~[spring-ws-core-3.0.7.RELEASE.jar:na]
    at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:390) ~[spring-ws-core-3.0.7.RELEASE.jar:na]
    at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:378) ~[spring-ws-core-3.0.7.RELEASE.jar:na]
    at com.example.demo.config.SOAPConnector.callWebService(SOAPConnector.java:8) ~[classes/:na]
    at com.example.demo.client.SoapClient.getCustmoerEligibilityResponse(SoapClient.java:25) ~[classes/:na]
    at com.example.demo.EligibilityRestController.getCountryDetails(EligibilityRestController.java:31) ~[classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_181]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_181]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_181]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_181]

那么我们可以在从 wsdl 文件生成 java 类的同时对插件 jaxb2 生成的 package-info.java 文件进行更改吗? 或者这个异常说明了其他事情?

这是我的 package-info.java 文件

@javax.xml.bind.annotation.XmlSchema(namespace = "http://CRMEligibilityGS")
package com.example.demo.schemas.eligibility.test;

将 Java 8 与 Spring Boot 2.1.4.RELEASE 结合使用

客户端类代码

 public CRMEligibilityGSResponse getCustmoerEligibilityResponse(CRMEligibilityGS eligibilityRequest) {
        webServiceTemplate = new WebServiceTemplate(jaxMarshaller);
        CRMEligibilityGSResponse response = (CRMEligibilityGSResponse) webServiceTemplate.marshalSendAndReceive("http://abcxyz?wsdl", eligibilityRequest);    // url is sample actual one is different that also ends with ?wsdl and url is private
        System.out.println("Response is :"+ response);
        return response;
    }
java spring spring-boot soap-client
1个回答
0
投票

SoapFaultClientException - 正如所提到的,例如在文档中 - 这是一个错误,表明问题发生在服务器端而不是客户端。服务器响应错误,导致调用方出现 SoapFaultClientException。

你检查过服务器端吗?

© www.soinside.com 2019 - 2024. All rights reserved.