日期:2014-05-17  浏览次数:20843 次

Wince 如何动态引用webservice呀?
wince项目需要引用webservice,但是webserevice地址是动态的,我在winform项目可以用实现,但是在wince项目不行?有会的吗?请给予帮助,谢谢!
public static object InvokeWebService(string url,  string classname, string methodname, object[] args)
         {
             //string @namespace = "TrainingSite.PDAWebservice";
             string @namespace = "s的";
            if((classname == null) ||(classname == ""))
             {
                 classname = GetWsClassName(url) ;
             }

            try
             {
                //获取WSDL
                 WebClient wc                   = new WebClient();
                 Stream stream                  = wc.OpenRead(url+"?WSDL");
                 ServiceDescription sd          = ServiceDescription.Read(stream);
                 ServiceDescriptionImporter sdi = new ServiceDescriptionImporter();
                 sdi.AddServiceDescription(sd,"","");
                 CodeNamespace cn                = new CodeNamespace(@namespace);
                
                //生成客户端代理类代码
                 CodeCompileUnit ccu             = new CodeCompileUnit();
                 ccu.Namespaces.Add(cn);
                 sdi.Import(cn ,ccu); 
                 CSharpCodeProvider csc          = new CSharpCodeProvider();
                 ICodeCompiler icc               = csc.CreateCompiler();
   &n