我如何查看“原始 xml” nusoap 的输出?

发布于 2024-09-16 14:32:54 字数 90 浏览 3 评论 0原文

我有一个通用函数,用于传递 SOAP 命令。我需要查看发送到服务器的 RAW XML 数据以诊断错误。我该怎么做?

I have a generic function that I use to pass SOAP commands. I need to view the RAW XML data that is being sent to the server for diagnosing an error. How do i do that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

秉烛思 2024-09-23 14:32:54

没关系,这似乎已经非常接近了!

http://www.scottnichol.com/nusoapintro.htm

echo '<h2>Request</h2>';
echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2>';
echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';

// Display the debug messages
echo '<h2>Debug</h2>';
echo '<pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';

Never mind, this seems to be pretty close to the dot!

http://www.scottnichol.com/nusoapintro.htm

echo '<h2>Request</h2>';
echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2>';
echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';

// Display the debug messages
echo '<h2>Debug</h2>';
echo '<pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';
小耗子 2024-09-23 14:32:54

虽然这是一篇旧帖子,但我想用我自己版本的 tzmatt 答案来补充。

class soapBug {

    /*
     * @var obj $debug client object
     * @var string $what Just a name for the header so you know
     * what you are looking at.
     */
    public function bug($debug, $what) {
        /* ive stayed with the original here, but you could look at
         * http://www.php.net/manual/en/tidy.repairstring.php to
         * output in clean xml.
         *
         * I just grab the line i need and paste
         * it into my IDE and let it format for me, works just as well
         * and no coding to fiddle with for something that wont be
         * permanent on my project.
         */
        echo '<h2>' . $what . '</h2>';
        echo '<pre>' . htmlspecialchars($debug, ENT_QUOTES) . '</pre>';

    }

}

class someClass {

    private $de;
    // private to this class to prevent accidental call
    // outside the class.

    public function __construct() {

           $this->de = new soapBug;
    }

    public function thatNeedsDebugging() {

        /* 
         * Simple enough to debug your client now no need to copy
         * the html block all over you can debug with just one line
         * of call all of them
         */
        $this->de->bug($client->request, 'Request'); // I grab this output string
        $this->de->bug($client->response, 'Response');
        $this->de->bug($client->debug_str, 'Debug');
    }
}

While this is an old post i wanted to chip in with my own version of tzmatt answer.

class soapBug {

    /*
     * @var obj $debug client object
     * @var string $what Just a name for the header so you know
     * what you are looking at.
     */
    public function bug($debug, $what) {
        /* ive stayed with the original here, but you could look at
         * http://www.php.net/manual/en/tidy.repairstring.php to
         * output in clean xml.
         *
         * I just grab the line i need and paste
         * it into my IDE and let it format for me, works just as well
         * and no coding to fiddle with for something that wont be
         * permanent on my project.
         */
        echo '<h2>' . $what . '</h2>';
        echo '<pre>' . htmlspecialchars($debug, ENT_QUOTES) . '</pre>';

    }

}

class someClass {

    private $de;
    // private to this class to prevent accidental call
    // outside the class.

    public function __construct() {

           $this->de = new soapBug;
    }

    public function thatNeedsDebugging() {

        /* 
         * Simple enough to debug your client now no need to copy
         * the html block all over you can debug with just one line
         * of call all of them
         */
        $this->de->bug($client->request, 'Request'); // I grab this output string
        $this->de->bug($client->response, 'Response');
        $this->de->bug($client->debug_str, 'Debug');
    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文