WsDeploymentException:无法从URI'#UsernameToken'中检索策略

问题描述

我已经开发了一个Web服务客户端,并已部署在weblogic 11g上。该程序用于将肥皂消息发送给第三方。当它由JDeveloper运行时,我可以获取端口并完美地从服务器端获取响应。但是,当它在weblogic服务器上运行时,出现“无法从URI'#Usernametoken'检索策略”。

这是我程序的代码

URL url = new URL("https://example.org:xxx/XXXInterface/XXXInterfaceWebS?wsdl");

XXXInterfaceWebS ws = new XXXInterfaceWebS(url,new QName("http://example.org/","XXXInterfaceWebS"));
SecurityPoliciesFeature securityFeatures = new SecurityPoliciesFeature(new String[] { "oracle/wss_username_token_client_policy" });
XXXInterfacePortType wsClient = ws.getXXXInterfacePortTypePort(securityFeatures);
...

WSDL由第三方维护,我无法控制其中的内容

<deFinitions
 name="XXXWebS"
 targetNamespace="http://example.org/"
 xmlns="http://schemas.xmlsoap.org/wsdl/"
 xmlns:wssutil="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
 xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
 xmlns:tns="http://example.org/"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>
<wsp:UsingPolicy wssutil:required="true"/>
<wsp:Policy wssutil:Id="Usernametoken">
    <ns1:SupportingTokens xmlns:ns1="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200512">
        <wsp:Policy>
            <ns1:Usernametoken ns1:Includetoken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200512/Includetoken/AlwaysToRecipient">
                <wsp:Policy>
                    <ns1:WssUsernametoken10/>
                </wsp:Policy>
            </ns1:Usernametoken>
        </wsp:Policy>
    </ns1:SupportingTokens>
</wsp:Policy>

...

<binding name="XXXInterfacePortTypePortBinding" type="tns:XXXInterfacePortType">
    <wsp:PolicyReference URI="#Usernametoken"/>
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="process">
        <soap:operation soapAction=""/>
        <input>
            <soap:body use="literal"/>
        </input>
        <output>
            <soap:body use="literal"/>
        </output>
    </operation>
</binding>

...

这是运行“ getXXXInterfacePortTypePort”时的错误

javax.xml.ws.WebServiceException: weblogic.wsee.ws.init.WsDeploymentException: Unable to to retrieve policy from URI '#Usernametoken'[[

    at weblogic.wsee.jaxws.framework.jaxrpc.TubelineDeploymentListener.createClient(TubelineDeploymentListener.java:59)
    at weblogic.wsee.jaxws.WLSTubelineAssemblerFactory$TubelineAssemblerImpl.createClient(WLSTubelineAssemblerFactory.java:100)
    at com.sun.xml.ws.client.WSServiceDelegate.createPipeline(WSServiceDelegate.java:471)
    at com.sun.xml.ws.client.WSServiceDelegate.getStubHandler(WSServiceDelegate.java:697)
    at com.sun.xml.ws.client.WSServiceDelegate.createEndpointIFBaseProxy(WSServiceDelegate.java:675)
    at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:362)
    at weblogic.wsee.jaxws.spi.WLSProvider$ServiceDelegate.internalGetPort(WLSProvider.java:978)
    at weblogic.wsee.jaxws.spi.WLSProvider$ServiceDelegate$PortClientInstanceFactory.createClientInstance(WLSProvider.java:1083)
    at weblogic.wsee.jaxws.spi.ClientInstancePool.takeSimpleClientInstance(ClientInstancePool.java:376)
    at weblogic.wsee.jaxws.spi.ClientInstancePool.take(ClientInstancePool.java:232)
    at weblogic.wsee.jaxws.spi.WLSProvider$ServiceDelegate.getPort(WLSProvider.java:896)
    at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:344)
    at weblogic.wsee.jaxws.spi.WLSProvider$ServiceDelegate.getPort(WLSProvider.java:836)
    at javax.xml.ws.Service.getPort(Service.java:133)
    at XXXInterfaceWebS.getXXXInterfacePortTypePort(XXXInterfaceWebS.java:86)
    at xxxInterfaceService.callxxxInterfaceWs(xxxInterfaceService.java:154)
    ...
Caused by: weblogic.wsee.ws.init.WsDeploymentException: Unable to to retrieve policy from URI '#Usernametoken'

    at weblogic.wsee.security.wssp.deploy.WssDeploymentListener.process(WssDeploymentListener.java:74)
    at weblogic.wsee.jaxws.framework.jaxrpc.TubelineDeploymentListener.createClient(TubelineDeploymentListener.java:56)
    at weblogic.wsee.jaxws.WLSTubelineAssemblerFactory$TubelineAssemblerImpl.createClient(WLSTubelineAssemblerFactory.java:99)
    at com.sun.xml.ws.client.WSServiceDelegate.createPipeline(WSServiceDelegate.java:471)
    ... 15 more
Caused by: Unable to to retrieve policy from URI '#Usernametoken'

    at weblogic.wsee.policy.deployment.PolicyRef.getPolicy(PolicyRef.java:230)
    at weblogic.wsee.policy.deployment.PolicyReferenceWsdlExtension.getEffectivePolicy(PolicyReferenceWsdlExtension.java:125)
    at weblogic.wsee.policy.deployment.WsdlPolicySubject.getEffectivePolicyFromWsdlExtensible(WsdlPolicySubject.java:485)
    at weblogic.wsee.policy.deployment.WsdlPolicySubject.getEndpointPolicySubject(WsdlPolicySubject.java:341)
    at weblogic.wsee.policy.runtime.PolicyContext.getRequestEffectivePolicy(PolicyContext.java:107)
    at weblogic.wsee.policy.runtime.PolicyContext.getRequestEffectivePolicy(PolicyContext.java:74)
    at weblogic.wsee.security.policy.assertions.SecurityPolicyAssertionFactory.hasSecurityPolicy(SecurityPolicyAssertionFactory.java:105)
    at weblogic.wsee.security.wssp.deploy.WssDeploymentListener.process(WssDeploymentListener.java:54)
    ... 18 more

在这种情况下,请帮助我。为什么会出现错误?我的代码或weblogic服务器设置有什么问题吗? 请让我知道是否需要更多信息来识别问题。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...