- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在调用网络服务时遇到问题,我在服务器中有一个 .NET 网络服务,我在 Android 中使用 KSOAP(ksoap2-android-assembly-2.5.7-jar-with-dependencies.jar)。在运行该程序时,我得到了一个名为“org.ksoap2.serialization.SoapPrimitive”的运行时异常。
我尝试使用我在链接中阅读的选项:How to call a .NET Webservice from Android using KSOAP2?和 kSoap2 Android -- Cast Class Exception (SoapObject)但对我没有任何帮助
这是我的代码:
try{
//Conexión a Web Service
SoapObject Solicitud = new SoapObject(NAMESPACE, METODO);
PropertyInfo sector = new PropertyInfo();
sector.setName("sector");
sector.setValue(sectorX.toString());
Solicitud.addProperty(sector);
SoapSerializationEnvelope Envoltorio = new SoapSerializationEnvelope (SoapEnvelope.VER12);
Envoltorio.dotNet = true;
Envoltorio.setOutputSoapObject (Solicitud);
HttpTransportSE TransporteHttp = new HttpTransportSE(URL);
TransporteHttp.call (SOAP_ACTION, Envoltorio);
//Obtencion de datos
SoapObject resultado = (SoapObject)Envoltorio.getResponse();
final String[] testValues = new String[resultado.getPropertyCount()];
final Number[] serie = new Number[resultado.getPropertyCount()];
for(int i= 0; i< resultado.getPropertyCount(); i++){
String x = "";
SoapObject wii = (SoapObject)resultado.getProperty(i);
x += wii.getPropertyAsString(1);
testValues[i] = wii.getPropertyAsString(1);
x.trim();
serie[i]=Integer.parseInt(x);
}
ArrayAdapter<String> adaptador = new ArrayAdapter<String>(this, R.layout.lista_sectores, testValues);
final ListView LstOpciones = (ListView) findViewById(R.id.LstOpciones);
LstOpciones.setAdapter(adaptador);
LstOpciones.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View itemClicked,
int position, long id) {
// TODO Auto-generated method stub
TextView textview = (TextView)itemClicked;
String strText = textview.getText().toString();
seleccion.setText("Seleccionado: " + strText);
} catch (Exception e){
txtMensaje.setText(e.getMessage());
}
其中 sectorX 是我给 WS 的字符串参数。
我尝试了不带参数的 Web 服务并且成功了!问题是当我发送参数时...我猜:/
最佳答案
那个名字也不异常(exception)。您可能会遇到类转换异常。如果您进行调试,您可能会发现您的响应是一个 SoapObject。那么你就可以使用 getProperty 或 getAttribute 或其他任何东西。如果您设置断点,您将能够浏览对象图并手动组装您的解析代码..
也许在某处发布堆栈跟踪..
关于android - KSOAP: "org.ksoap2.serialization.SoapPrimitive"异常问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6818602/
我的 kSOAP 网络服务将 xml 返回为这种格式我如何从中获取 country_name anyType{country=anyType{country_name=Egypt; };
我能够使用 ksoap2 获取复杂的类响应,现在我得到的响应是 xml 形式 任何人都可以帮我解决如何解析这个 Ksoap 响应吗?我已经在论坛上阅读了为它添加映射的内容,我也添加了映射。我可以使用
我一直在使用 Android 版 KSOAP 发送包含 6 个元素的 SOAP 请求,最后一个元素是一个值数组。这是代码... PropertyInfo properties[] = n
我在我的 Android 应用程序中使用 KSoap。我的应用程序使用 Web 服务与服务器通信。我找到了一个 KSoap wev 服务客户端的代码示例。在示例中,客户端使用以下代码与服务器进行通信
我正在使用 KSOAP2 调用 Web 服务。我收到了回复,但该回复中的特殊字符未正确显示。 我怎样才能改变它? 编辑: 以下代码负责发送和接收数据: package org.ksoap2.trans
我正在使用 Android ksoap2 库来使用 SOAP 网络服务。 请求中的一个节点看起来像.. //some more nodes .............
我有 ksop 请求。我揉出来的是 asdfdsafdsfasdfdsa
我正在使用支持超时的 ksoap2 2.5.4(在 Android 2.2 上)。我正在使用 Apache 2.2.16 来处理我的请求。一切正常,但当我关闭我的 Apache(或断开运行 Apach
帮帮我,我花了大约 3 周的时间搜索整个 www,但无法正常工作! 我有一个 WS,只想让我的应用程序有响应。但不幸的是,我在更正所有内容后总是得到以下错误! 08-09 15:29:30.930:
当向 soap 对象添加属性时无法指定其类型....我需要整数但它总是将其设置为“d:string”1312191347这是我添加属性(property)的方式: SoapObject _client
我在尝试使用 kSOAP2 在 Android 中使用 ColdFusion SOAP 服务时遇到了一个问题。这是我的 java 代码,用于调用我在 ColdFusion 中编写的测试方法(它只返回一
我正在尝试通过 kSOAP(直接从 Google 下载并包含“.jar”)调用公共(public) Web 服务 (w3schools.com/webservices/tempconvert.asmx
有没有人有使用 kSOAP 包的良好的复杂对象编码示例? 最佳答案 虽然这个例子不是可编译的和完整的,但基本思想是有一个类告诉 kSOAP 如何将 XML 标记转换为对象(即 readInstance
我正在通过 SOAP 发送多个 PDF 文件,Android 客户端将接收这些文件。但是当收到 SOAP 响应时,它会抛出 OutOfMemoryException。 我想知道它是否是 kSOAP 或
我正在使用 Android 中的 Ksoap 访问 .net 网络服务。 wsdl 的格式是这样的 Date1 Date2 我对 DateTo 使用相同的 addPropert
我不知道为什么我不能得到这个?......也许我遗漏了什么或者我太笨了 我想尝试从 Android 应用程序调用网络服务 现在要做到这一点,发现适用于 Android 的 kSOAP 2 是所需的库
我正在使用 ksoap2 (ksoap2-android-assembly-3.0.0-RC.1-jar-with-dependencies.jar) 与我的 android 应用通信在 jboss
我在下面显示的代码中使用 soap 访问 Web 服务并收到以下错误,我需要帮助来理解: SoapFault - faultcode: 'soap:Server' faultstring: 'Syst
我希望生成像这样的 soap 请求: - - Connect -
马上,这是我的 Soap 调用实现,减去不相关的位。 public class MySoapClient implements AbstractSoapClient { private Str
我是一名优秀的程序员,十分优秀!