• 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: WSMethodInvocation crash with UTF-8 strings - SOLVED
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WSMethodInvocation crash with UTF-8 strings - SOLVED


  • Subject: Re: WSMethodInvocation crash with UTF-8 strings - SOLVED
  • From: Mike Cohen <email@hidden>
  • Date: Thu, 30 Apr 2009 18:55:05 -0400

Simply adding a serialization override prevents the crash. Before I add the parameters to the WSMethodInvocation, I added:

            WSMethodInvocationAddSerializationOverride(fRef, CFStringGetTypeID(), _stringToXML, NULL);

My serialization function is trivial:

static CFStringRef _stringToXML(WSMethodInvocationRef invocation, CFTypeRef obj, void *info)
{
    if ((CFGetTypeID(obj) == CFStringGetTypeID()) && ![(NSString *)obj isEqualToString:@""]) 
    {
        NSString *result = [[NSString alloc] initWithFormat:@"<%s>%@</%s>", "%@", obj, "%@"];
        return (CFStringRef)result;
    }
    return NULL;
}


On Apr 30, 2009, at 4:00 PM, Mike Cohen wrote:

I'm using WSMethodInvocationInvoke to call a SOAP web service, which works with no problems except one case: where the parameter array contains strings with UTF-8 characters. The crash is occurring deep within CFNetwork:

#0  0x94ee7372 in szone_error ()
#1  0x94e119fe in szone_free ()
#2  0x94e112cd in free ()
#3  0x938f98d8 in entityEncodeString ()
#4  0x938f2769 in SOAPProtocolHandler::serialize ()
#5  0x938f3715 in SOAPProtocolHandler::createRequest ()
#6  0x938f381d in SOAPWebServiceMethodInvocation::constructMessage ()
#7  0x938f1041 in HTTPClosureSource::initConnection ()
#8  0x938f16b6 in HTTPClosureSource::perform ()
#9  0x91df263f in CFRunLoopRunSpecific ()
#10 0x91df2cd8 in CFRunLoopRunInMode ()
#11 0x938f6753 in WSMethodInvocationInvoke ()

This is my code for creating and invoking the SOAP method call (error handling omitted):

     NSDictionary* headers = [NSDictionary dictionaryWithObjectsAndKeys: soapaction, @"SOAPAction",  "text/xml; charset=utf-8", @"Content-Type", nil];

fRef = WSMethodInvocationCreate((CFURLRef) url, (CFStringRef) method, (CFStringRef) kWSSOAP2001Protocol);
WSMethodInvocationSetProperty(fRef, kWSHTTPExtraHeaders, headers);
WSMethodInvocationSetProperty(fRef, kWSSOAPBodyEncodingStyle, kWSSOAPStyleDoc);
WSMethodInvocationSetProperty(fRef, kWSSOAPMethodNamespaceURI, Namespace);
        WSMethodInvocationSetParameters(fRef, (CFDictionaryRef)params, nil);
fResult = (NSDictionary*)WSMethodInvocationInvoke(fRef);

The parameters look like this:

