Solved

New to Web Services

Posted on 2009-04-02
3
176 Views
Last Modified: 2012-05-06
I need help creating and consuming Web Services internally. These are steps I did.  

1.

created a function to fill dataset  on webapp1 (for web services)


   <WebMethod()> _
    Public Function MyDataset() As DataSet

        Dim constr As String = WebConfigurationManager.ConnectionStrings("myConnectionString").ToString
        Dim con As New SqlConnection(constr)
        Dim ad As New SqlDataAdapter("select *from mytable", con)
        Dim ds As New DataSet

        ad.Fill(ds)

        Return (ds)



    End Function

2. created a proxy class  on my webapp2

   - added a Web Reference then

     on aspx page  


Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Dim xyz As New Test

        Me.GridView1.DataSource = xyz.MyDataset     <<<<<<<< error The request failed with HTTP status 401: Unauthorized. ???
        Me.GridView1.DataBind()


    End Sub

these are internal web application on my server.
0
Comment
Question by:VBdotnet2005
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 6

Accepted Solution

by:
Ramone_Hamilton earned 250 total points
ID: 24055814
You need to make sure that you set the credentials for your web service.  I'm not exactly sure how to do it in vb, but in C# it would be:

xyz.Credentials = new NetworkCredential("username","password");
0
 
LVL 4

Expert Comment

by:y0usuf
ID: 24055825
Add this in the web.config
<identity impersonate="true"></identity>
0
 
LVL 9

Assisted Solution

by:VikramMullick
VikramMullick earned 250 total points
ID: 24056512
you have to add Default credentials
Dim myProxy As localhost.webapp1 = New localhost.webapp1 ()
myProxy.Credentials = System.Net.CredentialCache.DefaultCredentials
http://support.microsoft.com/kb/813834
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question