jaxb生成的class-jaxb解组异常

11dmarpk  于 2021-07-14  发布在  Java
关注(0)|答案(0)|浏览(124)

我使用maven-jaxb2-plugin版本0.14.0为我的soap调用生成所有模型。它工作得很好,但是如果我有一个空的请求/响应,它就不会生成java类,例如: <wsdl:message name="exampleResponse"/> 对于wsdl中的这个标记,jaxb2插件不会生成任何类。
我将spring boot 2与webservicetemplate一起使用,请求已成功发送,但在尝试解组响应时出现异常: JAXB unmarshalling exception; nested exception is javax.xml.bind.UnmarshalException: unexpected element (uri:"myUri", local:"exampleResponse" 实际结果是:

<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/>
    <soapenv:Body>
        <ns:exampleResponse xmlns:ns=myuri?wsdl>
            <ns:return xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:nil="true" />
        </ns:exampleResponse >
    </soapenv:Body>
</soapenv:Envelope>

以下是我的配置:

<configuration>
    <args>
        <arg>-XautoNameResolution</arg>
    </args>
    <schemaLanguage>WSDL</schemaLanguage>
    <generatePackage>my.package</generatePackage>
    <generateDirectory>src/main/java</generateDirectory>
    <schemas>
        <schema>
            <url>my-url?wsdl</url>
        </schema>
    </schemas>
</configuration>

有没有办法强制maven-jaxb2-plugin为wsdl中的空标记生成java类?
ps:我不能以任何方式更改wsdl。
谢谢

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题