Solved

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

Posted on 2013-05-22
3
325 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

691 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