Page 1 of 1
Problem with AddSubscriber via WebServices 2.0
Posted: Thu Mar 07, 2013 3:02 pm
by pixus
Hello everyone,
I have some difficulties in using AddSubscriber with WebServices 2.0
I used without any problem with webservices 1.0
I adapted the way to pass the parameters of the recipient, i put doublecheck = FALSE , i setted the keyColumn, and Overwrite = FALSE...
but I always get customerId = 0 and no subscriber Added.
I setted email, gender and MailType, as the guide suggest.
How can I proceed?
Anything to suggest to help me find the error?
Is there any log I can look into, into the application folder?
Thank you!
Re: Problem with AddSubscriber via WebServices 2.0
Posted: Thu Mar 07, 2013 4:53 pm
by pixus
is it maybe necessary to pass all the fields as parameters?
Or is it possible to send only the necessary fields and some others known ?
thank you
Re: Problem with AddSubscriber via WebServices 2.0
Posted: Tue Apr 02, 2013 8:52 am
by vadim
I have the similar problem. I've tried with different combinations of parameters and values, but every time I have the following error:
SoapFault exception: [SOAP-ENV:Client] Initial capacity must be greater than 0
With API v.1 it works ok, but API 2.0 not.
Please help.
Re: Problem with AddSubscriber via WebServices 2.0
Posted: Thu Apr 04, 2013 11:03 am
by mdoerschmidt
Hi!
Doing webservices in PHP could be tricky some time...
There are two problems:
1. Unlike other programming languages (like Java), PHP cannot infer datatypes in some cases, so the developer has to do more work here. That's a common problem.
2. The OpenEMM webservices define a map-type, that uses anyType for keys and values, so you have to specify the correct type in the request. This makes is impossible to use a associative array for the profile fields, an auxiliary class is the solution.
Here is an example code, that adds a subscriber:
Code: Select all
$client = new WsseSoapClient($url, $username, $password);
class ProfileField {
public $key;
public $value;
function __construct( $key, $value) {
$this->key = $key;
$this->value = $value;
}
}
$param = array(
new ProfileField(
new SoapVar( "email", XSD_STRING, "string", "http://www.w3.org/2001/XMLSchema"),
new SoapVar( "test@example.com", XSD_STRING, "string", "http://www.w3.org/2001/XMLSchema")
),
new ProfileField(
new SoapVar( "mailtype", XSD_STRING, "string", "http://www.w3.org/2001/XMLSchema"),
new SoapVar( "1", XSD_STRING, "string", "http://www.w3.org/2001/XMLSchema")
),
new ProfileField(
new SoapVar( "gender", XSD_STRING, "string", "http://www.w3.org/2001/XMLSchema"),
new SoapVar( 0, XSD_STRING, "string", "http://www.w3.org/2001/XMLSchema")
)
);
$data = array(
"parameters" => $param,
"doubleCheck" => true,
"keyColumn" => "email",
"overwrite" => true
);
var_dump($client->AddSubscriber($data));
Best regards,
Markus