.Net RESTful Web Service: sending xml file



I'm trying to send an xml file containing a list of files to a restful webservices. It 'a project in vb.net. The function that passes the data to the web services is the following:



Private Function SendActivityToWEBSERVICE(ByVal xmlFile As String) As Boolean
Try
sUri = "http://localhost:35299/LiveUpdateWS/SincronizzaAttivita?d=" + xmlFile.ToString()

Dim req As HttpWebRequest = WebRequest.Create(sUri.ToString())
req.Method = "GET"
req.KeepAlive = False

Dim response As HttpWebResponse = req.GetResponse()
Try
Dim xmlDoc As New Xml.XmlDocument
xmlDoc.Load(response.GetResponseStream())

Catch exc As XmlException
Console.WriteLine("Eccezione " + exc.Message)
Return False
End Try

Catch ex As Exception
Console.WriteLine("Eccezione " + ex.Message)
Return False
End Try
Return True
End Function


The interface of web services is as follows:



<OperationContract>
<WebGet(UriTemplate:="SincronizzaAttivita?d={sXMLFile}")>
Function SaveDataPost(sXMLFile As String) As Boolean


If the xml file that I am sending is of small size everything works fine. If I try to send large files I get the error 404.15. I saw that to send strings or data of a certain size to a web services is recommended to use POST instead of GET. To me it is unclear how to modify the above code to do it, always that this is the solution to my problem. Can you tell me what and how to change the code?


No comments:

Post a Comment