Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Webservices in Cocoa



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Webservices in Cocoa (From: Alexander Hartner <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.