dongshui2254
2009-12-22 20:25
浏览 52
已采纳

在PHP中处理SOAP标头

I am building (in PHP) a SOAP server that is configured by its WSDL to accept messages that look like this:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://my.awesome.namespace/">
    <SOAP-ENV:Header>
        <ns1:Header>
            <ns1:APIKey>E4C5BDE0-48DC-543C-1CA3-8E55C63F8E60</ns1:APIKey>
            <ns1:SiteID>111</ns1:SiteID>
        </ns1:Header>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <ns1:Heartbeat>
            <ns1:Message>Hello world.</ns1:Message>
        </ns1:Heartbeat>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

I had no problem getting my SOAPServer to process Heartbeat messages - $server->addFunction("Heartbeat"); works fine. I want, however, to be able to process the contents of the <ns1:Header> enclosure - so I can validate the API key and Site ID to make sure they are what they should be.

I looked here, (and of course elsewhere) but the responder seems to have missed the point of the question. Does anyone know how I can access the header element to validate? Do I add a function for Header the way I would a method in the body? ($server->addFunction("Header");?)

Thanks very much in advance.

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题