|
-
Jul 31st, 2012, 11:27 AM
#1
Thread Starter
New Member
VB.NET client app <--> ASP server... Problem comunicating
Hi.
I have an vb 2010 application who may send to an ASP server one XML file. This server application must do some changes and send back to the vb application the same xml file.
Do you know where is my problem?
SERVER :
My source code in vbscript :
Dim XMLDoc, XMLNode, XMLRoot, XMLErrorParse
Dim sResposta, sValue
Set XMLDoc = Server.CreateObject ("MSXML2.DOMDocument.4.0")
XMLDoc.async=false
XMLDoc.load(Request.BinaryRead(Request.TotalBytes))
set XMLErrorParse = XMLDoc.validate()
if XMLErrorParse.errorCode <> 0 then sResposta="ERROR: Invalid Request." & vbcrlf & XMLErrorParse.errorCode & ": " & XMLErrorParse.reason
if sResposta = "" then
set XMLRoot=XMLDoc.documentElement
if XMLRoot is nothing then
sResposta = "Invalid XML"
end if
end if
if sResposta="" then
set XMLNode = XMLRoot.selectSingleNode("TAGVALUE")
if XMLNode is nothing then
sResposta="ERROR: Invalid Tag Value (NOTHING)"
else
sValue=XMLNode.Text
if sValue="" then sResposta="ERROR: Empty Tag Value"
end if
end if
if sResposta="" then
sValue = "CORRECT"
else
sValue = sResposta
end if
set XMLNode = XMLRoot.selectSingleNode("RESPONSE")
XMLNode.Text = sValue
Response.ContentType = "text/xml"
XMLdoc.Save Response
CLIENT:
Dim oWebClient as System.Net.WebClient
Dim oFileResp As FileWebResponse
Dim oSentXML As Byte(), oResponseXML As Byte()
Dim sResponseXML As String = ""
Dim cUrl as String = "http://www.abc.pt/file.asp"
oWebClient.Headers.Add("Content-Type", "text/xml")
oSentXML = System.Text.Encoding.ASCII.GetBytes(XMLDocument.OuterXml)
oResponseXML = oWebClient.UploadData(cURL, "POST", oSentXML)
sResponseXML = Convert.ToBase64String(oResponseXML)
The Value of sResponseXML is "Error: Invalid File"
Note: I grant that the Original XML File is OK.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|