Re: WebKit and POST requests (now WSDL and WSMakeStubs)
Re: WebKit and POST requests (now WSDL and WSMakeStubs)
- Subject: Re: WebKit and POST requests (now WSDL and WSMakeStubs)
- From: Sam Stigler <email@hidden>
- Date: Sat, 23 Jun 2007 15:54:46 +1000
Thanks; that example is very helpful. What I'm trying to do is
access Amazon's web services via SOAP. I tried basically replicating
what you did (see below), but I keep on getting nil (0x0)
resultValues. After studying the WSDL for a little while I'm
guessing it has something with the fact that I'm trying to substitute
in a NSDictionary for a complexType that WSMakeStubs didn't make a
method for; can you (or anyone else), please verify that? Here's my
code:
NSDictionary *ListSearchRequestDict = [NSDictionary
dictionaryWithObjectsAndKeys:[emailAddress
stringValue],@"Email",@"WishList",@"ListType",nil];
ListSearch *theSearch = [[ListSearch alloc] init];
// Missing here: Something like "ListSearchRequest *searchRequest =
[[ListSearchRequest alloc] init]" (this is what WSMakeStubs didn't
generate.)
NSDictionary *listSearchParameters = [NSDictionary
dictionaryWithObjectsAndKeys:@"MY_ACCESS_KEY",@"AWSAccessKeyId",ListSear
chRequestDict,@"Request",nil];
[theSearch setParameters:listSearchParameters];
id search = [theSearch resultValue];
The WSDL file can be found at http://webservices.amazon.com/
AWSECommerceService/AWSECommerceService.wsdl? .
Thanks again,
Sam
On Jun 23, 2007, at 3:44 AM, Mike Stanger wrote:
At 3:22 AM +1000 6/23/07, Sam Stigler wrote:
Does anyone know of examples of actually using the stubs that
WSMakeStubs creates? I've gotten as far as making them, but I
can't quite figure out how to actually call the code. In
addition, I've found very little on this in the documentation or
otherwise... when exactly is the WSMethodInvocationRef supposed to
be called, and how should it be used in conjunction with the rest
of the methods in the stub? (I did find the WikiBooks example at
<http://en.wikibooks.org/wiki/Programming:WebObjects/Web_Services/
Web_Service_Provider>http://en.wikibooks.org/wiki/
Programming:WebObjects/Web_Services/Web_Service_Provider , but
it's not quite as easy to understand as I'm looking for.)
It's actually not too hard (though I'm a bit of n00b, so if anybody
sees errors, please chime in)...
For example, in the WSStub.h file for a particular WSDL that I used
WSMakeStubs to generate the static stub files for, one of the
advertised methods was listed as:
+ (id) sectionsForInstructor:(NSString *) in_staffComputingID
in_token:(NSString *) in_token;
.... in my code that retrieves the results, I added the import for
WSStub.h and used code like this:
....
sectionsForInstructor *theSections = [[sectionsForInstructor
alloc] init];
[theSections setParameters: @"somestringvalue" in_token:
@"thetokenvalue"]
... you then get the results from the query with resultValue and
deal with whatever data structure you get back ... in this case,
I'd expect to be getting back an array, so I'd use something like:
NSArray *allSectionsArray = [theSections resultValue];
...might be a better way to do it, but this seems pretty simple.
Mike
--
+------------------------
|Mike Stanger
|Systems Consultant, Academic Computing Services
|SH1023 Simon Fraser University
|Burnaby, BC Canada V5A 1S6
|Phone: (604) 291-3361
|FAX: (604) 291-4242
|email: email@hidden
|http://www.sfu.ca/~mstanger
_______________________________________________
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