I'm doing some migration testing and have hit a snag trying to import vcards using the HTTP-API:
OX version: 6.14.0 Rev6
I have the following script (yes, there are many assumptions in the script - this is a test):
And the following contents of /tmp/vcard:
Running the script gives the following result:
(decoded JSON string for readability)
error_params changes with each call even though the data is static.
The following entries occur in open-xchange.log.0:
The data corresponds to the ASCII characters that make up the VCARD submitted.
Anyone any ideas......?
OX version: 6.14.0 Rev6
I have the following script (yes, there are many assumptions in the script - this is a test):
Code:
#!/usr/bin/perl -w
use strict;
use Data::Dumper;
use LWP;
use JSON -support_by_pp;
my $base = "http://my.server.com/ajax";
my $response;
my $browser = LWP::UserAgent->new( );
my $json = new JSON;
$browser->cookie_jar( {} );
$response = $browser->get("$base/login?action=login&name=my.user@my.server.com&password=nothing");
my $json_text = $json->decode($response->{_content});
my $session = $json_text->{session};
$response = $browser->post("$base/import?action=VCARD&session=$session&folder=26",['data'=>['/tmp/vcard']],'Content-type'=>'multipart/form-data');
print Dumper $response;
Code:
BEGIN:VCARD FN:John Smith EMAIL;PREF;INTERNET:john.smith@nowheere.com END:VCARD
Code:
$VAR1 = bless( {
'_protocol' => 'HTTP/1.1',
'_content' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"><html><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script type="text/javascript"> function callback(arg) { parent.callback_import(arg); }; callback({"data":[{"code":"I_E-0605","error_id":"1767232792-54","category":1,"error_params":["[B@68f507d2"],"error":"Could not recognize format of the following data: %s"}]});</script></head></html> ',
'_rc' => '200',
'_headers' => bless( {
'connection' => 'close',
'client-response-num' => 1,
'cache-control' => 'no-store, no-cache, must-revalidate,post-check=0, pre-check=0,no-store, no-cache, must-revalidate,post-check=0, pre-check=0',
'date' => 'Thu, 10 Dec 2009 14:44:04 GMT',
'vary' => 'Accept-Encoding',
'client-peer' => '217.160.4.202:80',
'client-date' => 'Thu, 10 Dec 2009 14:44:04 GMT',
'pragma' => 'no-cache,no-cache',
'content-type' => 'text/html; charset=UTF-8',
'client-transfer-encoding' => [
'chunked'
],
'expires' => 'Sat, 06 May 1995 12:00:00 GMT,Sat, 06 May 1995 12:00:00 GMT'
}, 'HTTP::Headers' ),
'_msg' => 'OK',
'_request' => bless( {
'_content' => '--xYzZY
Content-Disposition: form-data; name="data"; filename="vcard"
Content-Type: text/plain
BEGIN:VCARD
FN:John Smith
EMAIL;PREF;INTERNET:john.smith@nowheere.com
END:VCARD
--xYzZY--
',
'_uri' => bless( do{\(my $o = 'http://mail.b7fc.com/ajax/import?action=VCARD&session=dc8e5ea5a5fa4014a513ae53276981ea&folder=26')}, 'URI::http' ),
'_headers' => bless( {
'cookie2' => '$Version="1"',
'user-agent' => 'libwww-perl/5.834',
'content-type' => 'multipart/form-data; boundary=xYzZY',
'cookie' => 'open-xchange-session-dc8e5ea5a5fa4014a513ae53276981ea=4790dd6bf2bf4c08bc29cf6c9b34b6f1; JSESSIONID=6376af80332a43789baa088e905bbccd.APP1',
'content-length' => 197
}, 'HTTP::Headers' ),
'_method' => 'POST',
'_uri_canonical' => $VAR1->{'_request'}{'_uri'}
}, 'HTTP::Request' )
}, 'HTTP::Response' );
Code:
'data' => [
{
'error' => 'Could not recognize format of the following data: %s',
'category' => 1,
'error_params' => [
'[B@24820846'
],
'error_id' => '1767232792-42',
'code' => 'I_E-0605'
}
]
The following entries occur in open-xchange.log.0:
Code:
Dec 10, 2009 2:38:13 PM com.openexchange.sessiond.impl.SessionHandler addSession INFO: Session created. ID: 29d4c5904edb45338c7c673e97b4f219, Context: 1008, User: 3 Dec 10, 2009 2:38:13 PM com.openexchange.groupware.importexport.importers.VCardImporter importData SEVERE: Could not recognize format of the following VCard data: [66, 69, 71, 73, 78, 58, 86, 67, 65, 82, 68, 13, 10, 70, 78, 58, 74, 111, 104, 110, 32, 83, 109, 105, 116, 104, 13, 10, 69, 77, 65, 73, 76, 59, 80, 82, 69, 70, 59, 73, 78, 84, 69, 82, 78, 69, 84, 58, 106, 111, 104, 110, 46, 115, 109, 105, 116, 104, 64, 110, 111, 119, 104, 101, 101, 114, 101, 46, 99, 111, 109, 13, 10, 69, 78, 68, 58, 86, 67, 65, 82, 68, 13, 10]
Anyone any ideas......?
Comment