RE: SOAP PEAR Module - Array Issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks

I guess the Pear SOAP Has issues as this would not work w/ PHP 4.2 @ PEAR. Your example did not work as posted but your guidance and a modification of the arrays and the WSDL does its job.

Thanks, I have posted the modified code as an example of what works with this WSDL.


CODE --

<?php

error_reporting(E_ALL);

// Do not cache the WSDL file <- good for developing/bad for production $ini = ini_set("soap.wsdl_cache_enabled","0");


try {
	$options = array(
		'trace' => true,
		'exceptions' => true,
		'soap_version' => SOAP_1_1
	);

	$client = new SoapClient("http://api.emaildirect.com/v3/api.asmx?WSDL";, $options);
	//print_r($client);

        // Build the parameters
	$parameter = array(
		'AccountName' => 'UserName',
		'APIPassword' => 'Password',
		'Email' => 'foo@example.com',
		'SourceID' => '1',
		'PublicationIDs' => array(2,3),
		'ListIDs' => array(2,3),
		'AutoResponderID' => '0',
		'CustomFields' => array(array('FieldName' => 'FirstName', 'Value' => 'Ross'),array('FieldName' => 'LastName', 'Value' => 'Ross'))
	);
        // Call the Email Force Addition function
	$client->Email_ForceAddition($parameter);

        // Shows the Request and Response in XML
	echo("<br />REQUEST :<br />" .
		htmlspecialchars($client->__getLastRequest()) . "<br />");
	echo("<br />RESPONSE:<br />" .
		htmlspecialchars($client->__getLastResponse()) . "<br />");
}
catch (SoapFault $ex) { // Catch any errors and do appropriate debugging
	echo "Error:<br />" . nl2br($ex->faultcode) . '<br /><br />';
	echo 'Error Details:<br />'. nl2br($ex->faultstring) . '<br />';
	echo("<br />REQUEST :<br />" .
		htmlspecialchars($client->__getLastRequest()) . "<br />");
	echo("<br />RESPONSE:<br />" .
		htmlspecialchars($client->__getLastResponse()) . "<br />");
}
?>

-----Original Message-----
From: Jeffery Fernandez [mailto:jeffery@ivt.com.au] 
Sent: Monday, June 09, 2008 9:17 PM
To: soap@lists.php.net
Subject: Re:  SOAP PEAR Module - Array Issues

Ross,

try the example shown below. I am not using PEAR soap library but the standard PHP library:

<?php

error_reporting(E_ALL);

// Do not cache the WSDL file <- good for developing/bad for production $ini = ini_set("soap.wsdl_cache_enabled","0");


try {
	$options = array(
		'trace' => true, 
		'exceptions' => true, 
		'soap_version' => SOAP_1_1
	);
	
	$client = new SoapClient("http://api.emaildirect.com/v3/api.asmx?WSDL";, $options);
	//print_r($client);
	
        // Build the parameters
	$parameter = array(
		'AccountName' => 'test',
		'APIPassword' => '123456',
		'Email' => 'foo@example.com',
		'SourceID' => '',
		'PublicationIDs' => array(array('int' => 2), array('int' => 3)),
		'ListIDs' => array(array('int' => 2), array('int' => 3)),
		'AutoResponderID' => '',
		'CustomFields' => array(
			array('CustomField' => 
				array('FieldName' => '', 'Value' => '')
			)
		)
	);	
        // Call the Email Force Addition function
	$client->Email_ForceAddition($parameter);
	
        // Shows the Request and Response in XML
	echo("<br />REQUEST :<br />" . 
		htmlspecialchars($client->__getLastRequest()) . "<br />");
	echo("<br />RESPONSE:<br />" .
		htmlspecialchars($client->__getLastResponse()) . "<br />");	
}
catch (SoapFault $ex)  // Catch any errors and do appropriate debugging {
	echo "Error:<br />" . nl2br($ex->faultcode) . '<br /><br />';
	echo 'Error Details:<br />'. nl2br($ex->faultstring) . '<br />';
	echo("<br />REQUEST :<br />" . 
		htmlspecialchars($client->__getLastRequest()) . "<br />");
	echo("<br />RESPONSE:<br />" .
		htmlspecialchars($client->__getLastResponse()) . "<br />");	
}
?>

They above should work provided you give the right Account name and API Password.

cheers,
Jeffery Fernandez

On Fri, 6 Jun 2008 06:14:22 am Ross King II wrote:
> I am using the SOAP Package and have an issue.
>
[snip]



--
Internet Vision Technologies
Level 1, 520 Dorset Road
Croydon
Victoria - 3136
Australia
web: http://www.ivt.com.au
phone: +61 3 9723 9399
fax: +61 3 9723 4899


-- 
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux