Re: Complex data for webservices
Re: Complex data for webservices
- Subject: Re: Complex data for webservices
- From: Jeff LaMarche <email@hidden>
- Date: Wed, 23 Apr 2008 10:25:55 -0400
When I try to access your WSDL, I get:
Server Error in '/DummyWS' Application.
Generally, though, I don't believe the response from a web service is
a dictionary - I believe it's usually a string and I'm wondering why
you are sending an empty dictionary - it would seem like nil would be
a better choice if you want to send without any data. Also, you are
leaking memory there since your code will never release the dictionary
you allocated in the first line of your method. You need to either
release or autorelease when you are done with the dictionary - the
stubs will retain it if they need to.
Let's see, what else...
You say there is some network activity, so why don't you try using
tcpdump to see what is being passed back and forth. It would be
something like this in a terminal window:
sudo tcpdump -s 0 -v -A -i en1 port 80
Changing en1 to the adaptor you're using. Then run your script and
you should see what communication with the web service. It's a good
idea to close all your Safari windows so that no extraneous AJAX
requests get sent by Safari during your run, or you can use Ethereal ( http://www.ethereal.com/
), which lets you filter by application.
It should become pretty obvious from the communication what your stubs
are doing with the argument you give it, and what the response is.
HTH
Jeff
On Apr 23, 2008, at 8:41 AM, Niklas Saers wrote:
Hi Jeff, and thanks for answering :-)
On Apr 21, 2008, at 3:30 PM, Jeff LaMarche wrote:
I'm no expert on Web Services on Objective-C, but I've been playing
around with them a bit. One thing that I have discovered is that
CFTypeRef is not _always_ a dictionary. In some cases, it wants a
string.
Thanks for the tip! :-)
Without knowing what your web service looks like I don't think I
can be any more helpful than that. Have you used the debugger to
step through the setParameters: method while it's running? You
might be able to tell what it's looking for by doing that. That was
how I figured out to pass in a space delimited list as an NSString
rather than a dictionary.
I've made a dummy webservice that looks pretty much like the one I
use: http://78.157.102.46:2234/DummyWS/Service1.asmx?WSDL
So to generate my stubs I do: WSMakeStubs -x ObjC -name DummyStubs -
url http://78.157.102.46:2234/DummyWS/Service1.asmx?WSDL
First of all, it generates the functions twice, so I need to delete
half of them. :-I It also gives me five warnings saying "warning:
initialization discards qualifiers from pointer target type", but at
least now I'm good to go.
Then I make my method:
NSString *testStr = (NSString*) [myService testString:[[NSDictionary
alloc] init]];
NSLog(@"testStr: %@", testStr);
NSDictionary *testDict = (NSDictionary*) [myService testString:
[[NSDictionary alloc] init]];
NSLog(@"testDict count: %d", [testDict count]);
When the method is called, there's a bit network activity, but the
log sais:
Apr 23 14:38:59 MBP SampleApp[1742]: testStr: (null)
Apr 23 14:38:59 MBP SampleApp[1742]: testDict count: 0
Cheers
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