android - Ksoap for android 无法创建良好的 soapEnvelop

标签 android soap android-ksoap2

我想要的 SOAP 是这样的:

<int:userId>......</int:userId>

这是在 SoapUI 中测试的,我得到了正确的响应。 Ksoap 做的是这样的:

<userId i:type="n0:undefined" xmlns:n0="http://namespace.com">.....</userId>

如果我在哪里将这段代码粘贴到 SoapUI 中,我会收到错误

'<Message>Error in line 5 position 88. Element 'http://namespace.com:
 userId'  
 contains data of the 'http://namespace.com:undefined' data contract.
 The deserializer has no knowledge of any type that maps to this contract. 
 Add the type corresponding to 'undefined' to the list of known types - 
 for example, by using the KnownTypeAttribute attribute or by 
 adding it to the list of known types passed to DataContractSerializer.
 </Message>

也许我正在寻找错误的解决方案方向,但我现在想知道如何让 ksoap 省略 i:type 部分。如果有人可以提供不同的解决方案,我将不胜感激。

最佳答案

KSoap 确实倾向于将自己的命名空间插入到每个标记中,这可以提供您所看到的输出。

我有一个类似的问题,使用以下方法很容易解决:

envelope.implicitTypes = true;

也请看看这个other question on SO .

关于android - Ksoap for android 无法创建良好的 soapEnvelop,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10335858/

相关文章:

android - SoapFault - 故障代码 : '1062' faultstring: 'Shipping method is not available'

android - 如何在android中实现触摸平滑图像橡皮擦?

Android Studio 可以正确地将应用程序与 -lGLESv3 链接到 64 位arm,但不能链接到 32 位arm

android - 将 WebView 显示为 AlertDialog 内容

java - 在Java SOAP Web服务中获取Referer

java - SoapFault - 故障代码 : 'SOAP-ENV:Server' faultstring: 'Procedure ' catalogProductList' not present' faultactor: 'null' detail: null

java - 返回数据集的 kSoap 和 .Net 网络服务

android - android中透明imageView的边框

Java crm 设置字段类型的值两个选项

php - fatal error : Uncaught SoapFault exception: [ns1:Client. AUTH_1] 身份验证失败