简体   繁体   中英

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

I am sending a soap request using PHP curl() . 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. 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

$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);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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