我想要的 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/