Web Service එකකින් ලැබෙන,XML Responses වෙබ් එකේ පෙන්වන්න ඕන
SOAP Web Service එකකින් ලැබෙන ,XML Response එක වෙබ් පිටුවක පෙන්වන්නේ කොහමද ??
මම දැනට වෙබ් එකක් හදනවා. එක Data ගන්නේ SOAP Web Service එකකින්. console.log(data); කියල දුන්නාම Responses ටික වෙබ් බ්රව්සර් එකේ Console Tab එකේ පෙන්වනවා. දැන් මට ඕන , මම ලබා දෙන Request එකට අදාල Responses ටික වෙබ් පිටුවේ පෙන්වන්න. Table එකක හෝ නිකන් හරි , පෙන්වන්න ක්රමයක් ඕන. මම හැම තැනම හොයල බැලුවා , ඒත් මුකුත් සෙට් වුනේ නැ. උදව් කරන්න පුලුවන් නම් ලොකු දේයක්.
මේ පහල විධියට තමයි , Request එක යවන්නේ.
මෙන්න Responses ටිකේ Sample එකක්.
SOAP Web Service එකකින් ලැබෙන ,XML Response එක වෙබ් පිටුවක පෙන්වන්නේ කොහමද ??
මම දැනට වෙබ් එකක් හදනවා. එක Data ගන්නේ SOAP Web Service එකකින්. console.log(data); කියල දුන්නාම Responses ටික වෙබ් බ්රව්සර් එකේ Console Tab එකේ පෙන්වනවා. දැන් මට ඕන , මම ලබා දෙන Request එකට අදාල Responses ටික වෙබ් පිටුවේ පෙන්වන්න. Table එකක හෝ නිකන් හරි , පෙන්වන්න ක්රමයක් ඕන. මම හැම තැනම හොයල බැලුවා , ඒත් මුකුත් සෙට් වුනේ නැ. උදව් කරන්න පුලුවන් නම් ලොකු දේයක්.
මේ පහල විධියට තමයි , Request එක යවන්නේ.
Code:
<script type="text/javascript">
$(document).ready(function () {
$('#ghsubmitbtn').on('click', function (e) {
var country = $('#country').val();
var year = $('#year').val();
var month = $('#month').val();
//console.log(departureDate);
var str = '<?xml version = "1.0" encoding = "UTF-8"?>' +
'<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.holidaywebservice.com/HolidayService_v2/">' +
'<SOAP-ENV:Body>' +
'<ns1:GetHolidaysForMonth>' +
'<ns1:countryCode>' + country + '</ns1:countryCode>' +
'<ns1:year>' + year + ' </ns1:year>' +
'<ns1:month>' + month + '</ns1:month>' +
'</ns1:GetHolidaysForMonth>' +
'</SOAP-ENV:Body>' +
'</SOAP-ENV:Envelope>';
$.ajax({
url: 'http://holidaywebservice.com/HolidayService_v2/HolidayService2.asmx?WSDL',
method: 'POST',
contentType: "text/xml; charset=utf-8",
data: str,
//headers: {"Authorization": 'Bearer ' + bat},
success: function (data) {
console.log(data);
}
});
});
});
</script>
මෙන්න Responses ටිකේ Sample එකක්.
Code:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetHolidaysForMonthResponse
xmlns="http://www.holidaywebservice.com/HolidayService_v2/">
<GetHolidaysForMonthResult>
<Holiday>
<Country>UnitedStates</Country>
<HolidayCode>APRIL-FOOLS</HolidayCode>
<Descriptor>April Fools Day</Descriptor>
<HolidayType>Notable</HolidayType>
<DateType>ObservedActual</DateType>
<BankHoliday>NotRecognized</BankHoliday>
<Date>2018-04-01T00:00:00</Date>
</Holiday>
<Holiday>
<Country>UnitedStates</Country>
<HolidayCode>EASTER</HolidayCode>
<Descriptor>Easter</Descriptor>
<HolidayType>Religious</HolidayType>
<DateType>ObservedActual</DateType>
<BankHoliday>NotRecognized</BankHoliday>
<Date>2018-04-01T00:00:00</Date>
</Holiday>
<Holiday>
<Country>UnitedStates</Country>
<HolidayCode>EARTH-DAY</HolidayCode>
<Descriptor>Earth Day</Descriptor>
<HolidayType>Notable</HolidayType>
<DateType>ObservedActual</DateType>
<BankHoliday>NotRecognized</BankHoliday>
<Date>2018-04-22T00:00:00</Date>
</Holiday>
</GetHolidaysForMonthResult>
</GetHolidaysForMonthResponse>
</soap:Body>
</soap:Envelope>
Last edited:
