windows phone 7中Web服务调用参数异常错误

本文关键字:调用 参数 异常 错误 服务 Web phone windows | 更新日期: 2023-09-27 18:10:24

我正在为窗口电话调用asmx web服务。这是我的密码。当我执行这段代码时,它给我的错误是:

ArgumentException: Invalid appId参数名称:appId: ID=3010.V2_Soap.Translate.3C775314

    private void button1_Click(object sender, RoutedEventArgs e)
    {
        ServiceReference1.LanguageServiceClient myclient = new ServiceReference1.LanguageServiceClient();
        myclient.TranslateAsync(AppIdString, textBox1.Text, "en", "fr", "text/plain", "general");
        myclient.TranslateCompleted += new EventHandler<ServiceReference1.TranslateCompletedEventArgs>(translatecompleted);
    }
    private void translatecompleted(object obj, ServiceReference1.TranslateCompletedEventArgs e)
    { 
        textBlock1.Text = e.Result.ToString();
    }

windows phone 7中Web服务调用参数异常错误

我的问题解决了。错误是我没有把servicesoapclient在它。下面是正确的代码:

private void button1_Click(object sender, RoutedEventArgs e)
    {
        jomarzi.ServiceSoapClient obj = new jomarzi.ServiceSoapClient();
        obj.HelloWorldCompleted +=new EventHandler<jomarzi.HelloWorldCompletedEventArgs>(obj_HelloWorldCompleted);
        obj.HelloWorldAsync();

    }
    private void obj_HelloWorldCompleted(object sender, jomarzi.HelloWorldCompletedEventArgs e)
    {
        textBlock1.Text = e.Result;
    }