我正在尝试使用soap服务使用xml将数据导入数据库 我完成了以下代码,但它给了我错误: 未知请求,无法处理 我从肥皂服务发送xml格式的数据,请检查 那,让我知道我在哪里错误
Here is my code :
String SOAP_ACTION = "http://LocalHOST/LISTOFLEDGERS/NAME";
String URL = "http://LocalHOST:portname";
String response = null;
try {
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(URL);
String bodyOut = "<soapenv:Envelope>"
+ "<soapenv:Header>"
+ "<soapenv:Version>1</soapenv:Version>"
+ "<soapenv:Tallyrequest>Import</soapenv:Tallyrequest>"
+ "<soapenv:Type>Data</soapenv:Type>"
+ "<soapenv:Id>All Masters</soapenv:Id>"
+ "</soapenv:Header>"
+ "<soapenv:Body>"
+ "<soapenv:Desc>"
+ "<soapenv:Staticvariables>"
+ "<soapenv:Svexportformat>$$SysName:XML</soapenv:Svexportformat>"
+ "</soapenv:Staticvariables>" + "</soapenv:Desc>"
+ "<soapenv:Data>" + "<soapenv:Tallymessage>"
+ "<soapenv:Ledger Name=" + "" + "Travelling EXp" + ">"
+ "<soapenv:NAME.LIST>"
+ "<soapenv:NAME>EXp</NAME>"
+ "</soapenv:NAME.LIST>" + "</soapenv:Ledger>"
+ "</soapenv:Tallymessage>" + "</soapenv:DATA>"
+ "</soapenv:BODY>" + "</soapenv:ENVELOPE>";
StringEntity se = new StringEntity(bodyOut, HTTP.UTF_8);
se.setContentType("text/xml");
httpPost.addHeader("SOAPAction", SOAP_ACTION);
httpPost.setEntity(se);
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity resEntity = httpResponse.getEntity();
response = EntityUtils.toString(resEntity);
Log.v("getting response#######################", response);
my xml one line is going +"<LEDGER NAME=EXp>"+
it should be go like +"<LEDGER NAME="EXp">"+ so how i can do that