How do I see the actual XML generated by PHP SOAP Client Class?

后端 未结 7 1648
醉酒成梦
醉酒成梦 2020-12-05 01:42

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 reques         


        
7条回答
  •  眼角桃花
    2020-12-05 02:13

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

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

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

提交回复
热议问题