Community

450 error with writeFieldComponents and processBusinessCard Answered

I'm using the Cloud OCR SDK in an iOS application to scan business cards. I'd like to enable the sub-fields for things like first and last name or address components. This page: http://ocrsdk.com/documentation/apireference/processBusinessCard/ makes me think I can add the "writeExtendedCharacterInfo" parameter to the request and I'll get the extra fields. I also found the schema description file here: http://ocrsdk.com/schema/recognizedBusinessCard-1.0.xsd

Here's the code I'm using:

void(^failure)(NSError *) = ^(NSError *error){
    ...
};

void(^startSuccess)(NSDictionary *) = ^(NSDictionary *taskInfo) {
    ...
};

void(^activateSuccess)() = ^() {
    NSURL *fileURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:self.currentCardPhoto.fileName];
    NSData *imageData = [NSData dataWithContentsOfURL:fileURL];
    NSDictionary *processingParams = @{@"language": @"English", @"exportFormat": @"xml", @"writeFieldComponents":@"true"};
    [[ASOCRClient sharedClient] startTaskWithImageData:imageData withParams:processingParams progressBlock:nil success:startSuccess failure:failure];
};
[[ASOCRClient sharedClient] activateInstallationWithDeviceId:[[[UIDevice currentDevice] identifierForVendor] UUIDString] success:activateSuccess failure:failure force:NO];

When I try to process a business card, I get these errors:

"Expected status code in (200-299), got 450" "<?xml version="1.0" encoding="utf-8"?><error><message language="english">Invalid parameter: writeFieldComponents</message></error>"

If I remove the "writeFieldComponents" parameter form the request, the process completes successfully.

Was this article helpful?

0 out of 0 found this helpful

Comments

1 comment

  • Avatar
    Anastasia Galimova

    The parameter is called "xml:writeFieldComponents" (not just "writeFieldComponents").

    1

Please sign in to leave a comment.