I have developed a custom asmx webservice and deployed successfully on my url and on browser ive checked and working perfect. Now I want to consume in my Visual WebParts code behind ..to do this Ive added Service Reference..defined web reference also and include that web reference in using section. when I go to instantiate the webservice i cannot like when i type mProxy the intellisense does not show up..it looks like object declaration has some problems. why is that

here is the code

using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data;
using Microsoft.SharePoint;
using System.Collections.Generic;
using Microsoft.SharePoint.WebControls;
using S_Portal_WebParts.SPWebService;
namespace S_Portal_WebParts.NewPurchaseRequisition
    public partial class NewPurchaseRequisitionUserControl : UserControl
        SPWebService.OraSPDataXchange myProxy = new SPWebService.OraSPDataXchange();

First check if intellisense shows up for other .NET classes. If not, you may need to restart the visual studio.

If still the problem is there, Try to build the proxy class using svcutil (and not service\web reference).You can manually add the generated proxy(.cs) and config files to your project. Below is the example :

svcutil.exe /language:cs /out:generatedProxy.cs /config:app.config http://localhost:8000/ServiceModelSamples/service
| improve this answer | |

Sometimes intellisense doesnt pick it up. Try:

Save and exit project. Goto folder and delete the bin files (debug and release) open project and rebuild. Try now.

Also when you were adding the webservice and clicked to discover what did you see? did you see your new method?

You can right click the webservice name OraSPDataXchange and select "Go to definition", check that it has you code. If not then rebuild the webservice and try again.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.