1

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

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

  • 地铁
  • 网豆

到目前为止一切正常。我已经从 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)
4

2 回答 2

0

从 Metro 2.0 升级到 Metro 2.3 有很大帮助,至少你会看到一个有意义的例外,在我的情况下,我的 JRE 安装中没有加密算法,我必须安装 Bouncy Castle 加密库(http ://bit.ly/8JWAF)。

编辑:这是一篇关于将 jax-ws 客户端与 WCF 服务通信的文章,希望对您有所帮助:使用服务器证书将 Jax-ws 客户端与 WCF 服务通信

于 2013-10-15T18:34:51.117 回答
-1

BindingProcessor.java在 line 处设置断点330。我记得你用 F6 '跨过'。

如果您是 .NET 专家,那么这意味着您有一些基本的编程知识。每个程序员都应该知道如何调试程序。

在此处阅读有关 NetBeans 调试的更多信息,并调试您的代码以查看该requireSC方法的参数未初始化的位置。

于 2012-12-12T22:43:30.967 回答