Solved

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

Posted on 2013-05-22
3
318 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
401 - Error 6 24
Auto Submit on dropdown box 14 26
Response.Redirect Open new Form/tab/page? 5 17
getting id from database 5 22
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

728 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now