简体   繁体   English

如何打印肥皂请求(请求是使用php curl发送的)?

[英]how to print the soap request (request is sending using php curl)?

I am sending a soap request using PHP curl() . 我正在使用PHP curl()发送一个soap请求。 I need to print my request, so that I can have a look into my request and understand weather it is going in a right format. 我需要打印请求,以便可以查看请求并了解其格式是否正确。

But I don't know how to print my request out. 但是我不知道如何打印我的请求。 I tried getlastRequest() but it is not working. 我尝试了getlastRequest()但是它不起作用。 Can anybody help me out?? 有人可以帮我吗?

Sara 萨拉

Try this: 尝试这个:

$soapServer = new SoapServer(null, array('uri' => "urn://l/res"));
// managed functions
// $soapServer->addFunction("...");
// $soapServer->addFunction("..."); 
// .....
$xml_data = file_get_contents("php://input");

And if you want validate xml soap request 并且如果您想验证xml soap请求

$parser = xml_parser_create("UTF-8");
if (!xml_parse($parser, $xml_data, true)) {
     $error = "Cannot parse XML: " .
              xml_error_string(xml_get_error_code($parser)) .
              " at line: " . xml_get_current_line_number($parser) .
              ", column: " . xml_get_current_column_number($parser);
     // Send error via SOAP
     $soapServer->fault("500", $error);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM