iphone SDK中的hessianKit
如果我在这个框架中有自定义值对象,我应该怎么做?我已经声明并定义了LoginRequest和LoginResponse的接口和实现,并且声明了LoginRequest和LoginResponse的协议。 我在代码中找不到错误。代码如下:iphone SDK中的hessianKit,iphone,hessian,Iphone,Hessian,如果我在这个框架中有自定义值对象,我应该怎么做?我已经声明并定义了LoginRequest和LoginResponse的接口和实现,并且声明了LoginRequest和LoginResponse的协议。 我在代码中找不到错误。代码如下: //mycode NSURL* url = [NSURL URLWithString:myurl]; id<BusinessAPI> proxy = (id<BusinessAPI>)[CWHessianConnectio
//mycode
NSURL* url = [NSURL URLWithString:myurl];
id<BusinessAPI> proxy = (id<BusinessAPI>)[CWHessianConnection rootProxyWithServiceURL:url protocol:@protocol(BusinessAPI)];
LoginRequest* loginRequest = [[LoginRequest alloc] init];
loginRequest.mobileNum = @"123456789";//number.text;
loginRequest.mobileType = @"iphone";
loginRequest.password = @"123";//password.text;
LoginResponse *loginResponse = [proxy loginBusiness:loginRequest];
if (loginResponse.login) NSLog(@"YES");
else NSLog(@"NO");
//mycode
NSURL*url=[NSURL-URLWithString:myurl];
id proxy=(id)[cWhesian连接rootProxyWithServiceURL:url协议:@protocol(BusinessAPI)];
LoginRequest*LoginRequest=[[LoginRequest alloc]init];
loginRequest.mobileNum=@“123456789”//数字文本;
loginRequest.mobileType=@“iphone”;
loginRequest.password=@“123”//password.text;
LoginResponse*LoginResponse=[代理登录业务:loginRequest];
如果(loginResponse.login)NSLog(@“是”);
其他NSLog(@“否”);
日志为“参数类型不匹配”结果是web服务器找不到远程LoginRequest对象。 有什么想法吗?
非常感谢很抱歉回复太晚 您的问题是,只有根代理对象忽略其完整包。而所有其他类和接口都使用它们的全名进行搜索。这意味着Objective-C世界中的
LoginRequest
类将生活在Java世界中的默认包中。很可能不是
解决方案是添加这样的翻译:
[CWHessianArchiver setClassName:@"com.mycompany.LoginRequest"
forClass:[LoginRequest class]];
我为v2.0添加了更好的支持,在v2.0中,可以为两端定义默认包/前缀。例如,Java中的com.mycompany.
和Obj-C中的MC
。不幸的是,v2.0分支对于生产来说还不够稳定