【发布时间】:2012-12-31 06:19:48
【问题描述】:
我必须通过 j2me 应用程序 MIDP-2.0 访问 IIS Asp.net 4.0 版服务。相同的 J2me 代码可以访问 Asp.net 2.0 版本的服务。
我无法弄清楚我必须在我的 J2me 代码中进行哪些更改以及在何处进行更改?为此谷歌了很多,但没有得到任何解决方案。我的代码如下:
public String loginVerification(String userId, String pwd){
String Method_Name = "mLogin";
//String Method_Name = "LoginCheck";
try{
SoapObject request = new SoapObject(Constants.NAMESPACE_URL, Method_Name);
request.addProperty("userid", userId);
request.addProperty("password", pwd);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransport ht = new HttpTransport(Constants.LOGIN_URL);
ht.debug = true;
ht.call(Constants.NAMESPACE_URL+Method_Name, envelope); // getting error here
SoapPrimitive result = (SoapPrimitive) envelope.getResponse();
return result.toString();
}catch(IOException e){
return e.getMessage().toString();
}catch(XmlPullParserException e){
return e.getMessage().toString();
}
}
我正在使用 Ksoap2-j2me-core 2.12 jar 来访问 Asp 服务。
【问题讨论】:
-
我非常需要你们的帮助。只给我一些线索,我会处理剩下的部分。
-
[WebMethod] public string mLogin(string userid, string password) { string message = string.Empty; CommonDataEntity cd = new CommonDataEntity(); sqlfilter 过滤器 = 新的 sqlfilter(); int retVal=cd.Select_CustomerLogin(filter.SqFilter(userid), filter.SqFilter(password), out message); if (retVal > 0 && message == "User") { return "true#"+cd.mLogin(userid); } else { return "false#"+userid; } }
-
以上是我的网络方法...
-
gnat 先生,你能告诉我上面代码中的问题是什么吗?
标签: asp.net java-me ksoap2 midp