Solved

New to Web Services

Posted on 2009-04-02
3
177 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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

636 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