Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9004981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:01:41+00:00 2026-06-16T01:01:41+00:00

I am trying to send a blob data from oracle db to objective c

  • 0

I am trying to send a blob data from oracle db to objective c via webservices.
The blob data is a word document stored in oracle db.

Following is what I did so far:

  1. Obtain the blob object through java jdbc
  2. Convert the blob object into java byte array
  3. Setting this byte array in a plain java object (serialized) and sending it to the web service
  4. Webservice sends the plain java object to objective-c with Media-type as application/json
  5. The json object is retrieved in the objective-c and the byte array is assigned to NSData
  6. NSData is then written to a file and the file is opened

Problem: I am unable to open the file through objective-c and when I open the file physically in the mac it contains some junk characters. Can anyone please let me know if there is anyway that a java byte array which represents a word document could be converted to a objective-c recognized data type and finally open the word document in the objective-c app.

Following is the code for your perusal on the objective-c end:

Note: “sourceDoc” in the code is the key for byte array.

NSArray *jsonArray = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];

if ([data length] >0  && error == nil){

    NSArray *jsonArray = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
    NSData *returnData = nil;

    for(NSDictionary *billDict in jsonArray){
        returnData = [NSData dataWithBytes:(__bridge const void *)([billDict objectForKey:@"sourceDoc"]) length:[[billDict objectForKey:@"sourceDoc"] length]];
        break;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T01:01:42+00:00Added an answer on June 16, 2026 at 1:01 am

    The problem is that -[NSData dataWithBytes:length:] expects a pointer to the actual data but you are passing it an object from the dictionary. You should inspect the contents returned using NSLog(@"%@", [billDict objectForKey:@"sourceDoc"]); but I expect it will be a base64 string. If it is a base64 string you can use one the base64 decoding options from this question: How do I do base64 encoding on iphone-sdk?. If you use Alex Reynolds answer from that question then you would include the base64 decoding file header you created and set returnData in your above code like this:

    returnData = [NSData base64DataFromString:[billDict objectForKey:@"sourceDoc"]];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I`m trying to send e-mail via c# and use the following code: public static
I am trying to send data as a model from an html form to
We're trying to send uploaded attachements (served from a database as blob) through php
I'm trying send an HTML string from the client to the server via ajax.
Im trying to send multiple data items over a tcp socket from an android
Im trying to send via ajax a value from a textfield, but don't want
I'm trying to use json to send text and blob image information from MySQL
am trying to send an email using the following code $this->load->library('email', $config); $this->email->from('leena.nasir552@gmail.com'); $this->email->to('leena.nasir@morgan.com');
I`m trying to send simple html page with form data to user with GET,
I am trying to send emails from smtps (secure smtp) using Indy and the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.