Re: Webservices in Cocoa
Re: Webservices in Cocoa
- Subject: Re: Webservices in Cocoa
- From: Dominik Pich <email@hidden>
- Date: Wed, 21 Mar 2007 00:25:44 +0100
Hi WS-Core (one of Apple Core Services) works but is far from bein
nearly as comfortable as say java. ALL Parameters a NSDictionaries.
Each being a WSDL complexType with members being the attributes.
WSMakeStubs makes stubs for the WSDL methods but passing it the
correct param (Some NSDictionary is up to you)
ex. sub=
@implementation updateUser
- (void) setParameters:(CFTypeRef /* Complex type http://
ips.iplabs.de/types|updateUser */) in_parameters
{
id _paramValues[] = {
(id)in_parameters,
};
NSString* _paramNames[] = {
@"TUser_1",
};
[super setParameters:1 values: _paramValues names: _paramNames];
}
ex . type=
+ (NSMutableDictionary*)TUser {
NSMutableDictionary *dict = [NSMutableDictionary
dictionaryWithCapacity:25];
//init all
[WSCoreObject addSpecialValue:[NSNull null] type:@"nil"
name:@"clientLogInfo" toNode:dict];
[WSCoreObject addSpecialValue:[NSNull null] type:@"nil"
name:@"clientName" toNode:dict];
[WSCoreObject addSpecialValue:[NSNull null] type:@"nil"
name:@"clientVersion" toNode:dict];
[WSCoreObject addSpecialValue:[NSNull null] type:@"nil"
name:@"localeID" toNode:dict];
[WSCoreObject addSpecialValue:[NSNull null] type:@"nil" name:@"opID"
toNode:dict];
[WSCoreObject addSpecialValue:[NSNull null] type:@"nil"
name:@"wipeVersion" toNode:dict];
[WSCoreObject addSpecialValue:[NSNull null] type:@"nil"
name:@"errorCode" toNode:dict];
[WSCoreObject addSpecialValue:[NSNull null] type:@"nil"
name:@"errorMessage" toNode:dict];
[WSCoreObject addSpecialValue:[NSNull null] type:@"nil"
name:@"sessionID" toNode:dict];
[WSCoreObject addSpecialValue:[NSNull null] type:@"nil"
name:@"EMailAddress" toNode:dict];
[WSCoreObject addSpecialValue:[NSNull null] type:@"nil"
name:@"acceptNewsletter" toNode:dict];
[WSCoreObject addSpecialValue:[NSNull null] type:@"nil"
name:@"acceptPromotion" toNode:dict];
[WSCoreObject addSpecialValue:[NSNull null] type:@"nil"
name:@"addresses" toNode:dict]; //array of some sort
[WSCoreObject addSpecialValue:[NSNull null] type:@"nil"
name:@"customerCardID" toNode:dict];
[WSCoreObject addSpecialValue:[NSNull null] type:@"nil"
name:@"firstname" toNode:dict];
[WSCoreObject addSpecialValue:[NSNull null] type:@"nil"
name:@"lastname" toNode:dict];
[WSCoreObject addSpecialValue:[NSNull null] type:@"nil"
name:@"loyaltyID" toNode:dict];
[WSCoreObject addSpecialValue:[NSNull null] type:@"nil"
name:@"name" toNode:dict];
[WSCoreObject addSpecialValue:[NSNull null] type:@"nil"
name:@"orderTrackingInfo" toNode:dict];
[WSCoreObject addSpecialValue:[NSNull null] type:@"nil"
name:@"password" toNode:dict];
[WSCoreObject addSpecialValue:[NSNull null] type:@"nil"
name:@"paybackID" toNode:dict];
[WSCoreObject addSpecialValue:[NSNull null] type:@"nil"
name:@"sex" toNode:dict];
//set correct type information
[dict setObject:@"" forKey:(NSString*)kWSRecordNamespaceURI];
[dict setObject:@"m:TUser" forKey:(NSString*)kWSRecordType];
//pay attention to order.. we never had to but with the new software
we do
[dict setObject:[NSArray arrayWithObjects:
@"clientLogInfo",
@"clientName",
@"clientVersion",
@"errorCode",
@"errorMessage",
@"localeID",
@"opID",
@"sessionID",
@"wipeVersion",
@"EMailAddress",
@"acceptNewsletter",
@"acceptPromotion",
@"addresses", //array of some sort
@"customerCardID",
@"firstname",
@"lastname",
@"loyaltyID",
@"name",
@"orderTrackingInfo",
@"password",
@"paybackID",
@"sex",
nil] forKey:(NSString*)kWSRecordParameterOrder];
return dict;
}
! addSpecialValue == my methods so nil can be added and the xml
reads: <name xsi:nil="true"/> but heavily modifing the generated xml
is hopefully not needed.
normally you setObect:x forKey@"name" just as you normally would.
Pass that to WSCore and get a Dictionary back.
==> Hope you find a better solution than WSCore which is not fully
developed IMHO but you can make it work (although later youll need
nasty workarounds)
Regards,
Dominik
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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