Re: WSMethodInvocationInvoke hangs
Re: WSMethodInvocationInvoke hangs
- Subject: Re: WSMethodInvocationInvoke hangs
- From: mark fletcher <email@hidden>
- Date: Fri, 4 May 2007 14:02:05 +0100
Hi Ivan,
You should test the url is legal by initialising an NSURL and
checking it does not return nil.
You can then use kWSMethodInvocationTimeoutValue to set a timeout
period (in seconds) for the WSMethodInvocationRef to complete. Here
is an example from some of my own code...
WSMethodInvocationRef rpcCall = WSMethodInvocationCreate
((CFURLRef)rpcURL, (CFStringRef)method, kWSSOAP2001Protocol);
WSMethodInvocationSetParameters (rpcCall, (CFDictionaryRef)params,
(CFArrayRef)param_order);
WSMethodInvocationSetProperty (rpcCall, kWSSOAPBodyEncodingStyle,
kWSSOAPStyleRPC);
WSMethodInvocationSetProperty (rpcCall, kWSSOAPMethodNamespaceURI,
(CFStringRef)@"urn:ActionWebService");
WSMethodInvocationSetProperty (rpcCall, kWSHTTPExtraHeaders,
(CFDictionaryRef)headers);
WSMethodInvocationSetProperty (rpcCall, kWSHTTPFollowsRedirects,
kCFBooleanTrue);
WSMethodInvocationSetProperty (rpcCall,
kWSMethodInvocationTimeoutValue, (CFNumberRef)[NSNumber numberWithInt:
3]);
NSDictionary *result = (NSDictionary *)
(WSMethodInvocationInvoke (rpcCall));
CFRelease(rpcCall);
if (WSMethodResultIsFault ((CFDictionaryRef) result)) {
....
If there is no server at the address then the call will fault with
the error errWSTimeoutError. So as long as you specify a reasonable
timeout period (not too short for the call to complete under normal
conditions) and catch this error, you will be able to deal with this
event gracefully.
Hope this helps.
Mark
On 4 May 2007, at 06:48, Ivan C Myrvold wrote:
If I use WSMethodInvocationInvoke to a non-existing URL, the
WSMethodInvocationInvoke method never returns, and my application
hangs. Are there anything I can do to avoid this, maybe test the
URL before I do an WSMethodInvocationCreate with the URL?
How can I test the URL to see that is a valid URL and working?
Ivan
_______________________________________________
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