There is an error in XML document (1, 220).

chrha22

Member
Joined
Jun 22, 2006
Messages
5
Programming Experience
3-5
Hi There.

I've developed a webservice that makes a structured return.

The webservice code is as follows:

VB.NET:
Public Class DiskInfo
     Public Size As Int64
     Public FreeSpace As Int64
End Class 'DiskInfo
 
<WebMethod()> _
Public Function GetDiskInfo() As DiskInfo
     Dim volumeHandling As New GetFreeDiskSpace("C:")
     Dim DiskInfo As New DiskInfo()
     DiskInfo.Size = volumeHandling.Size
     DiskInfo.FreeSpace = volumeHandling.FreeSpace
     Return DiskInfo
End Function 'DiskInfo

The return - when testing in browser - is:

VB.NET:
 <?xml version="1.0" encoding="utf-8" ?> 
[URL="http://www.printwebshop.com/FreeDiskSpace/FreeDiskSpace.asmx/GetDiskInfo#"]-[/URL]    <DiskInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
          <Size>37005500416</Size> 

          <FreeSpace>3090935808</FreeSpace> 

  </DiskInfo>

So far everything looks great, right? But when the webservice is called from my code with:

VB.NET:
Dim DiskInfo As New com.printwebshop.www.Service
DiskInfo.Proxy = ProxyCredential()
MessageBox.Show(DiskInfo.GetDiskInfo.FreeSpace.ToString)

I get this error:
There is an error in XML document (1, 220).

The webservice is placed here: http://www.printwebshop.com/FreeDiskSpace/FreeDiskSpace.asmx

Any help is appriciated!

Bg's
Christoffer
 
Works fine when I try it, without the ProxyCredential() function which I don't know what is, so that must be the source of the error. Try out the webservice consume without that code line.
 
UserControl

Hi John H.

You are quite a frequent flyer on vbdotnetforums.com ;o)

I've got i little further on finding the error.

It seems that I only get the error when connecting to the webservice through my winforms UserControl. Tracing the WSE doesn't help me because absolutely nothing is being traced.

I have success in using the webreference in ASP.NET as well. It is really strange.

Is webservice handling different in UserControls?

Thankyou for spending time on fixing the issue!
 
chrha22 said:
Is webservice handling different in UserControls?
I don't know any reason it should.. When I tested your webservice I used a Windows Application project. It is not the control that makes the web reference, but the project, so I'm not sure what you mean by handling is different in usercontrols. If you mean that the usercontrol is contained in a Class Library project that got the web reference, and that the class library is referenced by a Windows/Web Application project, then this is not a problem, accessing a webservice from a class library is no different and works fine (This was also tested with your webservice).
 
Back
Top