gpt4 book ai didi

java - NullPointerException - Java - WCF 之上的 Web 服务客户端(使用 WS-Security)

转载 作者:行者123 更新时间:2023-12-01 06:19:23 25 4
gpt4 key购买 nike

我正在使用 wsHttpBinding 构建 WCF 服务。(具有 WS-Security 和消息级安全性)

现在我想为其构建一个 JAVA 客户端,使用..

  • 地铁
  • Netbeans

到目前为止,一切都运行良好。我已经从 WSDL 创建了 Java 客户端。

现在,每当我调用客户端代理时,我都会收到以下错误:

java.lang.NullPointerException
at
com.sun.xml.ws.security.impl.policyconv.BindingProcessor.requireSC(BindingProcessor.java:330)
at
com.sun.xml.ws.security.impl.policyconv.BindingProcessor.addPrimaryTargets(BindingProcessor.java:310)
at
com.sun.xml.ws.security.impl.policyconv.SymmetricBindingProcessor.process(SymmetricBindingProcessor.java:154)
at
com.sun.xml.ws.security.impl.policyconv.XWSSPolicyGenerator.process(XWSSPolicyGenerator.java:200)
at
com.sun.xml.ws.security.impl.policyconv.XWSSPolicyGenerator.process(XWSSPolicyGenerator.java:157)
at
com.sun.xml.wss.jaxws.impl.SecurityTubeBase.constructPolicyHolder(SecurityTubeBase.java:1233)
at
com.sun.xml.wss.jaxws.impl.SecurityClientTube.addIncomingProtocolPolicy(SecurityClientTube.java:683)
at
com.sun.xml.wss.jaxws.impl.SecurityTubeBase.buildProtocolPolicy(SecurityTubeBase.java:1206)
at
com.sun.xml.wss.jaxws.impl.SecurityTubeBase.collectPolicies(SecurityTubeBase.java:735)
at
com.sun.xml.wss.jaxws.impl.SecurityTubeBase.<init>(SecurityTubeBase.java:288)
at
com.sun.xml.wss.jaxws.impl.SecurityClientTube.<init>(SecurityClientTube.java:144)
at
com.sun.xml.wss.provider.wsit.SecurityTubeFactory.createTube(SecurityTubeFactory.java:227)
at
com.sun.xml.ws.assembler.TubeCreator.createTube(TubeCreator.java:77)
at
com.sun.xml.ws.assembler.TubelineAssemblerFactoryImpl$MetroTubelineAssembler.createClient(TubelineAssemblerFactoryImpl.java:121)
at com.sun.xml.ws.client.Stub.createPipeline(Stub.java:224)
at com.sun.xml.ws.client.Stub.<init>(Stub.java:201)
at com.sun.xml.ws.client.Stub.<init>(Stub.java:174)
at com.sun.xml.ws.client.sei.SEIStub.<init>(SEIStub.java:81)
at
com.sun.xml.ws.client.WSServiceDelegate.createEndpointIFBaseProxy(WSServiceDelegate.java:602)
at
com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:344)
at
com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:326)
at
com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:308)
at javax.xml.ws.Service.getPort(Service.java:134)

最佳答案

从 Metro 2.0 升级到 Metro 2.3 有很大帮助,至少你会看到一个有意义的异常,在我的例子中,加密算法在我的 JRE 安装中不可用,我必须安装 Bouncy CaSTLe 加密库(http://bit.ly/8JWAF)。

编辑:这是一篇关于 jax-ws 客户端与 WCF 服务通信的文章,希望它有所帮助:Comunicating Jax-ws client with WCF service with server sertificate

关于java - NullPointerException - Java - WCF 之上的 Web 服务客户端(使用 WS-Security),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13849451/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com