PHPToolkit versions released prior to 2012.2 use the following codes to declare SoapClient:
[File: PHPtoolkit.php]
class nsClient {
private $client; // By default this is declared as private. For debugging purposes, change access type to public.
...
function __construct ( $host=nsHost::live ) {
...
$this->client = new SoapClient( $host .... );
Starting 2012.2, SoapClient object is assigned to 'client' this way:
[File: NSPHPClient.php]
class NSPHPClient {
public $client = null;
...
protected function __construct($wsdl=null, $options=array()) {
...
$this->client = new SoapClient($wsdl, $options);
}
To view the actual SOAP request in PHP, use SoapClient::__getLastRequest() method after invoking an operation.
Below is an example after invoking 'get' operation for PHPToolkit versions prior to 2012.2:
global $myNSclient;
...
$getResponse = $myNSclient->get($recordRef);
print_r($myNSclient->client->__getLastRequest());
To do it in 2012.2 version and above:
$service = new NetSuiteService();
...
$getResponse = $service->get($request);
print_r($service->client->__getLastResponse());
Both codes above, even running on different versions will output the actual SOAP request (XML).
DISCLAIMER: The sample code described herein is provided on an "as is" basis, without warranty of any kind, to the fullest extent permitted by law. Oracle + NetSuite Inc. does not warrant or guarantee the individual success developers may have in implementing the sample code on their development platforms or in using their own Web server configurations.
Oracle + NetSuite Inc. does not warrant, guarantee or make any representations regarding the use, results of use, accuracy, timeliness or completeness of any data or information relating to the sample code. Oracle + NetSuite Inc. disclaims all warranties, express or implied, and in particular, disclaims all warranties of merchantability, fitness for a particular purpose, and warranties related to the code, or any service or software related thereto.
Oracle + NetSuite Inc. shall not be liable for any direct, indirect or consequential damages or costs of any type arising out of any action taken by you or others related to the sample code.
Related SuiteAnswers
No comments:
Post a Comment