views:

25

answers:

1

I am looking for a tutorial, description, or something that could point me in the right direction for converting an object to an XML soap request in Cocoa. Specifically I am using this to hit a .NET webservice. I do at this point have my code working but it feels like cheating and bad chi.

My XMl request is basically lots of:

Request = [Request stringByAppendingString:@"<Name>"];
Request = [Request stringByAppendingString:obj.name];
Request = [Request stringByAppendingString:@"</Name>"];

This means my page is very static and not very future proof to say the least.

In .net I would just put a web reference in my project and like magic I can call the web method with actual parameters and it works well.

Is there anything that could help make the above less scary? Reflection maybe? I am looking for a way to send in an object and to have a mostly magical xml object come out.

Just a nudge in the right direction would be greatly appreciated,

Thanks Tom

A: 

I believe you're looking for the Constructing XML Tree Structures section of the Event-Driven XML Programming Guide. I'd just add a method to my class called -xmlRepresentation.

There are also myriad SOAP demos for Cocoa a quick Google search away. This article may also help.

Joshua Nozzi