Java JAXB解组异常:意外的元素WebServiceTemplate spring启动

Java JAXB解组异常:意外的元素WebServiceTemplate spring启动,java,spring,spring-boot,spring-mvc,jaxb,Java,Spring,Spring Boot,Spring Mvc,Jaxb,我在一个spring boot项目中工作,我试图使用WebServiceTemplate发出SOAP请求,但出现以下错误: javax.xml.bind.UnmarshalException: unexpected element (URI : "http://schemas.xmlsoap.org/soap/envelope/", local : "Fault"). the expected elements are <{urn:xtk:sessi

我在一个spring boot项目中工作,我试图使用WebServiceTemplate发出SOAP请求,但出现以下错误:

javax.xml.bind.UnmarshalException: unexpected element (URI : "http://schemas.xmlsoap.org/soap/envelope/", local : "Fault"). the expected elements are <{urn:xtk:session}Logon>,<{urn:xtk:session}LogonResponse>
包裹信息类别:

@javax.xml.bind.annotation.XmlSchema(namespace = "urn:xtk:session", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package com.api.soap;
我的配置类:

@Configuration
public class SoapConfig {
    
    @Bean
    public Jaxb2Marshaller marshaller() {
        
        Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
        marshaller.setPackagesToScan(new String[]{
                 "com.api.soap"
        });
        
        return marshaller;  
    }
}
最后,这是我调用soap WS的方法:

Logon logonRequest=新登录()

你知道我为什么会出现这个错误吗请:

javax.xml.bind.UnmarshalException: unexpected element (URI : "http://schemas.xmlsoap.org/soap/envelope/", local : "Fault"). the expected elements are <{urn:xtk:session}Logon>,<{urn:xtk:session}LogonResponse>
javax.xml.bind.UnmarshaleException:意外元素(URI:http://schemas.xmlsoap.org/soap/envelope/“,局部:“故障”)。预期的要素包括:,
致以最良好的祝愿

@Configuration
public class SoapConfig {
    
    @Bean
    public Jaxb2Marshaller marshaller() {
        
        Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
        marshaller.setPackagesToScan(new String[]{
                 "com.api.soap"
        });
        
        return marshaller;  
    }
}
logonRequest.setSessiontoken("");
logonRequest.setStrLogin("myusername"); //
logonRequest.setStrPassword("mypassword");  //

webServiceTemplate = new WebServiceTemplate(marshaller);
LogonResponse logonResponse = (LogonResponse) webServiceTemplate.marshalSendAndReceive("http://ws-soap-serv.com",logonRequest);
    
javax.xml.bind.UnmarshalException: unexpected element (URI : "http://schemas.xmlsoap.org/soap/envelope/", local : "Fault"). the expected elements are <{urn:xtk:session}Logon>,<{urn:xtk:session}LogonResponse>