<CFDictionary 0x16b9b660 [0xa01eb1a0]>{type = mutable, count = 20, capacity = 24, pairs = (
0 : <CFString 0xfc5c [0xa01eb1a0]>{contents = "DemographicDescriptor"} = <CFString 0x16b4b2e0 [0xa01eb1a0]>{contents = "consumer"}
5 : <CFString 0xfa2c [0xa01eb1a0]>{contents = "City"} = <CFString 0x1470c750 [0xa01eb1a0]>{contents = "\u00f2\u00e0\u00e0\u00e0\u00f2\u00e8\u00e8\u00e8"}
6 : <CFString 0xf9fc [0xa01eb1a0]>{contents = "Address"} = <CFString 0x167d98d0 [0xa01eb1a0]>{contents = "\u60a8\u5df2\u6210\u529f\u6ce8\u9500\u3002"}
7 : <CFString 0xfc0c [0xa01eb1a0]>{contents = "RegCode"} = <CFString 0x165ade80 [0xa01eb1a0]>{contents = "PPLEX6E4FK"}
8 : <CFString 0xfc8c [0xa01eb1a0]>{contents = "WebPassword"} = <CFString 0x147e21c0 [0xa01eb1a0]>{contents = "poopie"}
9 : <CFString 0xfc6c [0xa01eb1a0]>{contents = "EmailQuarterlyNewsletterFlag"} = <CFString 0xa01fd9f0 [0xa01eb1a0]>{contents = "1"}
10 : <CFString 0xfcac [0xa01eb1a0]>{contents = "TrueLocale"} = <CFString 0xf54c [0xa01eb1a0]>{contents = "en_US"}
11 : <CFString 0xfa5c [0xa01eb1a0]>{contents = "Phone"} = <CFString 0x147617b0 [0xa01eb1a0]>{contents = "123-4567"}
12 : <CFString 0xfc7c [0xa01eb1a0]>{contents = "EmailSpecialOffersFlag"} = <CFString 0xa01fd9f0 [0xa01eb1a0]>{contents = "1"}
13 : <CFString 0xfcbc [0xa01eb1a0]>{contents = "GivenLocale"} = <CFString 0xf54c [0xa01eb1a0]>{contents = "en_US"}
14 : <CFString 0xf24c [0xa01eb1a0]>{contents = "locale"} = <CFString 0xf54c [0xa01eb1a0]>{contents = "en_US"}
19 : <CFString 0xf48c [0xa01eb1a0]>{contents = "State"} = <CFString 0x1acade0 [0xa01eb1a0]>{contents = "BC"}
23 : <CFString 0xfa4c [0xa01eb1a0]>{contents = "AreaCode"} = <CFString 0x1474b040 [0xa01eb1a0]>{contents = "222"}
24 : <CFString 0xfa0c [0xa01eb1a0]>{contents = "Address2"} = <CFString 0x1a3fd70 [0xa01eb1a0]>{contents = "\u00e4\u00dfig \u043f\u0440\u0438\u043d\u0446\u0435\u0441\u0441\u0430 \u00f6\u00fc\u00c4"}
25 : <CFString 0xf9dc [0xa01eb1a0]>{contents = "FirstName"} = <CFString 0x1671cfc0 [0xa01eb1a0]>{contents = "\u30ed\u30b0\u30a2\u30a6\u30c8\u3057\u307e\u3057\u305f"}
26 : <CFString 0xf9ec [0xa01eb1a0]>{contents = "LastName"} = <CFString 0x1674b970 [0xa01eb1a0]>{contents = "\ub2f9\uc2e0\uc740 \uc131\uacfc\uc801\uc73c\ub85c \ub85c\uadf8\uc544\uc6c3\ud558\uc600\uc2b5\ub2c8\ub2e4"}
27 : <CFString 0xf43c [0xa01eb1a0]>{contents = "Country"} = <CFString 0x165c22d0 [0xa01eb1a0]>{contents = "CA"}
28 : <CFString 0xfc9c [0xa01eb1a0]>{contents = "EMail"} = <CFString 0x14793820 [0xa01eb1a0]>{contents = "email@hidden"}
30 : <CFString 0xfa3c [0xa01eb1a0]>{contents = "Zip"} = <CFString 0x1473d7a0 [0xa01eb1a0]>{contents = "123"}
31 : <CFString 0xfa1c [0xa01eb1a0]>{contents = "Address3"} = <CFString 0x1a93f80 [0xa01eb1a0]>{contents = "contr\u00f4le r\u00e9guli\u00e8rement"}
)}

I have all of the debugging options set and I'm not seeing any warnings.

NSDebugEnabled=YES
DYLD_NO_FIX_PREBINDING=YES
NSZombieEnabled=YES
MallocStackLogging=YES
DYLD_NEW_LOCAL_SHARED_REGIONS=YES
NSUnbufferedIO=YES
MallocHelp=YES
NSDeallocateZombies=NO
MallocCheckHeapEach=100000
MallocCheckHeapStart=100000
MallocScribble=YES
MallocGuardEdges=YES
MallocCheckHeapAbort=1
CFZombie=5


Any ideas how to fix it? 



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >WSMethodInvocation crash with UTF-8 strings (From: Mike Cohen <email@hidden>)

  • Prev by Date: Re: SecureTransport on iPhone?
  • Previous by thread: WSMethodInvocation crash with UTF-8 strings
  • Index(es):
    • Date
    • Thread