/    Sign up×
Community /Pin to ProfileBookmark

NuSOAP – Need Some Help

Hi Guys,

I hope somebody can help me.
I am currently working on the integration of backend inventory and e-commerce website through NuSOAP.
I build A script which connects to the backend and pass the data through API
but I still can’t see any data sent there.
I was wandering if you could have a look at my code and maybe tell me your opinion what could be wrong.
Thank you very much

[code=php]<?php
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Pull in the NuSOAP code
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
require_once(‘../lib/nusoap.php’);
$proxyhost = isset($_POST[‘proxyhost’]) ? $_POST[‘proxyhost’] : ”;
$proxyport = isset($_POST[‘proxyport’]) ? $_POST[‘proxyport’] : ”;
$proxyusername = isset($_POST[‘proxyusername’]) ? $_POST[‘proxyusername’] : ”;
$proxypassword = isset($_POST[‘proxypassword’]) ? $_POST[‘proxypassword’] : ”;
$useCURL = isset($_POST[‘usecurl’]) ? $_POST[‘usecurl’] : ‘0’;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Create the client instance
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$client = new nusoap_client(‘http://xxxxxxxxxxxxxxxx.xxxx.xxx-xxx.xxxxx:xxx/xxxx/xxxxxxx’, true, $proxyhost, $proxyport, $proxyusername, $proxypassword);
$client->setUseCurl($useCURL);
$client->useHTTPPersistentConnection();
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Check for an error
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$err = $client->getError();
if ($err)
{
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Display the error
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
echo ‘<h2>Constructor error</h2><pre>’ . $err . ‘</pre>’;
// At this point, you know the call that follows will fail
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// initialize params array
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$params = array
(‘ACustomer’ => array
(
‘Code’ => ‘ABC123′
,’Name’ => ‘Paul Olla’
,’Address1′ => ‘Unit 1 Chess Business Park’
,’Address2′ => ‘Unit 1 Chess Business Park’
,’Address3′ => ‘Unit 1 Chess Business Park’
,’Address4′ => ‘Unit 1 Chess Business Park’
,’Address5′ => ‘Unit 1 Chess Business Park’
,’PostCode’ => ‘WD52A5′
,’Balance’ => 0,0
,’OnOrder’ => 0,0
,’Unbilled’ => 0,0
,’UnAllocated’ => 0,0
,’CreditLimit’ => 0,0
,’Phone1′ => ‘06466565465’
,’Phone2′ => ‘65160498465’
,’Fax’ => ‘69494949849’
,’EMail’ => ‘[email protected]
,’YTDNetTurnover’ => 0,0
,’DeliveryAddress1′ => ‘Unit 4 Chess Business Park’
,’DeliveryAddress2′ => ‘Unit 4 Chess Business Park’
,’DeliveryAddress3′ => ‘Unit 4 Chess Business Park’
,’DeliveryAddress4′ => ‘Unit 4 Chess Business Park’
,’DeliveryAddress5′ => ‘Unit 4 Chess Business Park’
,’DefautVATRate’ => 0,0
)
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Call the SOAP method
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$result = $client->call(‘AddNewCustomer’, $params);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Check for a fault
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if ($client->fault)
{
echo ‘<h2>Fault</h2><pre>’;
print_r($result);
echo ‘</pre>’;
}
else
{
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Check for errors
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$err = $client->getError();
if ($err) {
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Display the error
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
echo ‘<h2>Error</h2><pre>’ . $err . ‘</pre>’;
}
/*else
{
if ($result == 0)
{
// Display the result
echo ‘<h2>Result</h2>’;
echo ‘<br><h2>Customer creation successful</h2><br><pre>’;
print_r($result);
echo ‘</pre>’;
}
*/
else
{
echo ‘<h2>Result</h2>’;
echo ‘<br><h2>Customer creation successful</h2><br><pre>’;
print_r($result);
echo ‘</pre>’;
}
//}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Display the request
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
echo ‘<h2>Request</h2>’;
echo ‘<pre>’ . htmlspecialchars($client->request, ENT_QUOTES) . ‘</pre>’;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Display the response
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
echo ‘<h2>Response</h2>’;
echo ‘<pre>’ . htmlspecialchars($client->response, ENT_QUOTES) . ‘</pre>’;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Display the debug messages
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
echo ‘<pre>’ . htmlspecialchars($client->debug_str, ENT_QUOTES) . ‘</pre>’;
?>
[/code]

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @Gilopencart spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...