2

我正在通过一个 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

视图控制器.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
4

1 回答 1

1

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

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

于 2012-03-16T18:38:37.817 回答