List Info

Thread: Problem with classes in a web service




Problem with classes in a web service
user name
2006-12-05 17:13:40
I'm trying to create a web service that exposes a class.
Below is a
simplified example.
The web service has the following code (detail removed):

<WebService(...)><WebServiceBinding(...)> Public
Class MyClass
            Inherits System.Web.Services.WebService

            <WebMethod()> Public Sub MySub()
                        Dim z As MyExposedClass
            End Sub

End Class

Public Class MyExposedClass
            Public sValue As String
End Class

Obviously this isn't doing anything useful, but it shouldn't
be
doing anything illegal either. When I try to use this in
another app, I
get the following results:

Dim cTest As New compasstwo.MyClass   ' Initialize the class
cTest.Credentials =
System.Net.CredentialCache.DefaultCredentials   '
Pass credentials

Dim z As cTest.MyExposedClass   ' This statement works fine

cTest.MySub()   ' This call fails: "The request failed
with HTTP
status 401: Unauthorized."

Why is it that I can create a variable of type
MyExposedClass in the
calling app, but I can't do the same thing in the web
service? I'm
sure I'm missing something. Any thoughts?


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the
Google Groups "ASP.Net Community" group.
To post to this group, send email to aspnetgooglegroups.com
To unsubscribe from this group, send email to
aspnet-unsubscribegooglegroups.com
For more options, visit this group at http
://groups-beta.google.com/group/aspnet?hl=en
-~----------~----~----~----~------~----~------~--~---

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )