B2B dolution in classical ASP

C

c676228

Hi all,
Recently, a couple of our clients have asked if it is possible for them to
pass data in xml format to our server program for processing it.
Would you please give me some guide lines or point me to a starting point
how I should do it in classical asp program.
Thank you.
 
S

Steven Cheng[MSFT]

Hi Betty,

For the client users of your application, how will they provide the XML
data to your server application? So far, for classic ASP page, you can
consider the following approachs:

1. let use upload the xml data via file upload as Jon has suggested

2. Let them programmatically post the XML document as content of http post
request, and at server-side, you can read the XML data from http request's
body:

#Happy Days Are Here Again: Posting XML to the Server
http://msdn2.microsoft.com/en-us/library/ms950790.aspx

3. You can also let client user use html form input textbox to submit some
XML data.

IMO, the #1 and #2 would be preferred.


Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================



This posting is provided "AS IS" with no warranties, and confers no rights.
 
S

Steven Cheng[MSFT]

Hi Betty,

Any progress on this? If you have anything else we can help, please feel
free to post here.


Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 
C

c676228

Jon and Steven,
thanks for your help. Steven, thank you so much being helpful all the time,
with your detailed information and help, I can always quickly start with
something which I never did before.
I just read your meesage, I think in our scenario. Our client will send a
XML file
(which has many fields data in a form) programatically to our *.asp script.
My task is unwrapped the data in this xml file and use it just like a
regular form data and process it and then save the transaction data into
database.
I don't need to save this xml file some where, I need to process the data on
the fly.
Do you have an example, how to extra data from a xml file?
 
E

Evertjan.

Steven Cheng[MSFT] wrote on 13 apr 2007 in
microsoft.public.inetserver.asp.general:
Any progress on this? If you have anything else we can help, please feel
free to post here.

[please always quote on usenet]

Please Steven, usenet is not email.
 
S

Steven Cheng[MSFT]

Hi Betty,

For file uploading and processing in classic ASP, it is a bit complex since
ASP doesn't provide built-in object model for accessing multi-part
form(when upload files). I know that there are many 3rd party components
for classic ASP file uploading processing. If you do not want to use 3rd
party one, here are some web article that provide some custom vbscript to
process uploaded file stream:

#File upload script class
http://authors.aspalliance.com/Michiel/uploadscript.asp

#File Upload using a VBScript Class
http://www.codeproject.com/asp/vbsupload.asp?df=100

After you get the uploaded file's stream, you can load them into some XML
component to process them(the MSXML classes).

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 
C

c676228

Hi,
here is my question: The following code I download from hotscript.com which
display oK on the server, but it will give me an error message if I use
https://xxxx.com instead of http://xxxx.com
The error message will be:(it seems very strange to me since it has nothing
to do with xsl style sheet.


The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and
then click the Refresh button, or try again later.


--------------------------------------------------------------------------------

Invalid at the top level of the document. Error processing resource
'https://www.xxxxxx.com/annualp/testxm...

<news><newsitem><title>programmingsite.co.uk</title><link>http://www.programmingsite.co.uk<...



<%@LANGUAGE = "VBScript" %>
<%
Response.Buffer = False
'ensure proper headers sent to the client
Response.ContentType = "text/xml"
%>
<?xml version="1.0"?>
<%
'these are our variables
Dim objXML , objNews
'create an instance of the DOM
Set objXML = Server.CreateObject("Microsoft.XMLDOM")
'Create our root element using the createElement method
Set objXML.documentElement = objXML.createElement("news")
'Create the newsitem element
Set objNews = objXML.createElement("newsitem")
'now we will create all the child elements in this case
'title , link and description
objNews.appendChild objXML.createElement("title")
objNews.appendChild objXML.createElement("link")
objNews.appendChild objXML.createElement("description")
'now we add values to the child elements
objNews.childNodes(0).text = "programmingsite.co.uk"
objNews.childNodes(1).text = "http://www.programmingsite.co.uk"
objNews.childNodes(2).text = "programming resources"
'add the newsitem element to the news element
objXML.documentElement.appendChild objNews.cloneNode(true)
'write the document using the xml method of the DOM
Response.Write objXML.xml
%>
 
S

Steven Cheng[MSFT]

Thanks for your followup Betty,

So when you return a XML document into ASP page's response, it displays
well when through http channel, but report the following error through
https channel, correct?

=============
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and
then click the Refresh button, or try again later.
===============

For this problem, I think it is likely due to the response's XML stream be
malformed or the client browser has something incorrect. I have pasted your
code and test in my local environment(with both SSL and non SSL channel),
both of them work well.

I think you can first try using a static XML document file(with the same
response content) and visiting it through https to see whether you'll get
the same problem behavior.

For client specfic test, you can try using different machine or browser to
perform the test to see whether behavior.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 
C

c676228

Steven,
I think you are right. I have experience similar situation too.
sometimes, the xml file cannot be present the way it is supposed to be. i.e.
just regular text in the browser,
But when I view the source of the page, the code is in xml file format. I
don't know why.
another question I want to ask is when I validate the data submitted from an
external source, how I can check if certain fields are provided or not. let's
say lastname,
if they don't provide the lastname, check request("lastname")="" won't work,
isNUll or isobject(Request("lastname")) seems not working, any suggestion or
clue?
Thank you.
 
S

Steven Cheng[MSFT]

Hi Betty,

For the form elements in the post request, I think as long as the certain
item key has been included in the post messsage(such as the input element
has been put on the <form> ), the request.Form collection should contain it
(if no value specified, it is an empty string). You can use the following
code to enumerate all the form collection items:

===============
<%

dim x

for each x in Request.Form
Response.Write("<br>" & x & " = " & Request.Form )
next

%>
=================

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top