• 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
Re: WSMethodInvocationInvoke hangs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >WSMethodInvocationInvoke hangs (From: Ivan C Myrvold <email@hidden>)

  • Prev by Date: Two simple questions regarding Core-Data
  • Next by Date: How to limit clickable area in custom NSOutlineView cell?
  • Previous by thread: WSMethodInvocationInvoke hangs
  • Next by thread: Partially SOLVED: Having trouble with NSTreeController, NSOutlineView, and Core Data
  • Index(es):
    • Date
    • Thread