Send XML to webservice



I am send a XML String which is extract from XML file to a jax Web-services


My XML is



<GTSRequest command="version">
<Authorization account="jrl" user="" password="123456"/>
</GTSRequest>


and Java Code is



public static void main(String[] args) throws IOException {
// TODO code application logic here
String a = System.getProperty("user.dir") + "/XML/Get Current GTS Version.xml";
System.out.println(convertXMLFileToString(a));
// call web service
System.out.println(gtsServiceRequest(convertXMLFileToString(a)));

}

public static String convertXMLFileToString(String fileName) throws FileNotFoundException, IOException {
BufferedReader br = new BufferedReader(new FileReader(fileName));
String everything;
try {
StringBuilder sb = new StringBuilder();
String line = br.readLine();

while (line != null) {
sb.append(line);
sb.append(System.lineSeparator());
line = br.readLine();
}
everything = sb.toString();
} finally {
br.close();
}
return everything;
}


But when string goes to server the string is change in



lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;&#xD;
&lt;GTSRequest command=&quot;version&quot;&gt;&#xD;
&lt;Authorization account=&quot;jrl&quot; user=&quot;&quot; password=&quot;123456&quot;/&gt;&#xD;
&lt;/GTSRequest&gt


but i don't want it please help me


No comments:

Post a Comment