微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决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.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?