Showing posts with label cannot be processed I am sending data in xml format from soap services please check that and let me know where i am mistaking Here is my code :. Show all posts
Showing posts with label cannot be processed I am sending data in xml format from soap services please check that and let me know where i am mistaking Here is my code :. Show all posts

How to import data into database using xml



I am trying to import data into the database using xml by using soap services I done with following code but it is giving me error : Unknown Request, cannot be processed I am sending data in xml format from soap services please check that and let me know where i am mistaking



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);

Read more ...