iPhone SDK 中的 hessianKit
如果我在这个框架中有自定义值对象,我该怎么办?我已经声明并定义了LoginRequest和LoginResponse的接口和实现,并且还声明了LoginRequest和LoginResponse的协议。 我在我的代码中找不到错误。代码如下:
//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");
日志为“参数类型不匹配”
结果是 Web 服务器找不到远程 LoginRequest 对象。 有什么想法吗? 多谢
if I have the custom value object in this framework, how should I do? I have declared and defined the interface and implementation of LoginRequest and LoginResponse, and also, the protocol of LoginRequest and LoginResponse is declared.
I can't find the mistake in my code. code is as following:
//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");
the log is "argument type mismatch"
the result is that web server cannot find the remote LoginRequest object.
Any ideas?
thanks a lot
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
抱歉回复晚了。
您的问题是只有根代理对象会忽略其完整包。而所有其他类和接口都使用其全名进行搜索。这意味着您在 Objective-C 世界中的
LoginRequest
类将被期望存在于 Java 世界中的默认包中。它很可能不会。解决方案是添加这样的翻译:
我为 v2.0 添加了对此的更好支持,其中可以为两端定义默认包/前缀。例如,Java 中的
com.mycompany.
和 Obj-C 中的MC
。不幸的是,v2.0 分支对于生产来说还不够稳定。Sorry for the late reply.
Your problem is that only the root proxy object ignores its full package. Whereas all other classes and interfaces are searched using their full name. This means that your
LoginRequest
class in the Objective-C world will be expected to live in the default package in the Java world. It most probably do not.The solution is to add a translation as such:
I have added better support for this for v2.0, where a default package/prefix can be defined for both ends. For example
com.mycompany.
in Java and andMC
in Obj-C. The v2.0 branch is not stable enough for production yet unfortunately.