hi,
I have a webservice created with asp, which is:
Imports System
Imports System.IO
Imports System.Text
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols<System.Web.Script.Services.ScriptService()><WebService(Namespace:="http://tempuri.org/")><WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)><Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Public Class WBS_Actions
Inherits System.Web.Services.WebService<WebMethod()>
Public Sub TrackAction(byval sText as string)
Dim path As String = "c:\MyTest.txt"
Using fs As FileStream = File.Create(path)
Dim info As Byte() = New UTF8Encoding(True).GetBytes(sText)
' Add some information to the file.
fs.Write(info, 0, info.Length)
End Using
End Sub
End ClassOn anoter website, I have a JS that calls this webservice like this:
function ActionDone() {
var xhr = new XMLHttpRequest();
xhr.open('POST', 'http://localhost:57358/WBS_Actions.asmx/TrackAction', true);
xhr.setRequestHeader('Content-type', 'text/plain');
xhr.send("test");
}Now, the issue is that the file is not created with that code. Instead, if I changed the webservice to the code below, the file is created, but I am missing the option to send data from JS to the webservice.
Public Sub TrackAction()
Dim path As String = "c:\MyTest.txt"
Using fs As FileStream = File.Create(path)
Dim info As Byte() = New UTF8Encoding(True).GetBytes("This is my text")
' Add some information to the file.
fs.Write(info, 0, info.Length)
End Using
End SubAny help would be much appreciated, thanks!
imendimu