是否可以在iPhone中使用wsdl web服务?

时间:2011-10-03 05:38:23

标签: iphone sdk

大家好......

 I am using wsdl web service in my project.I don't know how to use it.But from the wsdl2objc i generate the wsdl into objective c form.And after that i implement it into my project.In my wsdl there are many methods like getCountryList,getCityList,getCompanyContact....etc.Now i have a problem...i mean i fetched getCityList but not all city is shown in my city list.
Now i don't know what is the problem in my code.

请告诉我一些建议......如果你理解我的问题......我的代码是......

- (SoapRequest*) getScanCustomerCompanies: (id <SoapDelegate>) handler machineId: (NSString*) machineId loc: (NSString*) loc cat: (int) cat pausefollow:(int)pausefollow favorite:(int)favorite activeontop:(int)activeontop nationwide:(int)nationwide orderby:(int)orderby
{
    return [self getScanCustomerCompanies: handler action: nil machineId: machineId loc: loc cat: cat pausefollow:pausefollow favorite:favorite activeontop:activeontop nationwide:nationwide orderby:orderby];
}

- (SoapRequest*) getScanCustomerCompanies: (id) _target action: (SEL) _action machineId: (NSString*) machineId loc: (NSString*) loc cat: (int) cat pausefollow:(int)pausefollow favorite:(int)favorite activeontop:(int)activeontop nationwide:(int)nationwide orderby:(int)orderby
{
    NSMutableArray* _params = [NSMutableArray array];

    [_params addObject: [[[SoapParameter alloc] initWithValue: machineId forName: @"machineId"] autorelease]];
    [_params addObject: [[[SoapParameter alloc] initWithValue: loc forName: @"loc"] autorelease]];
    [_params addObject: [[[SoapParameter alloc] initWithValue: [NSNumber numberWithInt: cat] forName: @"cat"] autorelease]];
    [_params addObject: [[[SoapParameter alloc] initWithValue:[NSNumber numberWithInt:pausefollow] forName:@"pausefollow"]autorelease]];
    [_params addObject: [[[SoapParameter alloc] initWithValue:[NSNumber numberWithInt:favorite] forName:@"favorite"]autorelease]];
    [_params addObject: [[[SoapParameter alloc] initWithValue:[NSNumber numberWithInt:activeontop] forName:@"activeontop"]autorelease]];
    [_params addObject: [[[SoapParameter alloc] initWithValue:[NSNumber numberWithInt:nationwide] forName:@"nationwide"]autorelease]];
    [_params addObject: [[[SoapParameter alloc] initWithValue:[NSNumber numberWithInt:orderby] forName:@"orderby"]autorelease]];

    NSString* _envelope = [Soap createEnvelope: @"getScanCustomerCompanies" forNamespace: self.namespace withParameters: _params withHeaders: self.headers];
    SoapRequest* _request = [SoapRequest create: _target action: _action service: self soapAction: @"urn:abc#getScanCustomerCompanies" postData: _envelope deserializeTo: [[SDZscanCustomerCompanies alloc] autorelease]];
    [_request send];
    return _request;
}

感谢.......

2 个答案:

答案 0 :(得分:0)

是的,iOS可以使用Web服务,包括WSDL样式。 没有人知道你的问题在哪里,因为你还没有发布任何代码。

编辑:

Cudzc生成器创建一个类,该类根据您在网站上指定的wsdl名称和前缀命名。在这个类中,我必须根据soap标准更改名称空间和URL。

- (id) init
    {
        if(self = [super init])
        {
            self.serviceUrl = @"https://isir.justice.cz:8443/isir_ws/services/IsirPub001";
            self.namespace = @"urn:IsirPub001/types";
            self.headers = nil;
            self.logging = YES;
        }
        return self;
    }

基本上我建议您使用SOAPUI,在您的计算机上测试服务,并与您的代码生成的请求进行比较。

答案 1 :(得分:0)

您可以在此尝试在线提供的工具:

http://sudzc.com/

每当我有SOAP请求要处理时,我总是使用这个服务。