【问题标题】:SOAP Service: Missing WS-Addressing headerSOAP 服务:缺少 WS-Addressing 标头
【发布时间】:2011-03-12 19:38:04
【问题描述】:

我有一个可以毫无问题地部署的 Netbeans SOAP 服务和一个 Silverlight 客户端。

当我从 Silverlight 调用服务时,我得到(在 silverlight 中):

new DiscourseParserWSClient created;
event handler added;
service called; Service State is: Open
http://localhost:8080/DiscourseParserWS/DiscourseParserWSService
An exception occurred during the operation, making the result invalid. 
The remote server returned an error: NotFound.

客户端调用服务后,GlassFish v3 Domain 响应以下问题,我无法破译:

WARNING: A required header representing a Message Addressing Property is not present, Problem header:{http://www.w3.org/2005/08/addressing}Action
com.sun.xml.ws.addressing.model.MissingAddressingHeaderException: Missing WS-Addressing header: "{http://www.w3.org/2005/08/addressing}Action"
        at com.sun.xml.ws.addressing.WsaTube.checkCardinality(WsaTube.java:235)
        at com.sun.xml.ws.addressing.WsaTube.checkMessageAddressingProperties(WsaTube.java:183)
        at com.sun.xml.ws.addressing.WsaServerTube.checkMessageAddressingProperties(WsaServerTube.java:281)
        at com.sun.xml.ws.addressing.WsaTube.validateInboundHeaders(WsaTube.java:140)
        at com.sun.xml.ws.addressing.WsaServerTube.processRequest(WsaServerTube.java:147)
        at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:629)
        at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:588)
        at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:573)
        at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:470)
        at com.sun.xml.ws.api.pipe.helper.AbstractTubeImpl.process(AbstractTubeImpl.java:112)
        at com.sun.enterprise.security.webservices.CommonServerSecurityPipe.processRequest(CommonServerSecurityPipe.java:195)
        at com.sun.enterprise.security.webservices.CommonServerSecurityPipe.process(CommonServerSecurityPipe.java:127)
        at com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:115)
        at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:629)
        at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:588)
        at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:573)
        at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:470)
        at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:295)
        at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:515)
        at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:285)
        at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:143)
        at org.glassfish.webservices.JAXWSServlet.doPost(JAXWSServlet.java:147)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
        at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
        at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
        at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233)
        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
        at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
        at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
        at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
        at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
        at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
        at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
        at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
        at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
        at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
        at java.lang.Thread.run(Thread.java:619)

我使用的是 Metro 2.1,经过一番谷歌搜索后,我怀疑问题可能与它有关......

我可以看到服务的 wsdl,所以我相信这不会是实现问题。但是该警告的堆栈会下降到 Thread 类 o.O?

public void run() {
if (target != null) {
    target.run(); // <-- to this line to be exact
}
}

请帮忙解释一下;我已经有几个 eclipse soap 服务与这个客户端合作,但我没有使用 Netbeans、GlassFish 和 Metro 的经验,无法弄清楚是什么原因造成的......

【问题讨论】:

标签: soap netbeans service glassfish java-metro-framework


【解决方案1】:

不知道是不是太晚了,但它有时帮助我添加了

@Addressing(启用=true, 必需=假)

到 WebService(类注解)。然后异常通常会消失。

有关寻址的更多信息,您可以参考1

【讨论】:

    【解决方案2】:

    我收到了同样的警告,并认为这可能对其他人有帮助。

    如果您在 Netbeans 可视化 Web 服务设计器中使用“可靠消息传递”选项,那么您可能会收到此警告。

    如果您不需要“可靠消息传递”,您只需将其关闭即可。

    【讨论】:

      【解决方案3】:

      我今天遇到了这个问题,通过使用肥皂标题上的 Action 属性解决了这个问题。我已经使用 SoapUI 确认了这一点。

          <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mal="http://example.com">
         <soapenv:Header>
         <MessageID xmlns="http://www.w3.org/2005/08/addressing">uuid:2c7ea154-668e-4c8b-abaa-8b119f91b8dd</MessageID>
         <Action xmlns="http://www.w3.org/2005/08/addressing">http://example.com/input</Action>
        </soapenv:Header>
         <soapenv:Body>
            ......
         </soapenv:Body>
      </soapenv:Envelope>
      

      如果我们没有传递 Action 属性,则会收到错误消息:

      <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
         <S:Header>
            <FaultDetail xmlns="http://www.w3.org/2005/08/addressing">
               <ProblemHeaderQName>{http://www.w3.org/2005/08/addressing}Action</ProblemHeaderQName>
            </FaultDetail>
         </S:Header>
         <S:Body>
            <SOAP-ENV:Fault xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
               <faultcode xmlns:wsa="http://www.w3.org/2005/08/addressing">wsa:MessageAddressingHeaderRequired</faultcode>
               <faultstring>A required header representing a Message Addressing Property is not present</faultstring>
            </SOAP-ENV:Fault>
         </S:Body>
      </S:Envelope>
      

      Action header 的值由 webmethod 上的@Action 决定。

      @Action(input = "http://example.com/input", output = "http://example.com/output")
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-04-26
        • 2013-02-15
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-12-29
        • 2021-08-19
        相关资源
        最近更新 更多