Skip to content

Commit

Permalink
2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecc committed Apr 21, 2020
1 parent 24ccd86 commit ce09d63
Show file tree
Hide file tree
Showing 16 changed files with 2,634 additions and 4,290 deletions.
8 changes: 8 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/examples export-ignore
/vendor export-ignore
/docs export-ignore
/tests export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/phpunit.xml export-ignore
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/.idea/

/vendor/
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# cloudking
A SOAP Server Engine for PHP 5.2 and higher.
A SOAP Server Engine for PHP 5.6 and higher.

It supports SOAP 1.1, 1.2 or both. JAVA usually supports 1.1, C# supports both.

For php 7.0 and higher its not working, so its in ALPHA.

--It doesn't work--
22 changes: 22 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "eftec/cloudking",
"type": "library",
"description": "A SOAP webserver for PHP",
"license": "LGPL",
"version": "2.4",
"authors": [
{
"name": "Jorge Castro",
"email": "[email protected]"
}
],
"require": {
"php": ">=5.6",
"ext-json": "*"
},
"autoload": {
"psr-4": {
"eftec\\cloudking\\": "lib/"
}
}
}
92 changes: 92 additions & 0 deletions examples/Example2WSService.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?php


/**
* @generated The structure of this class is generated by CloudKing
* Class Example2WSService
*/
class Example2WSService {
function getDB() {
$r=@file_get_contents('data.txt');
if($r===false) {
return [];
}
return unserialize($r);
}
function saveDB($content) {
$r=file_put_contents('data.txt',serialize($content));
}


function ping($ping_param) {
try {


return $ping_param;
} catch (Exception $_exception) {
return(array("soap:Fault"=>'Caught exception: '. $_exception->getMessage()));
}
}

function GetProducto($idProducto) {
try {

$all=$this->getDB();
foreach($all as $item) {
if($item['idProducto']===$idProducto) {
$_Producto=$item;
break;
}
}

return $_Producto;
} catch (Exception $_exception) {
return(array("soap:Fault"=>'Caught exception: '. $_exception->getMessage()));
}
}

function InsertProducto($Producto) {
try {

$all=$this->getDB();
$all[]=$Producto;
$this->saveDB($all);
return count($all);
} catch (Exception $_exception) {
return(array("soap:Fault"=>'Caught exception: '. $_exception->getMessage()));
}
}

function GetProductos() {
try {

return $this->getDB();
} catch (Exception $_exception) {
return(array("soap:Fault"=>'Caught exception: '. $_exception->getMessage()));
}
}

function factoryProducto($idProduct=0,$nombre='',$precio=0) {
$_Producto['idProduct']=$idProduct;
$_Producto['nombre']=$nombre;
$_Producto['precio']=$precio;

}

function factoryProductoArray($Producto=array()) {
$_ProductoArray['Producto']=$Producto;

}
} // end class

/************************************ Complex Types (Classes) ************************************/

class Producto {
var $idProduct; // s:integer
var $nombre; // s:string
var $precio; // s:integer
}

class ProductoArray {
var $Producto; // tns:Producto
}
51 changes: 51 additions & 0 deletions examples/clientexample2.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?

use eftec\cloudking\CloudKingClient;

include "../vendor/autoload.php";


$x=new ExampleCLient();
echo "<pre>";
var_dump($x->GetProductos());
echo "</pre>";
/***************************************** Implementation *****************************************/
class ExampleCLient {
var $url='http://localhost/currentproject/cloudking/examples/example2.php';
var $tempuri='examplenamespace';

// Descripcion :Prueba de conexion
// ping_param =
function ping($ping_param) {
$_obj=new CloudKingClient();
$_obj->soap='1.1';
$_obj->tempuri=$this->tempuri;
$_param='';
$_param.=$_obj->array2xml($ping_param,'ts:ping_param',false,false);
$resultado=$_obj->loadurl($this->url,$_param,'ping');
return @$resultado['pingResult'];
}

// Descripcion :GetSin obtiene los datos de una SIN
// idProducto =
function GetProducto($idProducto) {
$_obj=new CloudKingClient();
$_obj->soap='1.1';
$_obj->tempuri=$this->tempuri;
$_param='';
$_param.=$_obj->array2xml($idProducto,'ts:idProducto',false,false);
$resultado=$_obj->loadurl($this->url,$_param,'GetProducto');
return @$resultado['GetProductoResult'];
}

// Descripcion :Get_sin obtiene los datos de una SIN
function GetProductos() {
$_obj=new CloudKingClient();
$_obj->soap='1.1';
$_obj->tempuri=$this->tempuri;
$_param='';
$resultado=$_obj->loadurl($this->url,$_param,'GetProductos');
return @$resultado['GetProductosResult'];
}
} // end Sin_WS
?>
6 changes: 3 additions & 3 deletions csin.class.php → examples/csin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ function GetSins($filtro,&$error) {
$cuenta_zonas++;
}
if($cuenta_zonas>1){
$desc_zonas=substr(substr($desc_zonas,0,strlen($desc_zonas)-1),0,25).'...(más)';
$desc_zonas=substr(substr($desc_zonas,0,strlen($desc_zonas)-1),0,25).'...(m�s)';
}else {
$desc_zonas=substr($desc_zonas,0,strlen($desc_zonas)-1);
}
Expand All @@ -332,7 +332,7 @@ function GetSins($filtro,&$error) {
$cuenta_ciudades++;
}
if ($cuenta_ciudades>1){
$desc_ciudades=substr(substr($desc_ciudades,0,strlen($desc_ciudades)-1),0,25).'...(más)';
$desc_ciudades=substr(substr($desc_ciudades,0,strlen($desc_ciudades)-1),0,25).'...(m�s)';
}else{
$desc_ciudades=substr($desc_ciudades,0,strlen($desc_ciudades)-1);
}
Expand All @@ -352,7 +352,7 @@ function GetSins($filtro,&$error) {
$cuenta_localidades++;
}
if($cuenta_localidades>1){
$desc_localidades=substr(substr($desc_localidades,0,strlen($desc_localidades)-1),0,25).'...(más)';
$desc_localidades=substr(substr($desc_localidades,0,strlen($desc_localidades)-1),0,25).'...(m�s)';
}else{
$desc_localidades=substr($desc_localidades,0,strlen($desc_localidades)-1);
}
Expand Down
1 change: 1 addition & 0 deletions examples/data.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a:3:{i:0;a:3:{s:10:"idProducto";s:1:"2";s:6:"nombre";s:1:"3";s:6:"precio";s:1:"4";}i:1;a:3:{s:10:"idProducto";s:1:"2";s:6:"nombre";s:1:"3";s:6:"precio";s:1:"4";}i:2;a:3:{s:10:"idProducto";s:1:"6";s:6:"nombre";s:6:"fdfdfd";s:6:"precio";s:6:"dffdfd";}}
80 changes: 80 additions & 0 deletions examples/example2.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?

