• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Amazon Web Service
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Amazon Web Service


  • Subject: Amazon Web Service
  • From: Jeff LaMarche <email@hidden>
  • Date: Thu, 18 Mar 2004 20:49:46 -0500

I'm trying to access Amazon's Web Services from a Cocoa app, but am
having some problems.

I used WSMakeStubs to generate stubs from the URL
"http://soap.amazon.com/schemas3/AmazonWebServices.wsdl"; and then
created a short program to test the stub:

NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
@"1579546463", @"asin", @"[dev token removed]", @"devtag", @"heavy",
@"type", @"1", @"tag", nil];
NSLog(@"%@", params);
NSDictionary *result;
AsinSearchRequest *request = [[AsinSearchRequest alloc] init];


WSMethodInvocationRef ref = [request genCreateInvocationRef];
//[request setParameters:params];
WSMethodInvocationSetParameters(ref,(CFDictionaryRef)params, NULL );
result = (NSDictionary *)WSMethodInvocationInvoke( ref );
NSLog( @"Result: %@", result );

if (WSMethodResultIsFault ((CFDictionaryRef) result))
NSLog(@"%@", [result objectForKey: (NSString *)
kWSFaultString]);

else
NSLog(@"%@", [result objectForKey: (NSString *)
kWSMethodInvocationResult]);

[params release];
[pool release];
return 0;

The first time I ran it, using the setParameters: call in the stub, the
parameters didn't get set, but I changed to using
WSMethodInvocationSetParameters, and that seems to have fixed that
problem. Sniffing the packets, I can see that it's sending the
following SOAP request:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";>
<SOAP-ENV:Body>
<m:AsinSearchRequest xmlns:m="http://soap.amazon.com";>
<asin xsi:type="xsd:string">1579546463</asin>
<devtag xsi:type="xsd:string">[DEV TOKEN REMOVED]</devtag>
<type xsi:type="xsd:string">heavy</type>
<tag xsi:type="xsd:string">1</tag>
</m:AsinSearchRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Which looks okay..

When I call WSMethodInvocationInvoke, I'm getting the message "in
_parseFault" printed

The response dictionary I'm getting back from WSMethodInvocationInvoke
is:

<CFDictionary 0x311710 [0xa01900e0]>{type = immutable, count = 4,
capacity = 4, pairs = (
0 : <CFString 0xa4060804 [0xa01900e0]>{contents =
"/kWSHTTPResponseMessage"} = <CFHTTPMessage 0x310ab0>{url =
http://soap.amazon.com/onca/soap3; status = HTTP/1.1 200 OK}
1 : <CFString 0xa4060854 [0xa01900e0]>{contents = "/FaultString"} =
<CFString 0x311360 [0xa01900e0]>{contents = "We encountered an error at
our end while processing your request. Please try again
"}
3 : <CFString 0xa40613b0 [0xa01900e0]>{contents = "/kWSResultIsFault"}
= <CFBoolean 0xa0190b90 [0xa01900e0]>{value = true}
4 : <CFString 0xa4060864 [0xa01900e0]>{contents = "/FaultCode"} =
<CFNumber 0x311c80 [0xa01900e0]>{value = -1, type =
kCFNumberSInt32Type}
)}

Just for the record, I created an XML URL using these parameters and
received a valid response, so it's not a problem with the parameters.
If anyone has an idea what I'm doing wrong, I'd appreciate hearing it,
as I'm stumped.

TIA,
Jeff
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Prev by Date: Quitting screensavers programmatically
  • Next by Date: Autorelease pools?
  • Previous by thread: Re: Quitting screensavers programmatically
  • Next by thread: Autorelease pools?
  • Index(es):
    • Date
    • Thread