我想将数据发送到一个WebService,但它没有返回一个有效的反馈,并且在html" target="_blank">字符串上显示错误。我正在使用KSOAP2。
null
对象已收集无法计算org.ksoap2.serialization.soapobject.ToString()
如果一切正常,它应该给我一个'OK',但是WebService返回一个XML(responseDump):
<?XML Version=“1.0”encoding=“UTF-8”?>
下面是发送和接收WebService的代码:
public String transmitWS(String col_numero, String qtd_consumo, String idate_itime, String vlr_med,
String cod_valor, String matric, String texto_obs, String observacao,
String idProgramacao){
String HOST = "";
String NAMESPACE = "";
String URL = ""; //all right here
String SOAP_ACTION = "";
String METHOD_NAME = "";
String resultWS = null;
SoapObject requestTransmit = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo transmitPI = new PropertyInfo();
transmitPI.setType(String.class);
transmitPI.setName("Query");
transmitPI.setValue("update prev_programacao set col_numero = " + col_numero + ", status_ponto = 3, qtd_consumo =" + qtd_consumo + "," +
" idate_itime = TO_DATE('"+ idate_itime +"','YYYY-MM-DD HH24:MI:SS'), vlr_med = " + vlr_med + ", cod_valor = " + cod_valor +
", matric = " + matric +", texto_obs = '" + texto_obs + "', observacao = '" +
observacao + "' where id_programacao = "+idProgramacao+"");
requestTransmit.addProperty(transmitPI);
SoapSerializationEnvelope envelopeTransmit = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelopeTransmit.dotNet = true;
envelopeTransmit.setAddAdornments(false);
envelopeTransmit.implicitTypes = false;
envelopeTransmit.setOutputSoapObject(requestTransmit);
HttpTransportSE androidHttpTransportTransmit = new HttpTransportSE(URL);
//AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport(URL);
try {
androidHttpTransportTransmit.debug = true;
androidHttpTransportTransmit.call(SOAP_ACTION, envelopeTransmit);
SoapObject responseTransmit = (SoapObject) envelopeTransmit.getResponse();
resultWS = androidHttpTransportTransmit.requestDump;
resultWS = androidHttpTransportTransmit.responseDump;
Log.i("t", "doInBackground");
} catch (Exception e) {
e.printStackTrace();
}
return resultWS;
}
最后,resultWS为空。有人知道此错误的原因吗?
我无法检测出有什么问题,但这里有一个使用ksoap的工作函数。也许这会有帮助:
/**
* Calls the stored proc on the server to return a dataset/SoapObject. This will always run the ProcReader method on the web server.
*
* @param storedProc The Stored Proc to call
* @param params The parameter(s) for the stored proc (pipe seperated for multiple parameters)
* @return The SoapObject returned by the Stored Proc call
* @throws Exception
*/
public static SoapObject callProcServiceForObject(String serviceMethod, String storedProc, String params) throws Exception {
String NAMESPACE = "http://" + GlobalVars.serviceIP + "/";
String METHOD_NAME = getMethodName(serviceMethod);
String SOAP_ACTION = NAMESPACE + METHOD_NAME;
String URL = "http://" + GlobalVars.serviceIP + "/ATService.asmx";
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
if (GlobalVars.encryptedService) {
request.addProperty("ePassword", CryptUtil.encryptString(GlobalVars.deviceSerialNumber));
request.addProperty("eData", CryptUtil.encryptString(GlobalVars.serverDB));
request.addProperty("eSP_Name", CryptUtil.encryptString(storedProc));
request.addProperty("eParam", CryptUtil.encryptString(params));
} else {
request.addProperty("sPassword", GlobalVars.deviceSerialNumber);
request.addProperty("sData", GlobalVars.serverDB);
request.addProperty("sSP_Name", storedProc);
request.addProperty("sParam", params);
}
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
// Enable the below property if consuming .Net service
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL, timeout);
//count up the network traffic
numberOfBytesTransmitted = numberOfBytesTransmitted + StringToBytes(request.toString());
SoapObject returnable = null;
try {
androidHttpTransport.call(SOAP_ACTION, envelope);
returnable = (SoapObject)envelope.getResponse();
} catch (Exception e) {
e.printStackTrace();
throw new Exception("Msg:" + e.getMessage() + "; SP:" + storedProc + "; Params: " + params + "; Method:" + METHOD_NAME);
}
numberOfBytesTransmitted = numberOfBytesTransmitted + StringToBytes(returnable.toString());
return returnable;
}
注意:这里有类似的问题,但没有一个解决方案对我有效。我花了几天的时间想把它弄好。 我已经将一个WAR文件部署到Tomcat,“Tomcat Web Application Manager”显示它已经启动。当我点击web应用程序“/forecaster”时,我得到一个404错误。web应用程序在从调试器(IntelliJ)运行时工作。WAR文件名为“forecaster.WAR”,我尝试过的路径是:
我在Azure上的Linux应用服务上部署了一个响应js网站。但它没有部署在应用服务上。我使用pm2命令在linux环境下运行应用程序 pm2 serve/home/site/wwwroot/--无守护进程 但在错误日志中,未找到pm2的错误。接下来呢 容器没有响应端口: 8080上的HTTP ping,站点启动失败。 站点的容器已退出,站点启动失败
我创建了一个工作正常的Spring启动应用程序,但我无法获得与该应用程序捆绑在一起的Rest服务。请找到下面的代码。我能够访问urlhttp://localhost:8080/springbootr/但无法访问web服务urlhttp://localhost:8080/springbootr/Hello/,在web服务调用时得到404。 pom。xml: 我是这个应用程序的新手,请帮助我。
我正在尝试在heroku上运行我的第一个django应用程序,我设法成功部署了该应用程序,除了Web套接字之外,一切都正常。在本地,我在内存通道中使用,一切都正常。我在内存通道和redis中尝试了heroku,但都不起作用。我尝试了许多不同的配置,但我无法找出任何有效的解决方案。Heroku日志也没有给我任何可能出错的线索... 我在浏览器中得到的错误: Javascript 客户端代码: [我尝
我正在创建自己的应用程序。我在AndroidLollipop和Marshmallow上测试了它-一切都很好。但每当我尝试Android Kitkat时,就会发生错误。以下是错误日志: 看起来问题出在“progi”类的第62行,但是——对我来说——一切都很好,尤其是在新的Android版本上运行得很好。 如果有人问“Tabilica从意图中得到了什么?” 任何想法是什么问题?
问题内容: 我想尝试使用Google App Engine的Google Eclipse插件,但是却陷入了教程的困境… 我想从Google教程启动Web应用程序,但是当我单击“ RUN AS> Web应用程序”时,我仅在控制台上看到以下消息: 有什么问题?似乎启动服务器的命令是错误的,但是我没有对其进行编辑…有人可以帮忙吗? 问题答案: 这是因为您的启动配置文件(位置:WORKSPACE / .m