Previously we have discussed Part - 1 and Part - 2, here I will discussed how to Invoke the Codeunit methods.
<?php
try
{
require_once("NTLMStream.php");
require_once("NTLMSoapClient.php");
stream_wrapper_unregister('http');
stream_wrapper_register('http', 'NTLMStream') or die("Failed to register protocol");
$pageURL = 'http://localhost:7047/dynamicsnav/ws/Test%20Products/Codeunit/acceptwebcustomerdetail';
echo "<br>URL of Customer page: $pageURL<br><br>";
// Initialize Page Soap Client
$page = new NTLMSoapClient($pageURL);
$page->fuck_you_ms = TRUE;
//echo '<pre>acceptwebcustomerdetail class functions</pre>';
//$functions =$page->__getFunctions();
//var_dump($functions);
echo '<pre></pre>';
$accept=array('SecurityTokenID'=> '*786','MemberID'=>'12885','CustomerName'=>'TestUser','EmailAddress'=>'test@gmail.com','ReponsibilityCenter'=>'BIND',
'Website'=>'http://testcompany.com','GroupID'=>'8','Group'=>'General','CreatedIn'=>'Admin');
$acceptp=array('acceptcustomer'=>$accept);
$outsec='';
$status='';
$errorcode='';
$params=array('acceptwebcustomerp'=>$acceptp,'outsecuritytokenidp'=>$outsec,'statusp'=>$status,'errorcodep'=>$errorcode);
$Cre = $page->Addorupdatecustomer($params);
echo '<br/>';
echo 'Create Order successfully <br/>';
// restore the original http protocole
stream_wrapper_restore('http');
}
catch(Exception $ex){
echo 'Soap Exception<br/>';
echo $ex->getMessage();
}
?>
<?php
try
{
require_once("NTLMStream.php");
require_once("NTLMSoapClient.php");
stream_wrapper_unregister('http');
stream_wrapper_register('http', 'NTLMStream') or die("Failed to register protocol");
$pageURL = 'http://localhost:7047/dynamicsnav/ws/Test%20Products/Codeunit/acceptwebcustomerdetail';
echo "<br>URL of Customer page: $pageURL<br><br>";
// Initialize Page Soap Client
$page = new NTLMSoapClient($pageURL);
$page->fuck_you_ms = TRUE;
//echo '<pre>acceptwebcustomerdetail class functions</pre>';
//$functions =$page->__getFunctions();
//var_dump($functions);
echo '<pre></pre>';
$accept=array('SecurityTokenID'=> '*786','MemberID'=>'12885','CustomerName'=>'TestUser','EmailAddress'=>'test@gmail.com','ReponsibilityCenter'=>'BIND',
'Website'=>'http://testcompany.com','GroupID'=>'8','Group'=>'General','CreatedIn'=>'Admin');
$acceptp=array('acceptcustomer'=>$accept);
$outsec='';
$status='';
$errorcode='';
$params=array('acceptwebcustomerp'=>$acceptp,'outsecuritytokenidp'=>$outsec,'statusp'=>$status,'errorcodep'=>$errorcode);
$Cre = $page->Addorupdatecustomer($params);
echo '<br/>';
echo 'Create Order successfully <br/>';
// restore the original http protocole
stream_wrapper_restore('http');
}
catch(Exception $ex){
echo 'Soap Exception<br/>';
echo $ex->getMessage();
}
?>
No comments:
Post a Comment