我尝试调用时出现Web服务错误 [英] Webservice Error when i try to invoke

查看:84
本文介绍了我尝试调用时出现Web服务错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



这是Windows应用程序的代码,很简单地创建了四个文本框和按钮.

获取用户名,密码和日期将此字符串传递给我的Web服务,并从Web服务获取结果并将其存储在结果文本框中.

Hi,

This the windows application code,very simple create four text box and button.

getting user name,password and date pass this string to my webservice and get the result from webservice and store those in the result text box.

namespace CallWebService
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
        }
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
        }
        private void textBox2_TextChanged(object sender, EventArgs e)
        {
        }
        private void button1_Click(object sender, EventArgs e)
        {
            String username, pwd, date;
            username = textBox1.ToString();
            pwd = textBox2.ToString();
            date = textBox3.ToString();

        }
    }
}





但是当我尝试在按钮中调用我的Web服务时,单击它甚至不会调用我要调用的方法.


以下是我想在Windows应用程序中调用的方法





but when i try to invoke my webservice in my button click its not even calling the method i want to invoke.


below is the method i wanna invoke in my windows application

public EmployeeExport[] ExportEmployees(string LoginName, string Password, [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] System.Nullable<System.DateTime> LastExport, out string ErrorMessage) {
    object[] results = this.Invoke("ExportEmployees", new object[] {
                LoginName,
                Password,
                LastExport});
    ErrorMessage = ((string)(results[1]));
    return ((DLAEmployeeExport[])(results[0]));
}



此Web服务正在使用的名称空间是

命名空间WService"

在我的代码中,我试图像下面这样调用

WService.EmployeeExport(并传递字符串).

但是它没有显示方法EmployeeExport.

任何帮助!请



The namespace am using for this webservice is

"namespace WService "

In my code i was trying to call like below

WService.EmployeeExport (and pass the string).

But its not show the method EmployeeExport.

Any Help ! please

推荐答案

检查WebMethod属性

http://msdn.microsoft.com/en-us/library/byxd99hx (v = VS.90).aspx [
Check the WebMethod Attribute

http://msdn.microsoft.com/en-us/library/byxd99hx(v=VS.90).aspx[^]


这篇关于我尝试调用时出现Web服务错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