问题
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?
Data flow (actions are arrows, with the second arrow originating from the SoapServer.php bubble and receiving a response):
回答1:
Turns out that the best way to do what I'm looking for is simply file_get_contents("php://input")
.
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.
来源:https://stackoverflow.com/questions/10835336/parsing-soap-response-via-wsdl-soapserver