hi i also have some problem to access web api
my api taking arguments as an array but the correct request is not generated my code is like this[php]<?php
set_time_limit(3*60);
/*
* $Id: wsdlclient1.php,v 1.3 2007/11/06 14:48:48 snichol Exp $
*
* WSDL client sample.
*
* Service: WSDL
* Payload: document/literal
* Transport: http
* Authentication: none
*/
require_once('../lib/nusoap.php');
echo "vinay55";
$proxyhost = isset($_POST['proxyhost']) ? $_POST['proxyhost'] : '';
$proxyport = isset($_POST['proxyport']) ? $_POST['proxyport'] : '';
$proxyusername = isset($_POST['proxyusername']) ? $_POST['proxyusername'] : '';
$proxypassword = isset($_POST['proxypassword']) ? $_POST['proxypassword'] : '';
$client = new nusoap_client('http://api.payloadz.com/payloadzws.asmx?WSDL', 'wsdl',
$proxyhost, $proxyport, $proxyusername, $proxypassword);
echo "vinay56";
$err = $client->getError();
echo "vinay57";
if ($err) {
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
}
/* REQUIRED PARAMETER */
echo "vinay58";
$username ="PL_API_FAD30946AC021BBD374DB4CF0F27AB21";
$password = "shyam";
$signature = "1AE78E32391B4AC70F0F492717D88F48FAD30946AC021BBD3 74DB4CF0F27AB21";
echo "vinay59";
//$item_number[] =array('item_number1'=>'nv2','item_number2'=>'nv1' );
//$item_name[] = array('string'=>'nov2','string'=>'nov1');
//$item_price[] =array('double'=> 10.00,'double'=> 10.00);
//$quantity[] = array('int'=>2,'int'=>2);
$item_number =array('nv2','nv1');
$item_name = array('nov2','nov1');
$item_price =array(10.00,10.00);
$quantity = array(2,2);
//$item_number1 =array('i_number' => $item_number);
//$item_name1 = array('i_name' => $item_name);
//$item_price1 =array('i_price' => $item_price);
//$quantity1 = array('i_quantity' => $quantity);
echo "vinay66";
$mc_gross = "20.00";
$mc_currency = "USD";
$payer_email = "shyam@econnoisseur.com";
$flag_txn_id = "false"; /*/////// NOT GENERATE NEW TXT_ID, */
$txn_id="NDUBXIKNGRIGGKZKTQLF";
/* OPTIONAL PARAMETERS */
$business="";
$mc_fee="0.00";
$invoice="";
$receipt_id="";
$custom="";
$settle_amount="0";
$settle_currency="";
$exchange_rate="0";
$first_name="";
$last_name="";
$address_street="";
$address_status="";
$address_city="";
$address_state="";
$address_zip="";
$address_country="";
$address_country_code="";
$param = array('APIusername' => $username, 'APIpassword' => $password, 'APIsignature' => $signature,'item_number' =>$item_number,'item_name' =>$item_name,
'item_price'=>$item_price, 'quantity'=>$quantity, 'mc_gross'=>$mc_gross, 'mc_currency'=>$mc_currency, 'payer_email'=>$payer_email, 'flag_txn_id'=>$flag_txn_id,
'txn_id'=>$txn_id, 'business'=>$business,'mc_fee'=>$mc_fee,'invoice'= >$invoice, 'receipt_id'=>$receipt_id, 'custom'=>$custom, 'settle_amount'=>$settle_amount, 'settle_currency'=>$settle_currency, 'exchange_rate'=>$exchange_rate, 'first_name'=>$first_name, 'last_name'=>$last_name, 'address_street'=>$address_street,
'address_status'=>$address_status, 'address_city'=>$address_city, 'address_state'=>$address_state, 'address_zip'=>$address_zip, 'address_country'=>$address_country, 'address_country_code'=>$address_country_code);
echo "vinay61";
// print_r ($param);
$vinayres=$client->getHTTPBody();
echo $vinayres;
//calling web sevices
$result = $client->call('TransactionCreation', array('parameters' => $param), '', '', false, true);
echo "vinay62";
echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
// 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 {
// Display the result
echo '<h2>Result</h2>';
print_r($result['TransactionCreationResult']);
}
echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
}
//echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';
?>[/php]
Please enclose any code within the proper code tags. See the Posting Guidelines on how to do that.
MODERATOR