通过WSDL/SoapServer解析SOAP响应 [英] Parsing SOAP response via WSDL/SoapServer
问题描述
我需要接受包含一些数据的不可修改的SOAP消息.它先发布到我的WSDL文件中,然后发布到PHP SoapServer.如何通过wsdl或php提取消息中的特定数据(包装在xml密钥中)?
I need to accept an unmodifiable SOAP message that includes some data. It is posted to my WSDL file and then PHP SoapServer. How can I extract specific data (wrapped in an xml key) in the message via my wsdl or php?
数据流(动作是箭头,第二个箭头起源于SoapServer.php气泡并收到响应):
Data flow (actions are arrows, with the second arrow originating from the SoapServer.php bubble and receiving a response):
推荐答案
结果证明,要做我要寻找的最好方法就是file_get_contents("php://input")
.
Turns out that the best way to do what I'm looking for is simply file_get_contents("php://input")
.
这是通过侦听POST触发脚本的简便方法.我只是将服务的webhook URL指向脚本,将其file_get_contents("php://input")
转换为array
,然后simplexml_load_string()
进行解析,并将键之一的数据用作脚本的参数.
This is an easy way to trigger scripts by listening for POSTs. I simply point a service's webhook url to the script, which file_get_contents("php://input")
, cast to an array
, and then simplexml_load_string()
to parse it and use one of the keys' data as the parameter for my script.
这篇关于通过WSDL/SoapServer解析SOAP响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!