@Override
protected Void doInBackground(Void... params) {
// TODO Auto-generated method stub
try {
SoapObject objSaveVisitInfraDetails = new SoapObject(NAMESPACE,
PostMETHOD_NAME);
C = new InfraVisit();
SoapObject lstInfraVisit = new SoapObject(NAMESPACE,
Constant.LstInfraVisit) ;
objSaveVisitInfraDetails.addProperty("lstInfraVisit",
lstInfraVisit);
for (int i = 0; i < 2; i++) {
objInfraVisit = new SoapObject(NAMESPACE,
Constant.InfraVisit);
objInfraVisit.addProperty("Feedback",
"Feedback");
objInfraVisit.addProperty("Image", null);
objInfraVisit.addProperty("InfraId", Integer.valueOf(1));
objInfraVisit.addProperty("ResolveStatus",
"ResolveStatus");
objInfraVisit.addProperty("VisitDetailId",
Integer.valueOf(1));
objInfraVisit.addProperty("Visit_MasterId",
Integer.valueOf(1));
lstInfraVisit.addProperty("InfraVisit", objInfraVisit) ;
}
objSaveVisitInfraDetails.addProperty("VisitMasterId", 1);
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
Element[] header = new Element[1];
header[0] = new Element().createElement(null, "Action");
header[0].setAttribute(null, "mustUnderstand", "1");
header[0].addChild(Node.IGNORABLE_WHITESPACE,
Constant.NameSpace
+ "/IInfraService/SaveVisitInfraDetail");
envelope.dotNet = true;
envelope.headerOut = header;
envelope.setOutputSoapObject(objSaveVisitInfraDetails);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.debug = true;
androidHttpTransport.call(PostSOAP_ACTION, envelope);
Log.d("RESPONSEEEEEEEEEEEEEEEEEEEEEEEEE",
androidHttpTransport.requestDump);
Log.d("RESPONSEEEEEEEEEEEEEEEEEEEEEEEEE222",
androidHttpTransport.responseDump);
SoapObject result = (SoapObject) envelope.getResponse();
String Name = result.getProperty(0).toString();
} catch (SoapFault e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (XmlPullParserException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (NullPointerException e) {
// TODO: handle exception
Log.d("Errorrr", e.getMessage());
}
return null;
}
这是我的代码,我将转换soap envalape并将数据作为envalape发布到服务器
我现在的envalape是:
<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>
<Action mustUnderstand="1">https://softageteledoc.com/IInfraService/SaveVisitInfraDetail</Action>
</v:Header>
<v:Body>
<SaveVisitInfraDetail xmlns="https://softageteledoc.com" id="o0" c:root="1">
<lstInfraVisit i:type="n0:lstInfraVisit" xmlns:n0="https://softageteledoc.com">
<InfraVisit i:type="n0:InfraVisit">
<Feedback i:type="d:string">Feedback</Feedback>
<Image i:null="true" />
<InfraId i:type="d:int">1</InfraId>
<ResolveStatus i:type="d:string">ResolveStatus</ResolveStatus><VisitDetailId i:type="d:int">1</VisitDetailId>
<Visit_MasterId i:type="d:int"></Visit_MasterId></InfraVisit>
</lstInfraVisit>
<VisitMasterId i:type="d:int">1</VisitMasterId>
</SaveVisitInfraDetail>
</v:Body>
</v:Envelope>
这是我必须制作的envalape,以便数据轻松发布:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://tempuri.org/IInfraService/SaveVisitInfraDetail</Action>
</s:Header>
<s:Body>
<SaveVisitInfraDetail xmlns="http://tempuri.org/">
<lstInfraVisit xmlns:d4p1="http://schemas.datacontract.org/2004/07/LoopInfra.Contracts.Objects" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<d4p1:InfraVisit>
<d4p1:Feedback>Chair Replaced</d4p1:Feedback>
<d4p1:Image i:nil="true" />
<d4p1:InfraId>1</d4p1:InfraId>
<d4p1:ResolveStatus>true</d4p1:ResolveStatus>
<d4p1:VisitDetailId>1</d4p1:VisitDetailId>
<d4p1:Visit_MasterId>1</d4p1:Visit_MasterId>
</d4p1:InfraVisit>
</lstInfraVisit>
<VisitMasterId>1</VisitMasterId>
</SaveVisitInfraDetail>
</s:Body>
</s:Envelope
我们必须归档我必须将envelope
从我当前的envelope
转换为欲望envalpe,请帮助我使用ksoap2-android-assembly-2.6.5-jar-with-dependencies.jar
获取POST数据,请帮助