I should send HTTP post request to another server from my angular app :
$http({
method: 'POST',
url:'www.example.com/SearchHotel.php',
data:
'<?xml version="1.0" encoding="utf-8"?>
<Service_SearchHotel>
<AgentLogin>
<AgentId>xxx</AgentId>
<LoginName>xxxx</LoginName>
<Password>xxx</Password>
</AgentLogin>
<SearchHotel_Request>
<PaxPassport>MA05110184</PaxPassport>
<DestCountry>WSASTH</DestCountry>
<DestCity>WSASTHBKK</DestCity>
<HotelId InternalCode=""></HotelId>
<Period checkIn="2017-10-26" checkOut="2017-10-28" />
<RoomInfo>
<AdultNum RoomType="Twin">2</AdultNum>
<ChildAges />
</RoomInfo>
<flagAvail>Y</flagAvail>
</SearchHotel_Request>
</Service_SearchHotel>'
,
headers: {
'Content-Type' :'multipart/form-data',
'Content-Disposition': 'form-data',
**'name':"requestXML",**
'Accept':'application/xml',
'Access-Control-Allow-Origin':'*',
'Access-Control-Allow-Methods':'GET,PUT,POST,DELETE',
'Access-Control-Allow-Headers':'Content-Type'
}
}).then(function(error,response){
if (error) {
console.log(error);
}else{
console.log(response)
}
which requestXML is mandatory from servar on google postman data return as normal but in my app always return :
"<?xml version="1.0" encoding="utf-8"?>↵<Service_SearchHotel>↵ <SearchHotel_Response>↵ <Error>↵ <ErrorDescription>Invalid Tag XML</ErrorDescription>↵ </Error>↵ </SearchHotel_Response>↵</Service_SearchHotel>↵"
and give me Invalid Tag XML . how I should pass requestXML to my post data because Im sure its from this becuse before I add this part to postman its return me same error .
If any help will save me so much time
PS:
'Content-Disposition': 'form-data',
**'name':"requestXML",** this part I copy from postman, before I try 'Content-Type' :'application/xml', and data like : data:'XML Request :<?xml version="1.0" encoding="utf-8"?>........ and get same error