使用wsdl2objc实现web service soap的sample


最近问soap的网友很多,我这里准备一个sample,方便大家快速入门
首先下载wsdl2objc,要下载0.7-pre1版本,下载地址http://code.google.com/p/wsdl2ob ... ip&can=2&q=
下面是我从网上看到的文章,转载过来,并且自己附上了代码,希望对大家研究web service soap有所帮助

操作步骤介绍

http://code.google.com/p/wsdl2objc/wiki/UsageInstructions

详细步骤是英文的,我就不翻译了,不懂的跟贴问就可以了
I needed to access a SOAP-based web service from the iPhone. There are a wide variety of opinions on how to go about this: "One word: Don't" was one poster's reply to a related question at Stackoverflow.com. Some people suggest writing one's own routines, while others suggest trying various code-generating tools. One I found was called gSoap, but apparently there is a fair amount of work yet to do to get it working with the iPhone. I found wsdl2objc which generates Objective-C code from a WSDL so you can call SOAP services. I want to show you how I used WSDL2ObjC to access a SOAP based web service.

Here's what you need to get started:

    * WSDL2ObjC. I'm going to use WSDL2ObjC-0.7-pre1.zip for this tutorial. You can get this from the project's home page.
    * A web service to consume. For this tutorial, we'll use the "LocalTime" service (http://www.ripedevelopment.com/webservices/LocalTime.asmx) which will, given a zip code, provide the local time for that zip code.


Let's go.

1. Generate the stubs with WSDL2ObjC.
Start WSDL2ObjC. In the first field, enter the name of the source WSDL. You can specify a local file, or a web address. For here, enter http://www.ripedevelopment.com/webservices/LocalTime.asmx?wsdlIn the second field, specify a directory in which WSDL2ObjC will create the new files. You can use the Browse button to specify a directory. When you click "Parse WSDL", you will see a few messages, one of which should say it is generating Objective C Code into the output directory. Check the target directory to make sure your files are there.
1.jpg

你可能感兴趣的:(使用wsdl2objc实现web service soap的sample)