[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

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

Posted on 2013-05-22
3
Medium Priority
?
331 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 1500 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

656 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