Commit a08b3e0f authored by ZZZ[GONE] frebault's avatar ZZZ[GONE] frebault
Browse files

add BeSimple

parent 386f27d3
......@@ -10,3 +10,4 @@ CHANGELOG
-----
* Fix Interface suffix sor SLI
* Add BeSimple component and replace base soapClient by BeSimple\SoapClient\SoapClient.php
......@@ -16,6 +16,8 @@
"psr-4": {"": "src/"}
},
"require": {
"php": ">=5.3.0"
"php": ">=5.3.0",
"besimple/soap-common" : "dev-master",
"besimple/soap-client": "dev-master"
}
}
......@@ -6,7 +6,7 @@ use GGUSHelpdesk\Exceptions\GgusObjectValidationException;
use GGUSHelpdesk\Exceptions\InvalidFieldException;
abstract class GgusObject
class GgusObject
{
protected $fields;
......
......@@ -5,6 +5,7 @@ namespace GGUSHelpdesk;
use GGUSHelpdesk\Exceptions\HelpdeskOperationException;
use GGUSHelpdesk\Exceptions\InvalidFieldException;
use BeSimple\SoapClient\SoapClient;
/**
* provide basic access to ggus soap service
......@@ -110,11 +111,12 @@ abstract class SoapService
try {
$encodedAuth = new \SoapVar($this->config['authentication'], SOAP_ENC_OBJECT);
$this->header = new \SoapHeader($this->namespace, "AuthenticationInfo", $encodedAuth, false);
$this->soapClient = new \SoapClient(
$this->soapClient = new SoapClient(
$this->wsdl,
array('trace' => 1,
'cache_wsdl' => WSDL_CACHE_BOTH,
'ssl_method' => SOAP_SSL_METHOD_TLS
'cache_wsdl' => 0,
'soap_version' => SOAP_1_2,
'ssl_method'=> SOAP_SSL_METHOD_TLS
));
$headerStatus = $this->soapClient->__setSoapHeaders($this->header);
......@@ -161,7 +163,7 @@ abstract class SoapService
try {
$stdClassData = $soapClient->$method(array($idParamName => $id));
$ggusObject = $this->createGgusObjectInstance(false);
$ggusObject = $this->createGgusObjectInstance(true);
$ggusObject->fromHelpdesk($stdClassData);
} catch (\SoapFault $sf) {
......
......@@ -2,6 +2,7 @@
namespace GGUSHelpdesk\resources;
use GGUSHelpdesk\GgusObject;
use \GGUSHelpdesk\SoapService;
/**
......@@ -17,7 +18,12 @@ class TestGgusSoapService extends SoapService
}
public function createGgusObjectInstance($setDefaultValues = true){
$t = new GgusObject($this->getGgusFieldInstance());
if (true === $setDefaultValues) {
$t->setHelpdeskValues($this->getGgusObjectDefaults());
}
return $t;
}
/**
......
......@@ -7,13 +7,59 @@
*/
use \GGUSHelpdesk\resources\TestGgusSoapService;
use \BeSimple\SoapClient\WsdlDownloader;
use \BeSimple\SoapClient\Curl;
class SoapServiceTest extends PHPUnit_Framework_TestCase {
public function testIniExtendedFields(){
$ss = new TestGgusSoapService(array('urls'=>array('wsdl'=>'www.url.test')), 'testSoapService');
$ss = new TestGgusSoapService(array('urls'=>array('wsdl'=>'https://prod-ars.ggus.eu/arsys/WSDL/public/prod-ars/GGUS_OPS')), 'testSoapService');
}
public function testDownloadWsdl(){
$maps = array(
'Vo' => 'GHD_VO_Specific',
'AuthorEmail' => 'GHD_E-Mail',
'Login' => 'GHD_Last_Login',
'Modifier' => 'GHD_Last_Modifier',
'AuthorDn' => 'GHD_Cert_DN',
'Author' => 'GHD_Submitter',
'Subject' => 'GHD_Subject',
'Type' => 'GHD_TicketType',
'Status' => 'GHD_Status',
'ResponsibleUnit' => 'GHD_Responsible_Unit',
'Comment' => 'GHD_Public_Diary',
'Involve' => 'GHD_Involve',
'Site' => 'GHD_Affected_Site',
'CarbonCopy' => 'GHD_Carbon_Copy',
'XMLFields' => 'GHD_Soap_Client_Data',
'Description' => 'GHD_Description',
'Priority' => 'GHD_Priority',
'ProblemType' => 'GHD_ProblemType',
'Id' => 'GHD_Request_ID',
'Solution' => 'GHD_Detailed_Solution',
'ResponsibleEmail' => 'GHD_Assigned_To',
'MetaStatus' => 'GHD_Meta_Status',
'ModificationDate' => 'GHD_Modified_Date',
'CreationDate' => 'GHD_Create_Date',
'NotificationStrategy' => 'GHD_User_Notification'
);
\BeSimple\SoapCommon\Cache::setDirectory("C:/wamp/www/documents/wsdl");
$tss = new TestGgusSoapService(
array(
'maps' =>array('cMap'=>$maps),
'urls'=>array('wsdl'=>'https://train-ars.ggus.eu/arsys/WSDL/public/train-ars'),
'authentication'=> array(
'userName'=>'****',
'password'=>'****')
), 'GGUS_OPS');
var_dump($tss->__getGgusObject('51532','OpGetOps','GHD_Request_ID')->toHelpdesk());
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment