Solved

How to integrate ASP.NET XML Web Service in Classic ASP web page

Posted on 2013-05-22
3
323 Views
Last Modified: 2013-05-28
Hi Experts,
This is the URL of the web service I'm trying to use:

https://mycompany/services.asmx/employeeDetail?employeeID=<%=Emp_Id%>&accessCode=ABCDEFG

When I replace <%=Emp_Id%> with an actual employee ID, like AB123, the following XML is displayed in my browser:

<?xml version="1.0" encoding="utf-8" ?>
- <EmployeeProfile_ver2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://mycompany/services/">
  <EmployeeID>AB123</EmployeeID>
  <First_Name>Jane</First_Name>
  <Last_Name>Doe</Last_Name>
  <Email_Address>jane.doe@mycompany.com</Email_Address>
  </EmployeeProfile_ver2>
 
How could I display this employee info on my Classic ASP page instead?

Thank you for your help.
0
Comment
Question by:romsom
  • 2
3 Comments
 
LVL 23

Accepted Solution

by:
Ioannis Paraskevopoulos earned 500 total points
ID: 39190579
Hi,

You could use xslt to do your job.
For instance create an xslt file as the following:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
	<xsl:output method="html" version="4.0" indent="yes"/>

	<xsl:template match="/">
		<html>
			<head>
				<title>Employee Record</title>
			</head>
			<body>
				<table>
					<tr>
						<td style="border-style=solid"><xsl:value-of select="EmployeeProfile_ver2/EmployeeID/text()"/></td>
						<td style="border-style=solid"><xsl:value-of select="EmployeeProfile_ver2/First_Name/text()"/></td>
						<td style="border-style=solid"><xsl:value-of select="EmployeeProfile_ver2/Last_Name/text()"/></td>
						<td style="border-style=solid"><xsl:value-of select="EmployeeProfile_ver2/Email_Address/text()"/></td>
					</tr>
				</table>
			</body>
		</html>
	</xsl:template>

</xsl:stylesheet>

Open in new window


And name it "Employee Record.xslt"

Then in your xml you should add the following row:
<?xml-stylesheet type="text/xsl" href="C:\Users\paraskevopoulos\Desktop\temp.xslt"?>

Open in new window


so your example would be:
<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="Employee Record.xslt"?>
<EmployeeProfile_ver2>
  <EmployeeID>AB123</EmployeeID>
  <First_Name>Jane</First_Name>
  <Last_Name>Doe</Last_Name>
  <Email_Address>jane.doe@mycompany.com</Email_Address>
</EmployeeProfile_ver2>

Open in new window


This will dictate your xml to be transformed by the code you have in your "Employee Record.xslt". Make sure these files are in the same folder.

If you now open the xml in IE you will see a table with 4 columns. If you check the source then you will get a nicely formmated html.

Unfortunately this seems to work in IE but not out of the box in Chrome or Firefox. If this is an intranet site, then you may get away with it...

Giannis
0
 

Author Comment

by:romsom
ID: 39191044
Thank you for your help. It should be OK, because it's an intranet site. But I'm not sure where I have to add the URL of the web service:
https://mycompany/services.asmx/employeeDetail?employeeID=<%=Emp_Id%>&accessCode=ABCDEFG
0
 

Author Closing Comment

by:romsom
ID: 39202595
Unfortunately I couldn't figure out how to import the data from the web service, but thank you for your help; I've learned something new.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

827 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question