本文整理汇总了PHP中nusoap_client::setHeaders方法的典型用法代码示例。如果您正苦于以下问题:PHP nusoap_client::setHeaders方法的具体用法?PHP nusoap_client::setHeaders怎么用?PHP nusoap_client::setHeaders使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nusoap_client
的用法示例。
在下文中一共展示了nusoap_client::setHeaders方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/**
* 建立nusoap client
*
*/
private function create($header = 'US000000000')
{
if (!$this->client) {
//$this->client = new nusoap_client(LIB_PATH.'\Service\oa.wsdl', true);
//$this->client = new nusoap_client("http://wlpt.gyaip.cn:8788/WebServices/Organ_Interface.asmx?WSDL", true);
//$this->client = new nusoap_client("http://61.144.60.102:8787/admin/WebServices/Organ_Interface.asmx?WSDL", true);
//$this->client = new nusoap_client("http://59.42.10.25:8001/Admin/WebServices/Organ_Interface.asmx?WSDL", true);
$this->client = new nusoap_client("http://www.wuliucheng.com/Admin/WebServices/Organ_Interface.asmx?WSDL", true);
$this->client->soap_defencoding = 'utf-8';
$this->client->decode_utf8 = false;
$header = "<SecurityHeader xmlns=\"http://tempuri.org/\"><UserId>US000000000</UserId></SecurityHeader>";
$this->client->setHeaders($header);
}
}
示例2: call
/**
* Executes a request
* @param type $method
* @param type $params k,v pairs where v's are raw(not url encoded)
*/
public function call($method, $params = array())
{
$params = is_array($params) ? $params : array();
$methods = array('CreateRebillCustomer' => array('customerTitle' => '', 'customerFirstName' => '', 'customerLastName' => '', 'customerAddress' => '', 'customerSuburb' => '', 'customerState' => '', 'customerCompany' => '', 'customerPostCode' => '', 'customerCountry' => '', 'customerEmail' => '', 'customerFax' => '', 'customerPhone1' => '', 'customerPhone2' => '', 'customerRef' => '', 'customerJobDesc' => '', 'customerComments' => '', 'customerURL' => ''), 'CreateRebillEvent' => array('RebillCustomerID' => '', 'RebillInvRef' => '', 'RebillInvDes' => '', 'RebillCCName' => '', 'RebillCCNumber' => '', 'RebillCCExpMonth' => '', 'RebillCCExpYear' => '', 'RebillInitAmt' => '', 'RebillInitDate' => '', 'RebillRecurAmt' => '', 'RebillStartDate' => '', 'RebillInterval' => '', 'RebillIntervalType' => '', 'RebillEndDate' => ''), 'QueryTransactions' => array('RebillCustomerID' => '', 'RebillID' => ''), 'DeleteRebillEvent' => array('RebillCustomerID' => '', 'RebillID' => ''), 'DeleteRebillCustomer' => array('RebillCustomerID' => ''), 'Transaction24HourReportByInvoiceReference' => array('ewayCustomerInvoiceRef' => ''));
$req = new nusoap_client($this->gateway, TRUE);
$headers = <<<head
\t\t<eWAYHeader xmlns="http://www.eway.com.au/gateway/rebill/manageRebill">
\t\t\t<eWAYCustomerID>{$this->eway_customer_id}</eWAYCustomerID>
\t\t\t\t<Username>{$this->eway_username}</Username>
\t\t\t\t<Password>{$this->eway_password}</Password>
\t\t</eWAYHeader>
head;
$req->setHeaders($headers);
if (!isset($methods[$method])) {
throw new Exception("This method is not yet implemented");
}
$params = array_merge($methods[$method], $params);
$tmp = "";
foreach ($params as $k => $v) {
$tmp .= sprintf('<%s>%s</%s>', $k, $v, $k);
}
$body = <<<body
\t\t<{$method} xmlns="http://www.eway.com.au/gateway/rebill/manageRebill">
\t\t{$tmp}
\t\t</{$method}>
body;
$result = $req->call($method, $body);
return $result;
}
示例3: call
/**
* Executes a request
* @param type $method
* @param type $params k,v pairs where v's are raw(not url encoded)
*/
public function call($method, $params = array())
{
$params = is_array($params) ? $params : array();
$methods = array('Transaction24HourReportByInvoiceReference' => array('ewayCustomerInvoiceRef' => ''));
$req = new nusoap_client($this->gateway, TRUE);
$headers = <<<head
<eWAYHeader xmlns="https://www.eway.com.au/gateway/services/TransactionReportService.asmx/">
<eWAYCustomerID>{$this->eway_customer_id}</eWAYCustomerID>
<UserName>{$this->eway_username}</UserName>
<Password>{$this->eway_password}</Password>
</eWAYHeader>
head;
$req->setHeaders($headers);
if (!isset($methods[$method])) {
throw new Exception("This method is not yet implemented");
}
$params = array_merge($methods[$method], $params);
$tmp = "";
foreach ($params as $k => $v) {
$tmp .= sprintf('<%s>%s</%s>', $k, $v, $k);
}
$body = <<<body
<{$method} xmlns="https://www.eway.com.au/gateway/services/TransactionReportService.asmx/">
{$tmp}
</{$method}>
body;
$result = $req->call($method, $body);
//echo '<h2>Request</h2><pre>' . htmlspecialchars($req->request, ENT_QUOTES) . '</pre>';
//echo '<h2>Response</h2><pre>' . htmlspecialchars($req->response, ENT_QUOTES) . '</pre>';
return $result;
}
示例4: createClient
/**
* Create an eWay SOAP client to the eWay token API.
*
* @param string $gateway_url
* URL of the gateway to connect to (could be the test or live gateway)
* @param string $eway_customer_id
* Your eWay customer ID
* @param string $username
* Your eWay business centre username
* @param string $password
* Your eWay business centre password
*
* @return nusoap_client
* A SOAP client to the eWay token API
*/
public static function createClient($gateway_url, $eway_customer_id, $username, $password)
{
// Set up SOAP client
$soap_client = new nusoap_client($gateway_url, FALSE);
$soap_client->namespaces['man'] = 'https://www.eway.com.au/gateway/managedpayment';
// Set up SOAP headers
$headers = "<man:eWAYHeader><man:eWAYCustomerID>" . $eway_customer_id . "</man:eWAYCustomerID><man:Username>" . $username . "</man:Username><man:Password>" . $password . "</man:Password></man:eWAYHeader>";
$soap_client->setHeaders($headers);
return $soap_client;
}
示例5: getNusoap
function getNusoap()
{
include_once 'nusoap.php';
$wsdl = 'http://localhost/cc-webservice/server/wsdl.php?wsdl';
//create instance
$nusoap = new nusoap_client($wsdl, true);
$user = "wsclient";
$pass = "secret";
//encrypt header value
$user = base64_encode($user);
$pass = base64_encode($pass);
$header = '<AuthSoapHeader>
<UserName>' . $user . '</UserName>
<Password>' . $pass . '</Password>
</AuthSoapHeader>';
//set header
$nusoap->setHeaders($header);
return $nusoap;
}
示例6: createToken
/**
* Create token on eWay.
*
* @param $paymentProcessor
* @param array $params
*
* @return int
* Unique id of the token created to manage this customer in eway.
*
* @throws \CRM_Core_Exception
*/
protected function createToken($paymentProcessor, $params)
{
if (civicrm_api3('setting', 'getvalue', array('group' => 'eway', 'name' => 'eway_developer_mode'))) {
// I'm not sure about setting status as in future we might do this in an api call.
CRM_Core_Session::setStatus(ts('Site is in developer mode. No communication with eway has taken place'));
return uniqid();
}
$gateway_URL = $paymentProcessor['url_recur'];
$soap_client = new nusoap_client($gateway_URL, FALSE);
$err = $soap_client->getError();
if ($err) {
throw new CRM_Core_Exception(htmlspecialchars($soap_client->getDebug(), ENT_QUOTES));
}
// Set namespace.
$soap_client->namespaces['man'] = 'https://www.eway.com.au/gateway/managedpayment';
// Set SOAP header.
$headers = "<man:eWAYHeader><man:eWAYCustomerID>" . $this->_paymentProcessor['subject'] . "</man:eWAYCustomerID><man:Username>" . $this->_paymentProcessor['user_name'] . "</man:Username><man:Password>" . $this->_paymentProcessor['password'] . "</man:Password></man:eWAYHeader>";
$soap_client->setHeaders($headers);
// Add eWay customer.
$requestBody = array('man:Title' => 'Mr.', 'man:FirstName' => $params['first_name'], 'man:LastName' => $params['last_name'], 'man:Address' => $params['street_address'], 'man:Suburb' => $params['city'], 'man:State' => $params['state_province'], 'man:Company' => '', 'man:PostCode' => $params['postal_code'], 'man:Country' => 'au', 'man:Email' => $params['email'], 'man:Fax' => '', 'man:Phone' => '', 'man:Mobile' => '', 'man:CustomerRef' => '', 'man:JobDesc' => '', 'man:Comments' => '', 'man:URL' => '', 'man:CCNumber' => $params['credit_card_number'], 'man:CCNameOnCard' => $this->getCreditCardName($params), 'man:CCExpiryMonth' => $this->getCreditCardExpiryMonth($params), 'man:CCExpiryYear' => $this->getCreditCardExpiryYear($params));
// Hook to allow customer info to be changed before submitting it.
CRM_Utils_Hook::alterPaymentProcessorParams($this, $params, $requestBody);
$soapAction = 'https://www.eway.com.au/gateway/managedpayment/CreateCustomer';
$result = $soap_client->call('man:CreateCustomer', $requestBody, '', $soapAction);
if ($result === FALSE) {
throw new CRM_Core_Exception('Failed to create managed customer - result is FALSE');
} elseif (is_array($result)) {
throw new CRM_Core_Exception('Failed to create managed customer - result (' . implode(', ', array_keys($result)) . ') is (' . implode(', ', $result) . ')');
} elseif (!is_numeric($result)) {
throw new CRM_Core_Exception('Failed to create managed customer - result is ' . $result);
}
return $result;
}
示例7: getNusoap
public function getNusoap()
{
$wsdl = wbConfig::get('WS_SERVER');
//create instance
$nusoap = new nusoap_client($wsdl, true);
$user = "wsclient";
$pass = "secret";
//encrypt header value
$user = base64_encode($user);
$pass = base64_encode($pass);
$header = '<AuthSoapHeader>
<UserName>' . $user . '</UserName>
<Password>' . $pass . '</Password>
</AuthSoapHeader>';
//set header
$nusoap->setHeaders($header);
return $nusoap;
}
示例8: _soapcall
private function _soapcall($call, $params)
{
oseRegistry::call('remote')->getClientBridge('soap');
$headers = '<eWAYHeader xmlns="http://www.eway.com.au/gateway/rebill/manageRebill">' . "\r\n" . '<eWAYCustomerID>' . $this->eWayCustomerID . '</eWAYCustomerID>' . "\r\n" . '<Username>' . $this->eWayUsername . '</Username>' . "\r\n" . '<Password>' . $this->eWayPassword . '</Password>' . "\r\n" . '</eWAYHeader>' . "\r\n";
$soapclient = new nusoap_client($this->soap_link . '?wsdl', 'WSDL');
$soapclient->setHeaders($headers);
$result = $soapclient->call($call, array('parameters' => $params));
/* Debug */
//echo '<h2>Request</h2><pre>' . htmlspecialchars($soapclient->request, ENT_QUOTES) . '</pre>';
//echo '<h2>Response</h2><pre>' . htmlspecialchars($soapclient->response, ENT_QUOTES) . '</pre>';
//echo '<h2>Debug</h2><pre>' . htmlspecialchars($soapclient->debug_str, ENT_QUOTES) . '</pre>';
//echo '<pre>'; print_r($result); echo '</pre>';
// Check for a fault
if ($soapclient->fault) {
echo '<div class="alert error"><h2>Fault</h2><pre>';
print_r($result);
echo '</pre></div>';
} else {
// Check for errors
$err = $soapclient->getError();
if ($err) {
// Display the error
echo '<div class="alert error"><h2>Error</h2><pre>' . $err . '</pre></div>';
} else {
return $result;
}
}
return false;
}
示例9: array
<a href="https://oauth.yandex.ru/authorize?response_type=code&client_id=06441eef0fa841478f8b2f73d6519117">Логин</a>
<?php
require_once 'lib/nusoap.php';
# авторизационный токен
$token = 'f0a3af8eef8c4b5996362850f6c58ca4';
# локаль
$locale = 'ru';
# путь к WSDL
$wsdlurl = 'https://api-sandbox.direct.yandex.ru/live/v4/wsdl/';
//'https://api.direct.yandex.ru/v4/wsdl/';
#######################################################
# создаем клиента
$client = new nusoap_client($wsdlurl, 'wsdl');
# параметры клиента
$client->authtype = 'basic';
$client->decode_utf8 = 0;
$client->soap_defencoding = 'UTF-8';
# добавляем заголовки
$headers = "<token>{$token}</token>\n <locale>{$locale}</locale>";
$client->setHeaders($headers);
$method = 'GetClientInfo';
$param = array('Filter' => array('StatusArch' => 'No'));
# отправляем запрос
$result = $client->call($method, $param);
# вывод результата
print_r($result);
?>
示例10: escapeshellcmd
require_once 'lib/nusoap.php';
// Get parameters
$plate = escapeshellcmd($_GET['plate']);
$company = escapeshellcmd($_GET['company']);
$user = escapeshellcmd($_GET['user']);
$pass = escapeshellcmd($_GET['pass']);
$ns = "http://tempuri.org/";
$oSoapClient = new nusoap_client('http://www.c2ls.co/c2lsservices/position.wsdl', true);
$parametros = array();
$parametros = array('plate' => $plate);
$headers = '<AuthCredentials xmlns="http://tempuri.org/">';
$headers .= " <strCompany>{$company}</strCompany>";
$headers .= " <strUserName>{$user}</strUserName>";
$headers .= " <strPassword>{$pass}</strPassword>";
$headers .= "</AuthCredentials>";
$oSoapClient->setHeaders($headers);
$respuesta = $oSoapClient->call("getCurrentPosition", $parametros);
if ($oSoapClient->fault) {
// Si
echo 'No se pudo completar la operación ' . $oSoapClient->getError();
die;
} else {
// No
$sError = $oSoapClient->getError();
if ($sError) {
echo 'Error!:' . $sError;
}
}
echo '<br>';
echo '<pre>';
print_r($respuesta);
示例11: test
public function test()
{
/*微软真垃圾,c#的webservice用这种方法不能传参数
$client= new SoapClient("http://wlpt.gyaip.cn/WebServices/Organ_Interface.asmx?WSDL");
echo "pass:".strtoupper(md5("admin"))."<br>";
$result = $client->EAMSGetLicense("GY-000001","admin",strtoupper(md5("admin")));
print_r($result);
*/
require_once LIB_PATH . '\\Utils\\nusoap\\nusoap.php';
//$client = new nusoap_client(LIB_PATH.'\Service\oa.wsdl', true);
//$client = new nusoap_client("http://wlpt.gyaip.cn:8788/WebServices/Organ_Interface.asmx?WSDL", true);
//$client = new nusoap_client("http://59.42.10.25:8001/Admin/WebServices/Organ_Interface.asmx?WSDL", true);
//$client = new nusoap_client("http://61.144.60.102:8787/admin/WebServices/Organ_Interface.asmx?WSDL", true);
$client = new nusoap_client("http://www.wuliucheng.com/Admin/WebServices/Organ_Interface.asmx?WSDL", true);
$client->soap_defencoding = 'UTF-8';
//不传递中文参数的话这行没有也行
$client->decode_utf8 = false;
$header = "<SecurityHeader xmlns=\"http://tempuri.org/\"><UserId>US000000000</UserId></SecurityHeader>";
$client->setHeaders($header);
//$params = array(
// "organId"=>"GY-00000",
// "userName"=>"admin",
// "userPassword"=>strtoupper(md5("admin"))
//);
//$client->setHeaders();
//$result = $client->call('EAMSGetLicense', array('parameters' =>$params), 'http://wlpt.gyaip.cn/WebServices', 'http://wlpt.gyaip.cn/WebServices/');
//$result = $client->call("Login",array('username'=>'admin','password'=>strtoupper(md5("admin"))));
//$result = $client->call('GetAllUpdateLog', array(), '', '');
//$result = $client->call('GetOrginfo', array('orginid'=>'BH167'), '', '');
//$result = $client->call('GetDepartmentById', array('deptid'=>'00000001'), '', '');
/*
$data = '<?xml version="1.0" encoding="GBK" ?><Root><Node name="Organ" id="" ><property name="OrganName" value="物流系统测试" /><property name="ShortName" value="简称" /><property name="ParentId" value="GY-00000" /><property name="RootOrganId" value="GY-00000" /><property name="Address" value="address" /><property name="Postcode" value="code" /><property name="Tel" value="123456" /><property name="Fax" value="fax" /><property name="Email" value="email" /><property name="ContactMan" value="contaceman" /><property name="ContactTel" value="contacephone" /></Node></Root>';
$result = $client->call('AddOrginfo', array('orginxml'=>$data), '', '');
*/
//00000281
$result = $client->call('GetOrganNextLevelCode', array('rootOrganId' => 'GY-00000', 'parentId' => 'GY-00000'), '', '');
//$result = $client->call('GetDeptmentNextLevelCode', array('organId'=>'00000421','deptId'=>''), '', '');
/*
$data = <<< XML
<?xml version="1.0" encoding="GBK" ?>
<Root>
<Node name="Employee" id="" >
<property name="OrganId" value="GY-00000" />
<property name="DeptId" value="00000101" />
<property name="PositionId" value="" />
<property name="EmployeeId" value="" />
<property name="Name" value="ken" />
<property name="LoginName" value="abc" />
<property name="Password" value="" />
<property name="EmployeeCode" value="" />
<property name="SortNum" value="0" />
<property name="EngageType" value="0" />
<property name="Mobile" value="" />
<property name="Status" value="0" />
<property name="Higher" value="" />
<property name="RegDate" value="2009-01-11 15:03:22" />
<property name="IsDelete" value="0" />
</Node>
</Root>
XML;
*/
/*
$data = '<?xml version="1.0" encoding="GBK" ?><Root><Node name="Employee" id="" ><property name="OrganId" value="GY-00000" /><property name="DeptId" value="00000101" /><property name="PositionId" value="" /><property name="EmployeeId" value="" /><property name="Name" value="kenl" /><property name="LoginName" value="abc" /><property name="Password" value="4a7d1ed414474e4033ac29ccb8653d9b" /><property name="EmployeeCode" value="" /><property name="SortNum" value="0" /><property name="EngageType" value="0" /><property name="Mobile" value="" /><property name="Status" value="0" /><property name="Higher" value="" /><property name="RegDate" value="2010-2-26 21:18:18" /><property name="IsDelete" value="0" /></Node></Root>';
*/
/*
$data = '<?xml version="1.0" encoding="GBK" ?><Root><Node name="Employee" id="" ><property name="OrganId" value="GY-00000" /><property name="DeptId" value="00000101" /><property name="PositionId" value="" /><property name="EmployeeId" value="" /><property name="Name" value="eee" /><property name="LoginName" value="ggg" /><property name="Password" value="4a7d1ed414474e4033ac29ccb8653d9b" /><property name="EmployeeCode" value="" /><property name="SortNum" value="0" /><property name="EngageType" value="0" /><property name="Mobile" value="" /><property name="Status" value="0" /><property name="Higher" value="" /><property name="RegDate" value="2010-2-26 21:45:10" /><property name="IsDelete" value="0" /></Node></Root>';
*/
/*
$data = '<?xml version="1.0" encoding="GBK" ?><Root><Node name="Department" id="00000374" ><property name="OrganId" value="BH175" /><property name="DeptId" value="" /><property name="LevelCode" value="" /><property name="DeptCode" value="" /><property name="DeptName" value="bbbbbbbbbbbbbb" /><property name="ParentId" value="" /><property name="SortNum" value="0" /><property name="Tel" value="te" /><property name="Fax" value="aaaa" /><property name="Master" value="" /><property name="DeputyMaster" value="" /><property name="Leader" value="" /><property name="Intro" value="" /><property name="Virtual" value="0" /><property name="Status" value="0" /><property name="IsDelete" value="0" /></Node></Root>';
$result = $client->call('UpdateDepartment', array('deptxml'=>$data), '', '');
*/
/*
$params = array(
"username"=>"admin",
"password"=>strtoupper(md5("admin"))
);
$result = $client->call('Login', array('parameters' =>$params), 'http://wlpt.gyaip.cn/WebServices', 'http://wlpt.gyaip.cn/WebServices/');
*/
/*
$data = '<?xml version="1.0" encoding="GBK" ?><Root><Node name="ValidateCode" id="" ><property name="RecordId" value="" /><property name="ValidateCode" value="abcd" /><property name="CreateDate" value="2010-2-27" /><property name="ValidateDate" value="2010-2-27" /><property name="UserId" value="EM00001158" /></Node></Root>';
$result = $client->call('AddValidateCode', array('validatexml'=>$data), '', '');
*/
//$result = $client->call('GetValidateCodeByUserId',array('userId'=>"US00001225"),'','');
//$result = $client->call('BuildValidateCode',array('userId'=>"US00001225"),'','');
/*
$client = new nusoap_client("http://localhost:16613/soapwithheader/myService.asmx?WSDL", true);
$client->decode_utf8 = false;
$header = "<MyHeader xmlns=\"http://tempuri.org/\"><UserID>admin</UserID><PassWord>admin</PassWord></MyHeader>";
$client->setHeaders($header);
$result = $client->call("HelloWorld2",array("contents"=>"hw"));
*/
//print_r($client);
//$result = $client->call("GetAllUpdateLog",array());
//$params = array("maxId"=>1285,"opertor"=>"LHK");
//$result = $client->call("GetNoUpdateLogId",array('parameters' =>$params), '', '');
echo "result:<br>";
//.........这里部分代码省略.........
示例12: detect_fault
//create instance
$ws_client = new nusoap_client($wsdl, true);
//debug if needed
//$ws_client->debugLevel = 1;
//header configuration
$user = "wsclient";
$pass = "secret";
//encrypt header value
$user = base64_encode($user);
$pass = base64_encode($pass);
$header = '<AuthSoapHeader>
<UserName>' . $user . '</UserName>
<Password>' . $pass . '</Password>
</AuthSoapHeader>';
//set header
$ws_client->setHeaders($header);
// Function to print Fault
function detect_fault()
{
global $ws_client;
//detect fault and error
if ($ws_client->fault) {
exit($ws_client->faultstring);
} else {
$err = $ws_client->getError();
if ($err) {
exit($err);
}
}
}
//Function to Echo Debug Result