如何查看 PHP SOAP 客户端类生成的实际 XML?

How do I see the actual XML generated by PHP SOAP Client Class?(如何查看 PHP SOAP 客户端类生成的实际 XML?)
本文介绍了如何查看 PHP SOAP 客户端类生成的实际 XML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

考虑这个示例 SOAP 客户端脚本:

Consider this example SOAP Client script:

$SOAP = new SoapClient($WDSL); // Create a SOAP Client from a WSDL

// Build an array of data to send in the request.
$Data = array('Something'=>'Some String','SomeNumber'=>22); 

$Response = $SOAP->DoRemoteFunction($Data); // Send the request.

在最后一行,PHP 从您指定的数组中获取参数,并使用 WSDL 构建要发送的 XML 请求,然后将其发送.

On the last line, PHP takes the arguments from the array you specified, and, using the WSDL, builds the XML request to send, then sends it.

如何让 PHP 向我展示它构建的实际 XML?

How can I get PHP to show me the actual XML it's built?

我正在对应用程序进行故障排除,需要查看请求的实际 XML.

I'm troubleshooting an application and need to see the actual XML of the request.

推荐答案

使用 getLastRequest.它返回在最后一个 SOAP 请求中发送的 XML.

Use getLastRequest. It returns the XML sent in the last SOAP request.

echo "REQUEST:
" . $SOAP->__getLastRequest() . "
";

请记住,此方法仅在创建 SoapClient 对象且 trace 选项设置为 TRUE 时才有效.因此,在创建对象时,使用以下代码:

And remember, this method works only if the SoapClient object was created with the trace option set to TRUE. Therefore, when creating the object, use this code:

$SOAP = new SoapClient($WDSL, array('trace' => 1));

这篇关于如何查看 PHP SOAP 客户端类生成的实际 XML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)