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 8061725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:26:03+00:00 2026-06-05T10:26:03+00:00

Sorry to perhaps ask stupid questions, but I’m still having issues with Objective-C syntax.

  • 0

Sorry to perhaps ask stupid questions, but I’m still having issues with Objective-C syntax.
So, I’ve got this SOAP response from my sudzc.com generated code. It should contain a SQL SELECT result with veh_id and version as columns.

What I get as a response object is a NSMutableArray,

NSMutableArray* soapArray = (NSMutableArray*)value;

so I walk through it:

unsigned count = [soapArray count];
while (count--) {
   id myobj = [soapArray objectAtIndex:count];
   NSLog(@"myobj: %@", myobj); 
}

What I get as a printout is something like:

myobj: {
item =     {
    key = version;
    value = 1;
};

for each row of the SQL result. If this is a printout of the array element, why is there only the version column and not also the veh_id column?

How do I access the value for the key on the object myobj of type id? Do I have to cast it first?

That’s the XML String returned from the Zend Soap-Server:

<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.[myurl].com/soap" xmlns:ns2="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:getActiveVehiclesResponse><return SOAP-ENC:arrayType="ns2:Map[23]" xsi:type="SOAP-ENC:Array"><item xsi:type="ns2:Map"><item><key xsi:type="xsd:string">veh_id</key><value xsi:type="xsd:string">1</value></item><item><key xsi:type="xsd:string">version</key><value xsi:type="xsd:string">1</value></item></item><item xsi:type="ns2:Map"><item><key xsi:type="xsd:string">veh_id</key><value xsi:type="xsd:string">3</value></item><item><key xsi:type="xsd:string">version</key><value xsi:type="xsd:string">1</value></item></item><item xsi:type="ns2:Map"><item><key xsi:type="xsd:string">veh_id</key><value xsi:type="xsd:string">4</value></item><item><key xsi:type="xsd:string">version</key><value xsi:type="xsd:string">1</value></item></item></return></ns1:getActiveVehiclesResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
  • 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-05T10:26:05+00:00Added an answer on June 5, 2026 at 10:26 am

    Finally found the solution!
    The problem lies within the deserializeAsDictionary function.
    Since my Soap xml string is structured to have each database column as item – key – value – key – value etc, it adds each column under the key “item” and thus the deserializeAsDictionary function overwrites in the line

    [d setObject:v forKey:[child name]]
    

    the already added objects. In a first shot, I have added a column iterator and now call the columns “item1, item2,..” (further optimization might be necessary):

    // Deserializes the element in a dictionary.
    +(id)deserializeAsDictionary:(CXMLNode*)element {
    NSLog(@"deserializeAsDictionary = %@, children: %d", element.stringValue, [element childCount]);
    
    if([element childCount] == 1) {
        CXMLNode* child = [[element children] objectAtIndex:0];
        if([child kind] == CXMLTextKind) {
           NSLog(@"child %@ added", [child stringValue]);
            return [[[element children] objectAtIndex:0] stringValue];
        }
    }
    
    NSMutableDictionary* d = [NSMutableDictionary dictionary];
    NSInteger i = 1;
    NSString *objKey;
    for(CXMLNode* child in [element children]) {
        id v = [Soap deserialize:child];
        if(v == nil) { 
            v = [NSNull null]; 
        } else {
            if([[child name] isEqualToString:@"(null)"]) {
                objKey = [NSString stringWithFormat:@"%@",[child stringValue]];
            } else if([[child name] isEqualToString:@"key"] || [[child name] isEqualToString:@"value"]) { 
                objKey = [NSString stringWithFormat:@"%@",[child name]];
            } else {
                objKey = [NSString stringWithFormat:@"%@%d",[child name],i++];
            }
    
        }
    
        [d setObject:v forKey:objKey];
        NSLog(@"child %@ added", objKey);
    }
    return d;
    } 
    

    The result array now looks like:

    },
        {
        item1 =         {
            key = "veh_id";
            value = 29;
        };
        item2 =         {
            key = version;
            value = 1;
        };
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry for asking this question, but I searched all Java-related questions, but I got
Sorry I know this is basic, but perhaps it doesn't exist or I'm not
I am sorry this is perhaps a really stupid question. Forgive me because I
Sorry to bother - perhaps this is a very simple question - but for
Perhaps I'm missing a property or misunderstanding something but having issues with something simple.
Sorry if this is a dup; I haven't found any questions that pose quite
Sorry, I'm sure this is simple but I'm tired and can't figure it out.
Sorry for the unhelpful title, but hopefully I can explain this well enough. Lets
Sorry if this is a stupid question... I've developed an application that creates absolute
Sorry in advance as this question is similar (but not the same!) to others.

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.