开发者

Converting Object to XML Cocoa

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 referen开发者_开发百科ce 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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