1

I'm currently having an issue with Sudzc generated code. (For ARC-based iOS)

Calling to a soap web-service using the generated code works fine, the problems when I need to retrieve the response.

I currently handle call responses like this:

-(void)userLoginCompleted:(id)value { if([value isKindOfClass:[NSError class]]) { NSLog(@"%@",value); } if([value isKindOfClass:[SoapFault class]]) { NSLog(@"%@",value); } if([value isKindOfClass:[IWWSLoginResult class]]) { IWWSLoginResult *loginData = (IWWSLoginResult*)value; NSLog(@"LoginData Result: %i",loginData.Result); NSLog(@"LoginData AccessToken: %@",loginData.AccessToken) //Other login related stuff here } } 

Whenever this code gets called with an NSError or SoapFault, the code runs fine (that is, it will parse the error in the log).

But when it's called with a IWWSLoginResult as the parameter the Result and AccessToken properties are NO and (null) respectively, even when the Logging of the Sudzc code shows this ResponseEnvelope:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <UserLoginResponse xmlns="[Omitted]"> <UserLoginResult> <Result>true</Result> <AccessToken>[Omitted]</AccessToken> </UserLoginResult> </UserLoginResponse> </soap:Body> </soap:Envelope> 

AccessToken and xmlns-url ommitted, but present

Is this a error in the generated SudzC code, or is this an error from my part?

1 Answer 1

3

SudzC checks in the soap result message for a <body> tag but most .Net webservice use a <soap:body> tag. This will most likely make the framework think that there is no result and therefore defaults the values of the results to false or null.

To fix this change the following element in the SoapRequest.m file:

CXMLNode *element = [[Soap getNode: [doc rootElement] withName: @"Body"] childAtIndex:0]; 

to

CXMLNode *element = [[Soap getNode: [doc rootElement] withName: @"soap:Body"] childAtIndex:0]; 
Sign up to request clarification or add additional context in comments.

1 Comment

I had exactly the same bug, but instead of adding "soap:" prefix I added additional if statement - if element is nil, then try to find soap:Body

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.