?
Solved

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

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

770 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