我创建了一个 SoapSerializationEnvelope,但我无法在嵌套的 SoapObject 之前定义属性位置:
SoapObject ajanlat = new SoapObject(NAMESPACE, "ajanlat");
SoapObject alapadatok = new SoapObject(NAMESPACE_DATA_CONTRACT, "Alapadatok");
PropertyInfo pi = new PropertyInfo();
pi.setNamespace(NAMESPACE_DATA_CONTRACT);
pi.setName("Azonosito");
pi.setValue("1234");
ajanlat.addProperty(pi);
alapadatok.addProperty(getProperty("SzerzodeskotesOka", "2"));
ajanlat.addSoapObject(alapadatok);
final SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setAddAdornments(false);
envelope.implicitTypes = true;
envelope.setOutputSoapObject(ajanlat);
这是生成以下请求 XML:
<n0:ajanlat xmlns:n0="http://www.signal.hu">
<n1:Alapadatok xmlns:n1="http://www.signal.hu/DataContract">
<n1:SzerzodeskotesOka i:type="d:string">2</n1:SzerzodeskotesOka>
</n1:Alapadatok>
<n4:Azonosito i:type="d:string" xmlns:n4="http://www.signal.hu/DataContract>1234</n4:Azonosito>
</n0:ajanlat>
但我需要以下内容:
<n0:ajanlat xmlns:n0="http://www.signal.hu">
<n4:Azonosito i:type="d:string" xmlns:n4="http://www.signal.hu/DataContract">1234</n4:Azonosito>
<n1:Alapadatok xmlns:n1="http://www.signal.hu/DataContract">
<n1:SzerzodeskotesOka i:type="d:string">2</n1:SzerzodeskotesOka>
</n1:Alapadatok>
</n0:ajanlat>