Web 服务中的 SoapException
我有一个选项卡控件。第一个选项卡有一个网格,其中一列是一个复选框。用户选择它并单击选项卡下的“下一步”,然后转到下一个选项卡。
我正在使用网络参考来获取值。当页面第一次加载时,引用起作用并且可以达到值,网格被绑定。
但是当我单击“下一步”时,会发生回发并尝试再次绑定网格,然后引用给出“SoapExpection”。详细信息如下:
->我选择一行然后单击“下一步”:
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
{
{
->名为 callObjects(int ID) 的函数(在 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]));
以及确切的错误: “SoapException:服务器无法处理请求。未将对象引用设置为对象的实例”
有任何想法、建议或...解决方案吗?提前致谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我使用用户名和密码访问继承自 System.Web.Services.Protocols.SoapHeader 的类中的 Web 引用。
我在 Page_Load 中定义了用户名和密码,但在我单击“下一步”后,它似乎正在清除这些值。所以我在 gridView_HtmlRowCreated 事件下做了同样的声明,它起作用了。
希望对像我这样的人有帮助。
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.