Web服务调用窗口电话7中的参数异常错误

时间:2013-04-23 10:52:24

标签: c# web-services windows-phone-7

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

  

ArgumentException:无效的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();
    }

1 个答案:

答案 0 :(得分:0)

我解决了我的问题。错误是我没有将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;
    }