Hope this is the best forum for this, any suggestions for another are
appreciated.
I have a simple Compact Framework (2) app that sends some data to a web
service and acts despending on the response. I added the web service as a web
reference (in VS2005 VB) and then have a bit of code that calls the service
like this:
Dim webService As New com.companynamehere.webservices.CheckList
Dim wsCallback As New AsyncCallback(AddressOf ProcessCallBack)
webService.BeginSubmit(xmlForm, wsCallback, Nothing)
The ProcessCallBack function that handles the asynch result looks like this:
Sub ProcessCallBack(ByVal Response As IAsyncResult)
Dim responseCode As Integer
responseCode = webService.EndSubmit(Response)
End Sub
It appears to submit the data ok, but at the end of the call (EndSubmit) an
error is thrown in the code autogeneated by VS. The function that throws it
looks like this:
Public Function EndSubmit(ByVal asyncResult As System.IAsyncResult) As Integer
Dim results() As Object = Me.EndInvoke(asyncResult)
Return CType(results(0),Integer)
End Function
The error thrown is in the first line, in the Me.EndInvoke(asyncResult),
with the mysterious (to me) error:
System.ArgumentException was unhandled
Cannot write XML declaration. WriteStartDocument method has already written
it.
I can't seem to find any help on this error, no mention on the MS site or in
Google. I follow the basic problem, that it's trying to write the xml
declaration line but that it's already been written, but... well, obviously I
had nothing to do with it being written, and so am thrown as to what to do
here. Any ideas?
Much thanks in advance.