Here is the example i have tried and it is working for me:
Create the XML file SoapRequestFile.xml
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
<soapenv:Header/>
<soapenv:Body>
<tem:GetConversionRate>
<!--Optional:-->
<tem:CurrencyFrom>USD</tem:CurrencyFrom>
<!--Optional:-->
<tem:CurrencyTo>INR</tem:CurrencyTo>
<tem:RateDate>2018-12-07</tem:RateDate>
</tem:GetConversionRate>
</soapenv:Body>
</soapenv:Envelope>
And here the code in java:
import java.io.File;
import java.io.FileInputStream;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.InputStreamEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.junit.Assert;
import org.testng.annotations.Test;
import io.restassured.path.json.JsonPath;
import io.restassured.path.xml.XmlPath;
@Test
public void getMethod() throws Exception {
//wsdl file :http://currencyconverter.kowabunga.net/converter.asmx?wsdl
File soapRequestFile = new File(".\\SOAPRequest\\SoapRequestFile.xml");
CloseableHttpClient client = HttpClients.createDefault(); //create client
HttpPost request = new HttpPost("http://currencyconverter.kowabunga.net/converter.asmx"); //Create the request
request.addHeader("Content-Type", "text/xml"); //adding header
request.setEntity(new InputStreamEntity(new FileInputStream(soapRequestFile)));
CloseableHttpResponse response = client.execute(request);//Execute the command
int statusCode=response.getStatusLine().getStatusCode();//Get the status code and assert
System.out.println("Status code: " +statusCode );
Assert.assertEquals(200, statusCode);
String responseString = EntityUtils.toString(response.getEntity(),"UTF-8");//Getting the Response body
System.out.println(responseString);
XmlPath jsXpath= new XmlPath(responseString);//Converting string into xml path to assert
String rate=jsXpath.getString("GetConversionRateResult");
System.out.println("rate returned is: " + rate);
}