Java 是否可以生成填充了安全标头的WSDL?

Java 是否可以生成填充了安全标头的WSDL?,java,spring,soap,wsdl,Java,Spring,Soap,Wsdl,我目前正在处理WSDLs文件,在我的项目中,我使用SpringWS和DefaultWsdl11Definition从XSD生成WSDLs。关键是头是空的,我想用已经创建的安全标签生成一个头 我希望生成具有此类标头的WSDL文件: <soapenv:Header> <wsse:Security soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns:ws

我目前正在处理WSDLs文件,在我的项目中,我使用SpringWS和DefaultWsdl11Definition从XSD生成WSDLs。关键是头是空的,我想用已经创建的安全标签生成一个头

我希望生成具有此类标头的WSDL文件:

<soapenv:Header>
<wsse:Security soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
        <wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
            <wsse:Username>?</wsse:Username>
            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">?</wsse:Password>
        </wsse:UsernameToken>
    </wsse:Security>
</soapenv:Header>

?
?

我今天使用的WSDL生成了一个空的头。我想知道是否可以创建一个WSDL,生成一个已经填充了安全标签的头。

是-您可以通过在配置类中定义以下内容,将Apache的
Wss4j
与Spring的
Wss4jSecurityInterceptor
结合使用:

@Bean
public Wss4jSecurityInterceptor securityInterceptor() {
    Wss4jSecurityInterceptor interceptor = new Wss4jSecurityInterceptor();
    interceptor.setSecurementActions("UsernameToken");
    interceptor.setSecurementUsername("?");
    interceptor.setSecurementPassword("?");
    return interceptor;
}

是-通过在配置类中定义以下内容,可以将Apache的Wss4j与Spring的Wss4jSecurityInterceptor一起使用:

@Bean
public Wss4jSecurityInterceptor securityInterceptor() {
    Wss4jSecurityInterceptor interceptor = new Wss4jSecurityInterceptor();
    interceptor.setSecurementActions("UsernameToken");
    interceptor.setSecurementUsername("?");
    interceptor.setSecurementPassword("?");
    return interceptor;
}

嗨,谢谢你的回答。你有没有关于WSDL的例子?你解决了这个问题了吗?我也面临着同样的问题,如何设置操作值。。我有用户id和密码。嗨,谢谢你的回答。你有没有关于WSDL的例子?你解决了这个问题了吗?我也面临着同样的问题,如何设置操作值。。我有用户id和密码。