Java 在Spring Boot中使用SOAP Web服务时面临SoapFaultClientException
在spring boot中更改此插件生成的package-info.java文件Java 在Spring Boot中使用SOAP Web服务时面临SoapFaultClientException,java,spring,spring-boot,soap-client,Java,Spring,Spring Boot,Soap Client,在spring boot中更改此插件生成的package-info.java文件 <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <plugin>
<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>
那么,我们可以在从wsdl文件生成java类的同时,对插件jaxb2生成的package-info.java文件进行更改吗?
或者这个例外说明了什么
这是我的package-info.java文件
@javax.xml.bind.annotation.XmlSchema(namespace = "http://CRMEligibilityGS")
package com.example.demo.schemas.eligibility.test;
在SpringBoot2.1.4.0版本中使用Java8
客户端类代码
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;
}
这个错误告诉了你其他的事情。您从服务器收到错误。从请求的服务器收到错误?此行
WebServiceTemplate.doSendReceive(WebServiceTemplate.java:624
(查看源代码时)仅在处理响应时调用。因此,是的,您从服务器收到错误。可能您的请求不正确(缺少字段或其他内容,请检查服务器)。erorr消息包含一个错误代码BIP3113E。这可能有帮助?但可能与您更改了自己的内容有关,使请求无效。我不清楚的是您是否更改了生成的代码?如果是,原因是什么?您通常不应该这样做。好的,谢谢,但我已再次检查,没有遗漏任何内容请求正文中的ide。如果我在package-info.java文件中更改了某些内容,那么请求将无法正确解析并发送到我试图用@javax.xml.bind.annotation.XmlSchema(namespace=“)替换@javax.xml.bind.annotation.XmlSchema(namespace=”的服务器,这不是问题吗,elementFormDefault=javax.xml.bind.annotation.XmlNsForm.QUALIFIED)以避免此异常javax.xml.bind.unmarshaleException:意外元素否则将始终面对此异常。
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;
}