Ciao, tutto quello che devi rimuovere dalla classe affinchè sia compatibile con il compact framework, sono i metodi per le chiamate asincrone, perchè il CF non è in grado gestirle, poichè la tua applicazione non può fare uso delle strutture multithread disponibili in una applicazione desktop. Nel CF la tua applicazione ha 1 thread attivo ed uno soltanto. Non avrebbe quindi senso inserire il supporto alle chiamate async che richiedono l'utilizzo di più thread.
Devi aggiungere al tuo progetto un riferimento a System.Web.Services
Detto questo ecco come la tua classe deve essere modificata ( ho inserito un commento "=pp= removed" su tutte le parti che ho commentato per rendere la classe compatibile con il CF).
No ho potuto fare un test, se non verificare che la classe viene compilata in modo corretto, poichè non ho il WebService.
Ciao
//------------------------------------------------------------------------------
// <auto-generated>
// Il codice è stato generato da uno strumento.
// Versione runtime:2.0.50727.832
//
// Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se
// il codice viene rigenerato.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Serialization;
//
// Codice sorgente generato automaticamente da wsdl, versione=2.0.50727.42.
//
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="pieroTestHttpBinding", Namespace="http://DefaultNamespace")]
public partial class pieroTest : System.Web.Services.Protocols.SoapHttpClientProtocol {
// =pp= removed
//private System.Threading.SendOrPostCallback provaOperationCompleted;
/// <remarks/>
public pieroTest() {
this.Url = "http://carpoolsrv:8080/tryalWS/services/pieroTest";
}
// =pp= removed
///// <remarks/>
//public event provaCompletedEventHandler provaCompleted;
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://DefaultNamespace", ResponseNamespace="http://DefaultNamespace", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlElementAttribute("out", IsNullable=true)]
public System.Nullable<int> prova([System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] System.Nullable<int> in0, [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] System.Nullable<int> in1) {
object[ results = this.Invoke("prova", new object[ {
in0,
in1});
return ((System.Nullable<int>)(results[0]));
}
/// <remarks/>
public System.IAsyncResult Beginprova(System.Nullable<int> in0, System.Nullable<int> in1, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("prova", new object[ {
in0,
in1}, callback, asyncState);
}
/// <remarks/>
public System.Nullable<int> Endprova(System.IAsyncResult asyncResult) {
object[ results = this.EndInvoke(asyncResult);
return ((System.Nullable<int>)(results[0]));
}
// =pp= removed
///// <remarks/>
//public void provaAsync(System.Nullable<int> in0, System.Nullable<int> in1) {
// this.provaAsync(in0, in1, null);
//}
// =pp= removed
///// <remarks/>
//public void provaAsync(System.Nullable<int> in0, System.Nullable<int> in1, object userState) {
// if ((this.provaOperationCompleted == null)) {
// this.provaOperationCompleted = new System.Threading.SendOrPostCallback(this.OnprovaOperationCompleted);
// }
// this.InvokeAsync("prova", new object[ {
// in0,
// in1}, this.provaOperationCompleted, userState);
//}
// =pp= removed
//private void OnprovaOperationCompleted(object arg) {
// if ((this.provaCompleted != null)) {
// System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
// this.provaCompleted(this, new provaCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
// }
//}
// =pp= removed
///// <remarks/>
//public new void CancelAsync(object userState) {
// base.CancelAsync(userState);
//}
}
// =pp= removed
///// <remarks/>
//[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
//public delegate void provaCompletedEventHandler(object sender, provaCompletedEventArgs e);
// =pp= removed
///// <remarks/>
//[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
//[System.Diagnostics.DebuggerStepThroughAttribute()]
//[System.ComponentModel.DesignerCategoryAttribute("code")]
//public partial class provaCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
// =pp= removed
// private object[ results;
// =pp= removed
// internal provaCompletedEventArgs(object[ results, System.Exception exception, bool cancelled, object userState) :
// base(exception, cancelled, userState) {
// this.results = results;
// }
// =pp= removed
// /// <remarks/>
// public System.Nullable<int> Result {
// get {
// this.RaiseExceptionIfNecessary();
// return ((System.Nullable<int>)(this.results[0]));
// }
// }
//}