I have a few .aspx pages that I have written in Microsoft Visual
Studio 2005, and I want to post information on my form to a web
server. The web server will only except data in xml format, and will
reply with an xml formated object. I have the xml file replica that
the service receives, and teh replica file that the service sends
back.
My question, I dont know how to code aspx pages, only asp and im
running out of time to deliver this solution to my client. I can make
teh forms on the aspx page, the thing i need is the server scripting
to:
user clicks a button that tells my server to process a script, that will..
- take the information from the form on the page and make a formatted xml object.
- post that xml document to the 3rd party web server
- receive the xml file back from teh 3rd party web server
- make the data from that received xml file available somehow to show
back to teh user.
This is a simple task, and I have it in asp, but now I have to have it
working in aspx! I prefer VB, but C# is fine, i just need it. |
Clarification of Question by
moxyman-ga
on
05 Apr 2006 18:55 PDT
This is the XML structure to be --SENT--
<epxml>
<header>
<responsetype>direct</responsetype>
<mid>99</mid>
<password>test</password>
<type>charge</type>
</header>
<request>
<charge>
<etan>6542335675</etan>
<card>
<cctype>visa</cctype>
<cc>4906383347771203</cc>
<expire>12/04</expire>
<cvv>648</cvv>
</card>
<cardholder>
<firstname>John</firstname>
<lastname>Doe</lastname>
<street>Anystreet</street>
<housenumber>12</housenumber>
<zip>12345</zip>
<city>Anytown</city>
<country>US</country>
<state>NY</state>
<email>any@emailadress.com</email>
</cardholder>
<amount>
<currency>EUR</currency>
<value>150</value>
</amount>
<product>
<name>Any product</name>
<url>http://any-url.com</url>
</product>
</charge>
</request>
</epxml>
This is the xml file to be --received from 3rd party--
<epxml>
<header>
<responsetype>direct</responsetype>
<mid>99</mid>
<type>charge</type>
</header>
<response>
<success>
<etan>6542335675</etan>
<tan>1971</tan>
<message>amount successful charged</message>
</success>
</response>
</epxml>
I will send you the 3rd parties web server address when you request it.
|
Clarification of Question by
moxyman-ga
on
06 Apr 2006 10:01 PDT
i more then doubled the price, i hope its worth it for some of you to
supply what should be a quick solution. Im not looking for all the
coding!! Im looking for the code that will take the xml and send it
to a server, and receive the xml back.. and some information (like
hints on how to use it, not the actual code, just give me some
pointers) on how to view teh contents of the received xml. But teh
biggie is simply sending the xml object and receiving the xml object.
|
Request for Question Clarification by
hummer-ga
on
06 Apr 2006 10:25 PDT
Hi moxyman,
I think this is what you need and it's nice because it includes explanations.
Communicating with the server HTTPRequest
"One of the cool things about XMLHTTP is the ability to post XML data
to an HTTP server or get XML back from an HTTP server."
http://www.topxml.com/xml/learnxml.asp#httprequest
"Receiving an XML DOMDocument object in VB
In the VB part of this example, the code to connect to the web server is:
- create the objects
Dim xmlHttp As new XMLHTTPRequest
Dim xmlDoc As DOMDocument
- open the POST (or GET) connection to the web server
xmlHttp.Open "POST", "http://localhost/xmlcode/demo.asp", False
- establish the connection
xmlHttp.Send
- receive the response - note there are different types of responses,
binary and text is also supported
Set xmlDoc = xmlHttp.responseXML
On the web server side, we will use some ASP in the demo.asp file
which is being called. Make sure your server side ASP file sets the
ContentType to "text/xml" and to send the XML back to the client, use:
<%
- make a variant object
Dim xmlDoc
- place the DOMDocument into the xmlDoc object
Set xmlDoc = Server.CreateObject("MSXML.DOMDocument")
- load the XML document object here
xmlDoc.load Server.MapPath("people.xml")
- set the content type to XML - note other types are supported
Response.contenttype = "text/xml"
- now send back the DOMDocument you have loaded above
response.write xmlDoc
%>
Now you have a simple VB application, which communicates with an ASP
file on a web server and receives a DOMDocument as a response."
How's that?
hummer
|
Clarification of Question by
moxyman-ga
on
06 Apr 2006 11:01 PDT
that code you supplied i have and works with vb in an asp page, but i
need it for an asp.net ".aspx" application.
the errors i show with the code provided: "xmlHttp declaration is
expected", "XMLHTTPRequest" is not defined, "DOMDocument is not
defined", and "set" is not uised anymore.
=============
- create the objects
Dim xmlHttp As new XMLHTTPRequest
Dim xmlDoc As DOMDocument
- open the POST (or GET) connection to the web server
xmlHttp.Open "POST", "http://localhost/xmlcode/demo.asp", False
- establish the connection
xmlHttp.Send
- receive the response - note there are different types of responses,
binary and text is also supported
Set xmlDoc = xmlHttp.responseXML
|