ASP.NET服务可从.NET而不是Java访问 [英] ASP.NET service accessible from .NET but not Java
本文介绍了ASP.NET服务可从.NET而不是Java访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我必须通过j2me Application,MIDP-2.0访问Asp.net 4.0版服务。相同的J2me代码可以访问Asp.net 2.0版服务。我无法弄清楚我必须在J2me代码中进行更改的内容和位置。谷歌搜索了很多,但没有得到任何解决方案。我需要你的帮助。我的代码如下:
I have to access Asp.net version 4.0 services through j2me Application, MIDP-2.0. Same J2me code can able to access Asp.net version 2.0 services. I am not able to figure out what and where i have to make changes in my J2me code. Googled a lot for this but didn''t get any solution. I need your help guys. My code is as follow :
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();
}
}
我的网络服务如下。
My web Service is as follows.
[WebMethod]
public string mLogin(string userid, string password)
{
string message = string.Empty;
CommonDataEntity cd = new CommonDataEntity();
sqlfilter filter = new 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;
}
}
我正在使用Ksoap2-j2me-core 2.12 jar来访问Asp服务。
请帮帮我。:-)
I''m using Ksoap2-j2me-core 2.12 jar to access the Asp services.
Please help me out from this.:-)
推荐答案
对URL进行了更改,我的问题得到了解决。网址就像http://anup.abc.com/mService/someService.asmx
替换为http://121.211.23.123/mService /someService.asmx并获得输出。
Made changes in URL and I got my issue solved. Url was like "http://anup.abc.com/mService/someService.asmx"
replaced the same with "http://121.211.23.123/mService/someService.asmx" and got the output.
这篇关于ASP.NET服务可从.NET而不是Java访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文