I have a xml file called AmaSend.xml. So , I have to send this xml file as a request and I want to get Response from another xml file. Then I tried like below. But , always I got
ReferenceError: xml is not defined
How can I fix this and send request and receive response ??
Here is AmaAll.php file
<html>
<body>
<script type="text/javascript">
$(document).ready(function () {
var sourceOffice = 'Value1';
var originator = 'Value2';
var referenceIdentifier = 'Value3';
var organizationId = 'Value4';
var binaryData = 'Value5';
var originatorTypeCode = 'Value6';
var referenceQualifier = 'Value7';
var dataLength = '8';
var dataType = 'E';
console.log(sourceOffice);
var query = '<?xml version="1.0"?><Security_Authenticate><userIdentifier><originIdentification><sourceOffice>Value1</sourceOffice>/originIdentification><originatorTypeCode>U</originatorTypeCode><originator>Value2</originator></userIdentifier>'+
'<dutyCode><dutyCodeDetails><referenceQualifier>DUT</referenceQualifier><referenceIdentifier>SU</referenceIdentifier></dutyCodeDetails></dutyCode>'+
'<systemDetails><organizationDetails><organizationId>NMC-I</organizationId></organizationDetails></systemDetails>'+
'<passwordInfo><dataLength>8</dataLength><dataType>E</dataType><binaryData>Value3</binaryData></passwordInfo></Security_Authenticate>';
$.ajax({
url: 'AmaRes.xml',
data: query,
type: 'POST',
contentType: "text/xml",
dataType: "xml",
success : function (xmlResponse){
var xmlhttp = new window.XMLHttpRequest();
xmlResponse = $.parseXML( xmlResponse ),
$xml = $( xmlResponse ),
$title = $xml.find( "statusCode" ); //to get the ResponseId for example
alert($(xml).find("statusCode")[0].attr("id"));
},
});
});
</script>
</body>
</html>
Here is AmaSend.xml file ( Request ).
<?xml version="1.0"?>
<Security_Authenticate>
<userIdentifier>
<originIdentification>
<sourceOffice>Value1</sourceOffice>
</originIdentification>
<originatorTypeCode>Value2</originatorTypeCode>
<originator>Value3</originator>
</userIdentifier>
<dutyCode>
<dutyCodeDetails>
<referenceQualifier>Value4</referenceQualifier>
<referenceIdentifier>Value5</referenceIdentifier>
</dutyCodeDetails>
</dutyCode>
<systemDetails>
<organizationDetails>
<organizationId>Value6</organizationId>
</organizationDetails>
</systemDetails>
<passwordInfo>
<dataLength>Value7</dataLength>
<dataType>Value8</dataType>
<binaryData>Value9</binaryData>
</passwordInfo>
</Security_Authenticate>
Here is AmaRes.xml ( Response )
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:awss="http://xml.amadeus.com/ws/2009/01/WBS_Session-2.0.xsd">
<soap:Header>
<awss:Session>
<awss:SessionId>Value1</awss:SessionId>
<awss:SequenceNumber>Value2</awss:SequenceNumber>
<awss:SecurityToken>Value3</awss:SecurityToken>
</awss:Session>
</soap:Header>
<soap:Body>
<Security_AuthenticateReply xmlns="http://xml.amadeus.com/VLSSLR_06_1_1A">
<processStatus>
<statusCode>Value4</statusCode>
</processStatus>
</Security_AuthenticateReply>
</soap:Body>
</soap:Envelope>