I am creating a web page. In this web page , I want to show details which is get by web service. But , the thing is before do this , I have to send headers and get the access tokens from the server. Then I have implemented a code like this. now console of the web browser doesn't show me any kind of error. But , when I tries to alert response code it shows me undefined.
我正在创建一个网页。在此网页中,我想显示通过Web服务获取的详细信息。但是,事情是在此之前,我必须发送标头并从服务器获取访问令牌。然后我实现了这样的代码。现在,Web浏览器的控制台没有显示任何类型的错误。但是,当我试图提醒响应代码时,它显示我未定义。
What I want is I want to show or alert Response sessionId. How can I do it ??
我想要的是我想要显示或提醒响应sessionId。我该怎么做 ??
$(document).ready(function() {
$.ajax({
type: 'POST',
url: 'AmaRes.xml',
contentType: 'text/xml; charset=utf-8',
headers: {
SOAPAction: 'WSDL_File.wsdl'
},
data: '<?xml version="1.0"?><Security_Authenticate><userIdentifier><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>8</dataLength><dataType>E</dataType><binaryData>Value7</binaryData></passwordInfo></Security_Authenticate>',
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("wss:Session").attr("awss:SessionId"));
},
});
});
AmaRes.xml
is the response xml file.
AmaRes.xml是响应xml文件。
<?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>1</awss:SequenceNumber>
<awss:SecurityToken>Value2</awss:SecurityToken>
</awss:Session>
</soap:Header>
<soap:Body>
<Security_AuthenticateReply xmlns="http://xml.amadeus.com/VLSSLR_06_1_1A">
<processStatus>
<statusCode>Value3</statusCode>
</processStatus>
</Security_AuthenticateReply>
</soap:Body>
</soap:Envelope>
1 个解决方案
#1
0
Have you try Header Interface https://developer.mozilla.org/en-US/docs/Web/API/Headers ?
您是否尝试过Header Interface https://developer.mozilla.org/en-US/docs/Web/API/Headers?
#1
0
Have you try Header Interface https://developer.mozilla.org/en-US/docs/Web/API/Headers ?
您是否尝试过Header Interface https://developer.mozilla.org/en-US/docs/Web/API/Headers?