Re: Complex data for webservices
Re: Complex data for webservices
- Subject: Re: Complex data for webservices
- From: Niklas Saers <email@hidden>
- Date: Mon, 21 Apr 2008 13:45:25 +0200
Just a short update with new questions:
On Apr 20, 2008, at 2:07 PM, Niklas Saers wrote:
So I know I have to create some kind of CFTypeRef, but how do I make
a CFTypeRef object to match the Authentication class definition
above? And how do I make a CFTypeRef to match an array of
Authentication objects?
As far as I've understood, the CFTypeRef is an NSDictionary, and the
NSDictionary will represent any complex type. For the Authentication
object, I provide a dictionary with a datatype (I believe it's
supposed to be "xsd:Authentication") and the two named parameters. I
have not found a way to declare what datatype they are, so this is
what I do:
NSMutableDictionary *param = [[NSMutableDictionary alloc] init];
[dict setObject:self.username forKey:@"username"];
[dict setObject:self.password forKey:@"password"];
[dict setObject:@"xsd:Authentication" forKey:(NSString*) kWSRecordType];
From myService.asmx I have defined TestAuthentication that is a SOAP-
based webservice living on an MS-IIS server, specified:
(bool) TestAuthentication(Authentication auth);
So I've #import'ed testStub.h and do the following to invoke the call:
TestAuthentication *WS = [[TestAuthentication alloc] init];
[WS setCallBack:(id)self
selector:@selector(testAuthenticationCompleted:)];
[WS setParameters:param];
[WS scheduleOnRunLoop:(NSRunLoop*)CFRunLoopGetCurrent() mode:(NSString
*)kCFRunLoopDefaultMode];
Finally I've created a function for the selector:
- (id) testAuthenticationCompleted:(WSGeneratedObj*)invocation;
The function runs to its end, but shortly after my program crashes
with a "Bus error". I believe that perhaps I should define the
selector function differently, but I don't know what it should look
like. So instead of doing it asyncronous I try calling it
syncronously, and just to be sure I add a bit of logging:
TestAuthentication *WS = [[TestAuthentication alloc] init];
[WS setParameters:param];
NSLog(@"isComplete == %d, isFault == %d, true == %d", [WS isComplete],
[WS isFault], YES);
What's strange here is that isFault is true: isComplete == 1, isFault
== 1, true == 1
So I guess my NSDictionary is invalid since all I've done is pass it
the parameters.
Another thing that I find strange is that the webservice is called
upon [[TestAuthentication alloc] init], even though in my mind it
should not have been executed until I call something like
[[WS getRef] executeCommand]
I hope that my explanation is good enough that you understand what my
problems are and can help me out. As you know, documentation isn't
great on this topic, and I've been unable to find sample code that
does this for complex data types.
Sincerely yours
Nik
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden