kubilay
kubilay

Reputation: 5330

SoapException In Web Service

I have a tab control. 1st tab has a grid, one of the columns is a checkbox. The user selects it and clicks "Next" under the tab, then goes to next tab.

I'm using a web reference to get the values. When the page loads for first time, the reference works and the values can be reached, the grid gets binded.

But when I click on "Next", postback happens and it tries to bind the grid again, then the reference gives "SoapExpection". Here are details:

-> I select a row then click "Next":

protected void gridView_HtmlRowCreated(object sender, ASPxGridViewTableRowEventArgs e)
        {
            if (e.RowType == GridViewRowType.Data)
            {
                   //bla bla bla
                   //I get the error here:
                   ClassEntity tmpObjects = webService.callObjects(rowID);
                   //bla bla bla
            {
        {

-> And the function named callObjects(int ID) (In Reference.cs)

[System.Web.Services.Protocols.SoapDocumentMethodAttribute("...", RequestNamespace="...", ResponseNamespace="...", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public ClassEntity callObjects(int ID) {
            object[] results = this.Invoke("callObjects", new object[] {
                        ID});
            return ((ClassEntity)(results[0]));

And the exact error: "SoapException: Server was unable to process request. Object reference not set to an instance of an object"

Any ideas, suggestions or... Solutions? Thanks in advance.

Upvotes: 0

Views: 372

Answers (1)

kubilay
kubilay

Reputation: 5330

I was using username and password to reach the web reference in a class that inheritences from System.Web.Services.Protocols.SoapHeader.

I was defining username and password in Page_Load, but it seems it was cleaning these values after I click to "Next". So I made same declerations under gridView_HtmlRowCreated event, and it worked.

Hope that helps anybody like me.

Upvotes: 1

Related Questions