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 "arg开发者_Python百科ument type mismatch"
the result is that web server cannot find the remote LoginRequest object. Any ideas? thanks a lotSorry 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:
[CWHessianArchiver setClassName:@"com.mycompany.LoginRequest"
forClass:[LoginRequest class]];
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 and MC
in Obj-C. The v2.0 branch is not stable enough for production yet unfortunately.
精彩评论