I want the following request format to be send to the rest webservice how can i do so ?
<?xml version="1.0" encoding="UTF-8"?>
<demo>
<headers>
<messagetype>1</messagetype>
<messagetoken>123647356734156</messagetoken>
</headers>
<authentication>
<name>xxx</name>
<servicename>yyy</servicename>
<username>10121</username>
<password>welcome1234</password>
</authentication>
</demo>
An easiest way is to create a string with XML request value. For the example, you can pass this XML string request value to the below function to fetch response from the server.
FYI, you can pass request by setting entity value inside object of HTTPPost, same way in below example. You can also pass JSON request value this way.
For example: