Re: Cocoa datatype SOAP encoding
Re: Cocoa datatype SOAP encoding
- Subject: Re: Cocoa datatype SOAP encoding
- From: "Tom Chen" <email@hidden>
- Date: Tue, 25 Nov 2008 15:45:25 -0800
Thanks for the response, that's exactly the datatype I need. I do have
a follow-up question however. It appears that when you create a
NSXMLDocument, the root element needs to be named (in this case:
"something"). However, when you call WSMethodInvocationSetParameters()
you also need to provide a name per parameter you pass in (in this
case for the NSXMLDocument it's: "something"). This results in a
request that has a duplicate tag named "something", i.e. it creates:
<something>
<something>
<Field>
...
</Field>
</something>
</something>
I tried creating a root element with no name, but this doesn't work
and if I don't give a name/order for the NXSMLDocument, it won't be
parametrized. Does anybody see a solution here?
Thanks,
--Thomas
On Tue, Nov 25, 2008 at 2:22 PM, Quinn <email@hidden> wrote:
> At 13:13 -0800 25/11/08, Tom Chen wrote:
>>
>> Does anyone know what Cocoa datatype is needed?
>
> I think you need to investigate NSXMLDocument. It allows you to create an
> XML document with arbitrary elements. For example, I prototyped creating
> your XML in Python:
>
> $ python
> Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17)
> [GCC 4.0.1 (Apple Inc. build 5465)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>>>>
>>>> from Foundation import *
>>>> root = NSXMLElement.alloc().initWithName_("something")
>>>> doc = NSXMLDocument.alloc().initWithRootElement_(root)
>>>> f = NSXMLElement.alloc().initWithName_("Field")
>>>> root.addChild_(f)
>>>> f = NSXMLElement.alloc().initWithName_("Field")
>>>> root.addChild_(f)
>>>> f = NSXMLElement.alloc().initWithName_("Field")
>>>> root.addChild_(f)
>>>> d = doc.XMLDataWithOptions_(NSXMLNodePrettyPrint)
>>>> print NSString.alloc().initWithData_encoding_(d, NSUTF8StringEncoding)
>
> <something>
> <Field></Field>
> <Field></Field>
> <Field></Field>
> </something>
>
> S+E
> --
> Quinn "The Eskimo!" <http://www.apple.com/developer/>
> Apple Developer Relations, Developer Technical Support, Core OS/Hardware
> _______________________________________________
> 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
>
_______________________________________________
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