use eftec\cloudking\CloudKing;

@session_start();

include "../vendor/autoload.php";
include "Example2WSService.php";

$service=new Example2WSService();
//$objws->GetSin


$FILE = 'http://'.$_SERVER["SERVER_NAME"].$_SERVER["SCRIPT_NAME"];
$NAMESPACE="examplenamespace";
$NAME_WS='Example2WS';


$ns=new CloudKing($FILE, $NAMESPACE, $NAME_WS);

$ns->soap12=false;
$ns->verbose=2;
$ns->allowed_format["POST"]=true;
//$ns->allowed_format["GET"]=false;
$ns->variable_type="array";
$ns->serviceInstance=$service;
$ns->description="Ejemplo servidor SOAPUI";

$ns->addfunction("ping",
array(
CloudKing::argPrim('ping_param', 's:string'),
),
array(
CloudKing::argPrim('return', 's:string')
),
"Descripcion :Prueba de conexion"
);
$ns->addfunction("GetProducto",
[
CloudKing::argPrim('idProducto', 's:integer')
],
[
CloudKing::argComplex('return', 'tns:Producto')
],
"Descripcion :obtiene los datos de una objeto"
);
$ns->addfunction("InsertProducto",
array(
CloudKing::argComplex('Producto', 'tns:Producto')
),
array(
CloudKing::argPrim('return', 's:boolean')
),
"Descripcion :obtiene los datos de una objeto"
);
$ns->addfunction("GetProductos",
[

],
[
CloudKing::argList('return', 'tns:Producto', 0, 'unbounded')
],
"Descripcion :Obtiene una lista de productos"
);

// ***** type
$ns->addtype("Producto",
[
CloudKing::argPrim('idProduct','s:integer'),
CloudKing::argPrim('nombre','s:string'),
CloudKing::argPrim('precio','s:integer')
]);
$ns->addtype("ProductoArray",
array(
CloudKing::argList('Producto','tns:Producto','0','unbounded')
));

$r=$ns->run();
echo $r;
exit;
14 changes: 8 additions & 6 deletions generic_client.php → examples/generic_client.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
<?
include_once "./wslib/ckclient.2.3.php";

use eftec\cloudking\CloudKingClient;

include "../vendor/autoload.php";




/***************************************** Implementation *****************************************/
class Sin_WSClient {
var $url='http://localhost/currentproject/cloudking/webservice_example.php';
var $tempuri='http://localhost/currentproject/cloudking/webservice_example.php/';
class ExampleCLient {
var $url='http://desannoc.vtr.cl/jcastro/sinws/webservice1.php';
var $tempuri='http://desannoc.vtr.cl/jcastro/sinws/webservice1.php/';

// Descripcion :Prueba de conexion
// ping_param =
function ping($ping_param) {
$_obj=new CKClient();
$_obj=new CloudKingClient();
$_obj->tempuri=$this->tempuri;
$_param='';
$_param.=$_obj->array2xml($ping_param,'ts:ping_param',false,false);
Expand Down Expand Up @@ -262,7 +264,7 @@ function GetCombo_pat_localidad($codi_localidad) {
}
} // end Sin_WS

$obj=new Sin_WSClient();
$obj=new ExampleCLient();


echo "llamando al webservice, funcion ping con parametro string <br>";
Expand Down
File renamed without changes.
Loading

0 comments on commit ce09d63

Please sign in to comment.