NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Need to convert PHP 5 soap to NuSoap


Joined: 10 Oct 2008
Posts: 1
Reply with quote
I've got this code working with PHP 5's SOAP implementation, but I need to be able to send attachments so I have to convert it to work with NuSoap. I think I can figure the rest out once I just get the connection working. If you can help please do.

Code:

class AmazonMerchant
{
public $merchantIdentifier ;
public $merchantName ;
}

$classmap = array(
'Merchant' => 'AmazonMerchant'
);

$params = array(
'classmap' => $classmap,
'login' => 'username',
'password' => 'password',
'trace' => 1,
'exceptions' => 1
);

$client = new soapclient('https://merchant-api.amazon.com/gateway/merchant-interface-mime',$params);

$merchant = new AmazonMerchant() ;
$merchant->merchantIdentifier = 'Account_ID' ;
$merchant->merchantName = 'AccountName';



try
{
$response = $client->getAllPendingDocumentInfo($merchant, '_GET_ORDERS_DATA_') ;
$response = $client->__getLastResponse();
}
catch(SoapFault $fault) {
print_r($fault); // here ex returns us that there "looks like we got no XML document"
$response = $client->__getLastResponse();
echo $client->__getLastRequest();
}


Does anyone understand how both work well enough to help me rewrite this for use with NuSoap? I'm pretty sure the problem has to do with the $params array and maybe the $merchant class. Any help would be appreciated.
View user's profileFind all posts by tfittsySend private message


Joined: 28 Oct 2008
Posts: 1
Reply with quote
I know this post is a bit old but I thought I would post what I got working after some trial and error (lots of it):

Code:

$merchant = array('merchantIdentifier' => 'Your Merchant Token', 'merchantName' => 'Your Merchant Name');

include_once '/path/to/your/nusoap.php';
$nusoap = new nusoapclient('/path/to/your/merchant-interface-mime.wsdl', true);

$nusoap->username         = 'Your Merchant Email';
$nusoap->password         = 'Your Password';
$nusoap->authtype         = 'basic';
$nusoap->soap_defencoding   = 'UTF-8';

if ($nusoap->getError()) {
   echo "Error: " . $nusoap->getError();
   exit;
}

$params = array('merchant' => $merchant, 'messageType' => "_GET_ORDERS_DATA_");
$result = $nusoap->call('getAllPendingDocumentInfo', $params);

if ($nusoap->getError()) {
   echo "Error: " . $nusoap->getError();
   exit;
} else {
   print_r($nusoap->response);
   // Do what You need with $result
}


Its not pretty but it will get you started. Hope this helps as I have searched everywhere and found nothing but finally just started playing with it.
View user's profileFind all posts by ctalaveraSend private messageAIM Address
Need to convert PHP 5 soap to NuSoap
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic