iOS应用使用sudzc连接soap web服务

时间:2011-06-07 06:39:25

标签: iphone ios web-services sudzc

我正在通过Web服务项目进行简单的更改密码,使用sudzc生成SOAP请求。

当我运行项目时,我只是在模拟器中不接收任何内容。

这是我的代码:

·H

#import <UIKit/UIKit.h>

@interface ChangePasswordViewController : UIViewController {
    NSString *CPstr1;
    NSString *CPstr2;
    NSString *CPstr3;


    IBOutlet UITextField *CPText1;
    IBOutlet UITextField *CPText2;
    IBOutlet UITextField *CPText3;


}

@property (nonatomic,retain) IBOutlet UITextField *CPText1;
@property (nonatomic,retain) IBOutlet UITextField *CPText2;
@property (nonatomic,retain) IBOutlet UITextField *CPText3;

@property (nonatomic,retain) IBOutlet UITextView *CPResult;


-(IBAction) CPSendString;

@end

viewcontroller.m

#import "ChangePasswordViewController.h"
#import "MINEHBJTService.h"

@implementation ChangePasswordViewController
@synthesize CPText1,CPText2,CPText3;
@synthesize CPResult;


//to send the user's old and new password to CPstr
-(IBAction) CPSendString{

    CPstr1 = [[NSMutableString alloc] initWithString:CPText1.text];
    CPstr2 = [[NSMutableString alloc] initWithString:CPText2.text];
    CPstr3 = [[NSMutableString alloc] initWithString:CPText3.text]; 



    MINEHBJTService *service = [[MINEHBJTService alloc] init];
    [service ChangePassword: self action: @selector(handleChangePassword:) 
                       sUserID:CPstr1 sPassWord:CPstr2  sNewPassword:CPstr3];      


    return;

}

-(void) hadleChanePassword:(int)value{

    int result = value;
    if(result==1){ 
        CPResult.text = @"Change password sucessed";
    }
    else {
        CPResult.text = @"Change password failed";
    }

}



// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {

    [super viewDidLoad];
}


- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [CPstr1 release];
    [CPstr2 release];
    [CPstr3 release];
    CPResult.text = @"";
    [ MINEHBJTService release]; 
    [super dealloc];
}

@end

1 个答案:

答案 0 :(得分:1)

在服务调用中,您将回调方法定义为handleChangePassword。但是,此方法的实际实现错误为hadleChanePassword

修复命名,你应该开始在模拟器的输出字段中看到一些内容。