这是请求信封的样子:
<v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/">
<v:Header />
<v:Body>
<getLijst xmlns="http://OAM/OMZETAPPMETHODS.xsd">
<selectie i:type="n1:OAM_ArtstructselobjUser" xmlns:n1="http://OAM/OMZETAPPMETHODS.xsd">
<filiaal i:type="d:decimal">4</filiaal>
<artnivsel i:type="n1:OAM_ArtstructobjUser">
<asonummer i:type="d:decimal">1</asonummer>
<asotype i:type="d:string">P</asotype>
</artnivsel>
</selectie>
</getLijst>
</v:Body>
</v:Envelope>
这是我的代码的一部分:
String nameSpace = "http://OAM/OMZETAPPMETHODS.xsd";
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setAddAdornments(false);
SoapObject request = new SoapObject(nameSpace, _soapMethod);
OAM_ArtstructselobjUser obj = new OAM_ArtstructselobjUser();
// .. This is where the properties are added, irrelevant
request.addProperty("selectie", obj);
OAM_ArtstructobjUser obj2 = new OAM_ArtstructobjUser();
// .. This is where the properties are added, irrelevant
request.addProperty("artnivsel", obj2);
envelope.setOutputSoapObject(request);
Marshal floatMarshal = new MarshalFloat();
floatMarshal.register(envelope);
envelope.addMapping(nameSpace, "OAM_ArtstructselobjUser", OAM_ArtstructselobjUser.class);
envelope.addMapping(nameSpace, "OAM_ArtstructobjUser", OAM_ArtstructobjUser.class);
所以我想要artnivsel
一个自定义类型,但继承selectie
. 如果我运行上面的代码,我会得到一个05-07 14:22:21.034: ERROR/AndroidRuntime(16417): Caused by: java.lang.RuntimeException: Unknown Property: asotype
如果我nameSpace
将第二个更改addMapping
为其他任何内容,我的代码运行良好。但我的信封 XML 不正确。了。
任何可以给我指点的人,我对ksoap2或soap特别没有经验。