PHP Error SoapClient getProxy() - php

Getting this error while using soap service php :
Fatal error: Uncaught SoapFault exception: [Client] Function ("getProxy") is not a valid method for this service in C:\webserver\www\feeder\index.php:7 Stack trace: #0 C:\webserver\www\feeder\index.php(7): SoapClient->__call('getProxy', Array) #1 C:\webserver\www\feeder\index.php(7): SoapClient->getProxy() #2 {main} thrown in C:\webserver\www\feeder\index.php on line 7
here's my code :
<?php
$wsdl = "http://localhost:8182/fg/live.php?wsdl";
$username = "aaaaa";
$password = "123456";
$client = new SoapClient($wsdl);
$proxy = $client->getProxy();
$token = $proxy->GetToken($username, $password);
var_dump("Get Token = ".$token);
$table = $proxy->ListTable($token);
var_dump("Tabel = ".$table);
?>
There's something wrong with my code ?

Please have a look at the PHP SoapClient Doku, there is no getProxy-Method. The client itself calls the functions defined in wsdl:
$token = $client->GetToken();
$client->ListTable($token);
And make shure, that you check $token, if it's really a single variable, or if it is an object.

Related

Submitting GetUserOofSettings and SetUserOofSettings request

Does anyone have any code about both getting and setting users OOF messages using Garethp/php-ews library by any chance?
(https://learn.microsoft.com/en-us/previous-versions/office/developer/exchange-server-2010/aa563465(v=exchg.140))
(https://learn.microsoft.com/en-us/previous-versions/office/developer/exchange-server-2010/aa493825(v=exchg.140))
I have tried the following
use garethp\ews\API\Type;
use garethp\ews\MailAPI;
use garethp\ews\API\Enumeration\DistinguishedFolderIdNameType;
use garethp\ews\API\Enumeration\UserConfigurationPropertyType;
use garethp\ews\API\Enumeration\GetUserOofSettingsRequestType;
$email = 'me#mycompany.com';
$host = 'myexchserver'; $username = 'myusername'; $password = 'mypassword';
$api = MailAPI::withUsernameAndPassword($host,$username,$password,["version" => 'Exchange2010_SP1', 'impersonation' => $email]);
$response = $api->getClient()->GetUserOofSettingsRequest(['Address' => 'someuser#mycompany.com']);
But get the following error.
Fatal error: Uncaught SoapFault exception: [Client] Function ("GetUserOofSettingsRequest") is not a valid method for this service in /Scripts/vendor/garethp/php-ews/src/API/NTLMSoapClient.php:119 Stack trace: #0 /Scripts/vendor/garethp/php-ews/src/API/NTLMSoapClient.php(119): SoapClient->__call() #1 /Scripts/vendor/garethp/php-ews/src/API/ExchangeWebServices/MiddlewareFactory.php(18): garethp\ews\API\NTLMSoapClient->__call() #2 /Scripts/vendor/garethp/php-ews/src/API/ExchangeWebServices.php(510): garethp\ews\API\ExchangeWebServices->garethp\ews\API\ExchangeWebServices\{closure}() #3 /Scripts/vendor/garethp/php-ews/src/API/ExchangeWebServices/MiddlewareFactory.php(32): garethp\ews\API\ExchangeWebServices->garethp\ews\API\{closure}() #4 /Scripts/vendor/garethp/php-ews/src/API/ExchangeWebServices.php(510): garethp\ews\API\ExchangeWebServices->garethp\ews\API\ExchangeWebServices\{closure}() #5 /Scripts/vendor/garethp/php-ews/src/API/ExchangeWebServices/MiddlewareFactory.php(48): garethp\ews\API\ExchangeWebServices->garethp\ew in /Scripts/vendor/garethp/php-ews/src/API/NTLMSoapClient.php on line 119
Thanks

Google AndroidPublisher Subscriptions acknowledge how to

I created a subscription for my Android app and here's my code to confirm subscription assignments, but I get an error
$packageName = "com.example.srkn";
$productId = "com.example.srkn.aylik";
$token = "<some token here>";
require 'vendor/autoload.php';
$client = new \Google_Client();
$client->setAuthConfig('ts.json');
$client->addScope('https://www.googleapis.com/auth/androidpublisher');
$service = new \Google_Service_AndroidPublisher($client);
$postBody = "okey";
$para = "test";
$purchase = $service->purchases_subscriptions->acknowledge($packageName, $productId, $token,$postBody,$para);
//echo json_encode($purchase);
Fatal error: Uncaught TypeError: Argument 4 passed to
Google_Service_AndroidPublisher_Resource_PurchasesSubscriptions::acknowledge()
must be an instance of
Google_Service_AndroidPublisher_SubscriptionPurchasesAcknowledgeRequest,
string given, called in /home/serkanka/public_html/dgr/onayla.php on
line 17 and defined in
/home/serkanka/public_html/dgr/vendor/google/apiclient-services/src/Google/Service/AndroidPublisher/Resource/PurchasesSubscriptions.php:40
Stack trace: #0 /home/serkanka/public_html/dgr/onayla.php(17):
Google_Service_AndroidPublisher_Resource_PurchasesSubscriptions->acknowledge('com.text.spec.s...',
'com.text.spec.s...','jlkehndmfjoaenc...', 'test', 'test') #1 {main}
thrown in
/home/serkanka/public_html/dgr/vendor/google/apiclient-services/src/Google/Service/AndroidPublisher/Resource/PurchasesSubscriptions.php
on line 40
The postbody (4th parameter) should be an instance of Google_Service_AndroidPublisher_SubscriptionPurchasesAcknowledgeRequest
You can set the developerPayload on the object like so:
$requestBody = new Google_Service_AndroidPublisher_SubscriptionPurchasesAcknowledgeRequest();
$requestBody->setDeveloperPayload('your_developer_payload');

PHP SOAP Client is not working

I never developed a SOAP client, and now I have to do it and am having difficulties. This are the input parameters I have to send to the method "Agregar":
<Clientes>
<Cliente>
<Rut>123456785</Rut>
<Nombre>123456785</Nombre>
</Cliente>
</Clientes>
this is the testing code for the client I have done yet:
<?php
class Socio {
function Socio($rut, $nombre)
{
$this->nombre = $nombre;
$this->rut = $rut;
}
}
$client = new SoapClient("theurl...");
$socio = new Socio(156371777, "Sebastian");
$params = array(
"Cliente" => $socio,
);
$response = $client->__soapCall("Agregar", $params);
var_dump($response);
but it is not working... I get the following error:
Fatal error: Uncaught SoapFault exception: [soap:Server] The server can't process the request. ---> The value cannot be null. Parameter name: s in /var/www/friends/awto/intouch/ccinterface.php:22 Stack trace: #0 /var/www/friends/awto/intouch/ccinterface.php(22): SoapClient->__soapCall('Agregar', Array) #1 {main} thrown in /var/www/friends/awto/intouch/ccinterface.php on line 22

How to add new account, update and delete in bing ads under any user account by php?

I have tried below code for updating but it did not work it showed error code:
Fatal error: Uncaught SoapFault exception: [a:InternalServiceFault] Cannot create an abstract class. in D:\xampp\htdocs\bingTest\UpdateAccount.php:81 Stack trace: #0 D:\xampp\htdocs\bingTest\UpdateAccount.php(81): SoapClient->__call('UpdateAccount', Array) #1 D:\xampp\htdocs\bingTest\UpdateAccount.php(81): SoapClient->UpdateAccount(Object(BingAds\CustomerManagement\UpdateAccountRequest)) #2 D:\xampp\htdocs\bingTest\UpdateAccount.php(62): UpdateAccount(Object(BingAds\Proxy\ClientProxy), Object(BingAds\CustomerManagement\AdvertiserAccount)) #3 {main} thrown in D:\xampp\htdocs\bingTest\UpdateAccount.php on line 81
$wsdl = "https://clientcenter.api.sandbox.bingads.microsoft.com/Api/CustomerManagement/v9/CustomerManagementService.svc?singleWsdl";
$proxy = ClientProxy::ConstructWithAccountAndCustomerId($wsdl, $UserName, $Password, $DeveloperToken, $AccountId, null, null);
$last_modified_time=GetAccount($proxy,$AccountId);
$account_obj=new AdvertiserAccount();
$account_obj->AccountType='Advertisement';
$account_obj->CountryCode="US";
$account_obj->CurrencyType="USD";
$account_obj->Id=$AccountId;
$account_obj->LastModifiedTime=$last_modified_time;
$account_obj->Name="Test Account";
$account_obj->AccountLifeCycleStatus='Pause';
UpdateAccount($proxy, $account_obj);
function GetAccount($proxy,$AccountId)
{
$account_obj=new GetAccountRequest();
$account_obj->AccountId=$AccountId;
return $proxy->GetService()->GetAccount($account_obj)->Account->LastModifiedTime;
}
function UpdateAccount($proxy, $update_account_info)
{
$request = new UpdateAccountRequest();
$request->Account = $update_account_info;
return $proxy->GetService()->UpdateAccount($request);
}
In case if you still need a solution. You need to do this:
$encodedAccount = new \SoapVar(
$account,
SOAP_ENC_OBJECT,
'AdvertiserAccount',
'https://bingads.microsoft.com/Customer/v9/Entities'
);
$request->Account = $encodedAccount;

PHP SOAP : Object reference not set to an instance of an object

I need your help
I have to use PHP functions from a web service SOAP
The request XML is as follows
<OTA_HotelDescriptiveInfoRQ xmlns="http://www.opentravel.org/OTA/2003/05" Version="1">
<POS>
<Source AgentSine="user" AgentDutyCode="pass" />
</POS>
<HotelDescriptiveInfos>
<HotelDescriptiveInfo ChainCode="H4U" HotelCode="696"/>
</HotelDescriptiveInfos>
</OTA_HotelDescriptiveInfoRQ>
Here is my PHP code:
$soapClient = new SoapClient("http://otatest.apixml.com/dispatcher.asmx?WSDL");
$header = new SOAPHeader('http://xmlota.wspan.com/webservice/', 'authentication', array('username' => 'user', 'password' => 'pass'));
$soapClient->__setSoapHeaders($header);
$param['POS']['Source']['AgentSine'] = 'user';
$param['POS']['Source']['AgentDutyCode'] = 'pass';
$param['HotelDescriptiveInfos']['HotelDescriptiveInfo']['ChainCode'] = 'H4U';
$param['HotelDescriptiveInfos']['HotelDescriptiveInfo']['HotelCode'] = '696';
$response = $soapClient->sendOTAHotelDescriptiveInfo($param);
And here is the error I'm trying for several days but I can not resolve it
Fatal error: Uncaught SoapFault exception: [soap:Server] System.Web.Services.Protocols.SoapException: Server was unable to process request.
---> System.NullReferenceException: Object reference not set to an instance of an object. at H4U.Webservices.OTA.SoapDispatcher.sendOTAHotelDescriptiveInfo(OTA_HotelDescriptiveInfoRQ OTA_HotelDescriptiveInfoRQ)
--- End of inner exception stack trace ---
in /home/dimavoya/public_html/soap/soap.php:43
Stack trace:
#0 /home/dimavoya/public_html/soap/soap.php(43): SoapClient->__call('sendOTAHotelDes...', Array)
#1 /home/dimavoya/public_html/soap/soap.php(43): SoapClient->sendOTAHotelDescriptiveInfo(Object(SoapVar))
#2 {main} thrown in
I remain at your disposal for more information
Thank you in advance

Categories