This commit is contained in:
Roly Rudy Gutierrez Pinto
2017-02-21 15:46:11 -04:00
parent 68dfe52e3e
commit 8699731463
3 changed files with 54 additions and 33 deletions

View File

@@ -1,5 +1,5 @@
<?php
ini_set( "soap.wsdl_cache_enabled", "0" ); //disabling WSDL cache
ini_set("soap.wsdl_cache_enabled", 0); //disabling WSDL cache
define( 'WEB_SERVICE_VERSION', '2.0' );
@@ -1240,7 +1240,10 @@ function claimCase($params)
return $res;
}
$server = new SoapServer($wsdl);
$options = array(
'cache_wsdl' => WSDL_CACHE_NONE
);
$server = new SoapServer($wsdl, $options);
$server->addFunction("Login");
$server->addFunction("ProcessList");

View File

@@ -1,14 +1,14 @@
<?php
$filewsdl = PATH_METHODS . 'services' . PATH_SEP . 'pmos2.wsdl';
$content = file_get_contents( $filewsdl );
$lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en';
$content = file_get_contents($filewsdl);
$http = (isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
$endpoint = $http . '://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/sys' . SYS_SYS . '/' . $lang . '/classic/services/soap2';
$http = G::is_https() ? 'https' : 'http';
$port = $_SERVER['SERVER_PORT'] === '80' ? '' : ':' . $_SERVER['SERVER_PORT'];
$lang = defined('SYS_LANG') ? SYS_LANG : 'en';
$endpoint = $http . '://' . $_SERVER['SERVER_NAME'] . $port . '/sys' . SYS_SYS . '/' . $lang . '/neoclassic/services/soap2';
$content = str_replace( "___SOAP_ADDRESS___", $endpoint, $content );
header( "Content-Type: application/xml;" );
$content = str_replace("___SOAP_ADDRESS___", $endpoint, $content);
header("Content-Type: application/xml;");
print $content;

View File

@@ -96,33 +96,51 @@ function ws_parser($result) {
return $rows;
}
function ws_open() {
global $sessionId;
global $client;
$endpoint = WS_WSDL_URL;
$sessionId = '';
/**
* Initiates a connection using the SoapClient object, to start a web services
* session in ProcessMaker.
*
* @global type $sessionId
* @global SoapClient $client
* @return int
* @throws Exception
*/
function ws_open()
{
global $sessionId;
global $client;
$endpoint = WS_WSDL_URL;
$sessionId = '';
$client = new SoapClient(
$endpoint,
['stream_context' => stream_context_create(['ssl' => ['verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true]])]
);
$streamContext = stream_context_create(array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
))
);
$options = array(
"cache_wsdl" => WSDL_CACHE_NONE,
"stream_context" => $streamContext
);
$client = new SoapClient($endpoint, $options);
$user = WS_USER_ID;
$pass = WS_USER_PASS;
$user = WS_USER_ID;
$pass = WS_USER_PASS;
$params = array (
'userid' => $user,
'password' => $pass
);
$result = $client->__SoapCall('login', array (
$params
));
$params = array(
'userid' => $user,
'password' => $pass
);
$result = $client->__SoapCall('login', array(
$params
));
if ($result->status_code == 0) {
$sessionId = $result->message;
return 1;
}
throw (new Exception($result->message));
if ($result->status_code == 0) {
$sessionId = $result->message;
return 1;
}
throw (new Exception($result->message));
}
function ws_open_with_params($endpoint, $user, $pass) {