Spring boot Spring soap ws未在xml标记中没有命名空间前缀的请求下运行

Spring boot Spring soap ws未在xml标记中没有命名空间前缀的请求下运行,spring-boot,soap,Spring Boot,Soap,我有一个已经生成的wsdl文件,我正在使用它来编写springboot soap ws,但是当我在soapUi中加载该wsdl文件以创建一个测试我的ws的请求时,我得到了一个请求,该请求缺少带有名称空间前缀的嵌套标记。在触发该请求时,springboot给出了saaj soap异常,由于没有前缀标记,出现404错误 当我手动将名称空间前缀添加到所有标记时,ws正常工作 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/s

我有一个已经生成的wsdl文件,我正在使用它来编写springboot soap ws,但是当我在soapUi中加载该wsdl文件以创建一个测试我的ws的请求时,我得到了一个请求,该请求缺少带有名称空间前缀的嵌套标记。在触发该请求时,springboot给出了saaj soap异常,由于没有前缀标记,出现404错误

当我手动将名称空间前缀添加到所有标记时,ws正常工作

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservice.studentinfo.com/">
   <soapenv:Header/>
   <soapenv:Body>
      <web:studentData>
         <student>
               <name>?</name>
               <roll_number>?</roll_number>
               <address>
                  <house_number>?</house_number>
                  <street>?</street>
                  <city>?</city>
                  <state>?</state>
               </address>
            </student>
    </web:studentData>
   </soapenv:Body>
</soapenv:Envelope>

?
?
?
?
?
?

如果我在标记内的所有嵌套标记中添加“web:”,那么我的ws将按预期工作,但对于上述请求,它不会工作。由于我无法将wsdl格式更改为某个第三方应用程序的输出,是否有任何方法,通过调用此请求本身,我将使ws正常工作。

您可以像这样在配置中添加特定的映射器

public class MyNamespaceMapper extends NamespacePrefixMapper {

private static final String FOO_PREFIX = ""; // DEFAULT NAMESPACE
private static final String FOO_URI = "http://www.example.com/FOO";

private static final String BAR_PREFIX = "bar";
private static final String BAR_URI = "http://www.example.com/BAR";

@Override
public String getPreferredPrefix(String namespaceUri, String suggestion, boolean requirePrefix) {
    if(FOO_URI.equals(namespaceUri)) {
        return FOO_PREFIX;
    } else if(BAR_URI.equals(namespaceUri)) {
        return BAR_PREFIX;
    }
    return suggestion;
}

@Override
public String[] getPreDeclaredNamespaceUris() {
    return new String[] { FOO_URI, BAR_URI };
}

}
你可以跟着这个。但是,您需要添加此配置SpringWS,这可能是SpringWS的问题