Consumo de servicio con objeto

//------------------------------------------------------------------------------ // <auto-generated> // Este código fue generado por una herramienta. // Versión de runtime:4.0.30319.0 // // Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si // se vuelve a generar el código. // </auto-generated> //------------------------------------------------------------------------------ namespace FoodCore.Service.Test.FoodService { using System.Runtime.Serialization; using System; [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] [System.Runtime.Serialization.DataContractAttribute(Name="User", Namespace="http://tempuri.org/")] [System.SerializableAttribute()] public partial class User : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged { [System.NonSerializedAttribute()] private System.Runtime.Serialization.ExtensionDataObject extensionDataField; private int IdUserField; [System.Runtime.Serialization.OptionalFieldAttribute()] private string EMailField; [System.Runtime.Serialization.OptionalFieldAttribute()] private string FirstNameField; [System.Runtime.Serialization.OptionalFieldAttribute()] private string LastNameField; [System.Runtime.Serialization.OptionalFieldAttribute()] private string PasswordField; [global::System.ComponentModel.BrowsableAttribute(false)] public System.Runtime.Serialization.ExtensionDataObject ExtensionData { get { return this.extensionDataField; } set { this.extensionDataField = value; } } [System.Runtime.Serialization.DataMemberAttribute(IsRequired=true)] public int IdUser { get { return this.IdUserField; } set { if ((this.IdUserField.Equals(value) != true)) { this.IdUserField = value; this.RaisePropertyChanged("IdUser"); } } } [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=1)] public string EMail { get { return this.EMailField; } set { if ((object.ReferenceEquals(this.EMailField, value) != true)) { this.EMailField = value; this.RaisePropertyChanged("EMail"); } } } [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=2)] public string FirstName { get { return this.FirstNameField; } set { if ((object.ReferenceEquals(this.FirstNameField, value) != true)) { this.FirstNameField = value; this.RaisePropertyChanged("FirstName"); } } } [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=3)] public string LastName { get { return this.LastNameField; } set { if ((object.ReferenceEquals(this.LastNameField, value) != true)) { this.LastNameField = value; this.RaisePropertyChanged("LastName"); } } } [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=4)] public string Password { get { return this.PasswordField; } set { if ((object.ReferenceEquals(this.PasswordField, value) != true)) { this.PasswordField = value; this.RaisePropertyChanged("Password"); } } } public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; protected void RaisePropertyChanged(string propertyName) { System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; if ((propertyChanged != null)) { propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); } } } [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.ServiceModel.ServiceContractAttribute(ConfigurationName="FoodService.FoodServiceSoap")] public interface FoodServiceSoap { // CODEGEN: Se está generando un contrato de mensaje, ya que el nombre de elemento appToken del espacio de nombres http://tempuri.org/ no está marcado para aceptar valores nil. [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ConnectionTest", ReplyAction="*")] global::FoodCore.Service.Test.FoodService.ConnectionTestResponse ConnectionTest(global::FoodCore.Service.Test.FoodService.ConnectionTestRequest request); [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ConnectionTest", ReplyAction="*")] System.Threading.Tasks.Task<global::FoodCore.Service.Test.FoodService.ConnectionTestResponse> ConnectionTestAsync(global::FoodCore.Service.Test.FoodService.ConnectionTestRequest request); // CODEGEN: Se está generando un contrato de mensaje, ya que el nombre de elemento usuario del espacio de nombres http://tempuri.org/ no está marcado para aceptar valores nil. [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/LoginUser", ReplyAction="*")] global::FoodCore.Service.Test.FoodService.LoginUserResponse LoginUser(global::FoodCore.Service.Test.FoodService.LoginUserRequest request); [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/LoginUser", ReplyAction="*")] System.Threading.Tasks.Task<global::FoodCore.Service.Test.FoodService.LoginUserResponse> LoginUserAsync(global::FoodCore.Service.Test.FoodService.LoginUserRequest request); // CODEGEN: Se está generando un contrato de mensaje, ya que el nombre de elemento usuario del espacio de nombres http://tempuri.org/ no está marcado para aceptar valores nil. [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/CreateUser", ReplyAction="*")] global::FoodCore.Service.Test.FoodService.CreateUserResponse CreateUser(global::FoodCore.Service.Test.FoodService.CreateUserRequest request); [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/CreateUser", ReplyAction="*")] System.Threading.Tasks.Task<global::FoodCore.Service.Test.FoodService.CreateUserResponse> CreateUserAsync(global::FoodCore.Service.Test.FoodService.CreateUserRequest request); } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] [System.ServiceModel.MessageContractAttribute(IsWrapped=false)] public partial class ConnectionTestRequest { [System.ServiceModel.MessageBodyMemberAttribute(Name="ConnectionTest", Namespace="http://tempuri.org/", Order=0)] public global::FoodCore.Service.Test.FoodService.ConnectionTestRequestBody Body; public ConnectionTestRequest() { } public ConnectionTestRequest(global::FoodCore.Service.Test.FoodService.ConnectionTestRequestBody Body) { this.Body = Body; } } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] [System.Runtime.Serialization.DataContractAttribute(Namespace="http://tempuri.org/")] public partial class ConnectionTestRequestBody { [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)] public string appToken; public ConnectionTestRequestBody() { } public ConnectionTestRequestBody(string appToken) { this.appToken = appToken; } } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] [System.ServiceModel.MessageContractAttribute(IsWrapped=false)] public partial class ConnectionTestResponse { [System.ServiceModel.MessageBodyMemberAttribute(Name="ConnectionTestResponse", Namespace="http://tempuri.org/", Order=0)] public global::FoodCore.Service.Test.FoodService.ConnectionTestResponseBody Body; public ConnectionTestResponse() { } public ConnectionTestResponse(global::FoodCore.Service.Test.FoodService.ConnectionTestResponseBody Body) { this.Body = Body; } } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] [System.Runtime.Serialization.DataContractAttribute(Namespace="http://tempuri.org/")] public partial class ConnectionTestResponseBody { [System.Runtime.Serialization.DataMemberAttribute(Order=0)] public int ConnectionTestResult; public ConnectionTestResponseBody() { } public ConnectionTestResponseBody(int ConnectionTestResult) { this.ConnectionTestResult = ConnectionTestResult; } } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] [System.ServiceModel.MessageContractAttribute(IsWrapped=false)] public partial class LoginUserRequest { [System.ServiceModel.MessageBodyMemberAttribute(Name="LoginUser", Namespace="http://tempuri.org/", Order=0)] public global::FoodCore.Service.Test.FoodService.LoginUserRequestBody Body; public LoginUserRequest() { } public LoginUserRequest(global::FoodCore.Service.Test.FoodService.LoginUserRequestBody Body) { this.Body = Body; } } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] [System.Runtime.Serialization.DataContractAttribute(Namespace="http://tempuri.org/")] public partial class LoginUserRequestBody { [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)] public string usuario; [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=1)] public string password; public LoginUserRequestBody() { } public LoginUserRequestBody(string usuario, string password) { this.usuario = usuario; this.password = password; } } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] [System.ServiceModel.MessageContractAttribute(IsWrapped=false)] public partial class LoginUserResponse { [System.ServiceModel.MessageBodyMemberAttribute(Name="LoginUserResponse", Namespace="http://tempuri.org/", Order=0)] public global::FoodCore.Service.Test.FoodService.LoginUserResponseBody Body; public LoginUserResponse() { } public LoginUserResponse(global::FoodCore.Service.Test.FoodService.LoginUserResponseBody Body) { this.Body = Body; } } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] [System.Runtime.Serialization.DataContractAttribute(Namespace="http://tempuri.org/")] public partial class LoginUserResponseBody { [System.Runtime.Serialization.DataMemberAttribute(Order=0)] public bool LoginUserResult; public LoginUserResponseBody() { } public LoginUserResponseBody(bool LoginUserResult) { this.LoginUserResult = LoginUserResult; } } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] [System.ServiceModel.MessageContractAttribute(IsWrapped=false)] public partial class CreateUserRequest { [System.ServiceModel.MessageBodyMemberAttribute(Name="CreateUser", Namespace="http://tempuri.org/", Order=0)] public global::FoodCore.Service.Test.FoodService.CreateUserRequestBody Body; public CreateUserRequest() { } public CreateUserRequest(global::FoodCore.Service.Test.FoodService.CreateUserRequestBody Body) { this.Body = Body; } } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] [System.Runtime.Serialization.DataContractAttribute(Namespace="http://tempuri.org/")] public partial class CreateUserRequestBody { [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)] public FoodCore.Service.Test.FoodService.User usuario; public CreateUserRequestBody() { } public CreateUserRequestBody(FoodCore.Service.Test.FoodService.User usuario) { this.usuario = usuario; } } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] [System.ServiceModel.MessageContractAttribute(IsWrapped=false)] public partial class CreateUserResponse { [System.ServiceModel.MessageBodyMemberAttribute(Name="CreateUserResponse", Namespace="http://tempuri.org/", Order=0)] public global::FoodCore.Service.Test.FoodService.CreateUserResponseBody Body; public CreateUserResponse() { } public CreateUserResponse(global::FoodCore.Service.Test.FoodService.CreateUserResponseBody Body) { this.Body = Body; } } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] [System.Runtime.Serialization.DataContractAttribute(Namespace="http://tempuri.org/")] public partial class CreateUserResponseBody { [System.Runtime.Serialization.DataMemberAttribute(Order=0)] public bool CreateUserResult; public CreateUserResponseBody() { } public CreateUserResponseBody(bool CreateUserResult) { this.CreateUserResult = CreateUserResult; } } [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] public interface FoodServiceSoapChannel : global::FoodCore.Service.Test.FoodService.FoodServiceSoap, System.ServiceModel.IClientChannel { } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] public partial class FoodServiceSoapClient : System.ServiceModel.ClientBase<global::FoodCore.Service.Test.FoodService.FoodServiceSoap>, global::FoodCore.Service.Test.FoodService.FoodServiceSoap { public FoodServiceSoapClient() { } public FoodServiceSoapClient(string endpointConfigurationName) : base(endpointConfigurationName) { } public FoodServiceSoapClient(string endpointConfigurationName, string remoteAddress) : base(endpointConfigurationName, remoteAddress) { } public FoodServiceSoapClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : base(endpointConfigurationName, remoteAddress) { } public FoodServiceSoapClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : base(binding, remoteAddress) { } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] global::FoodCore.Service.Test.FoodService.ConnectionTestResponse global::FoodCore.Service.Test.FoodService.FoodServiceSoap.ConnectionTest(global::FoodCore.Service.Test.FoodService.ConnectionTestRequest request) { return base.Channel.ConnectionTest(request); } public int ConnectionTest(string appToken) { global::FoodCore.Service.Test.FoodService.ConnectionTestRequest inValue = new global::FoodCore.Service.Test.FoodService.ConnectionTestRequest(); inValue.Body = new global::FoodCore.Service.Test.FoodService.ConnectionTestRequestBody(); inValue.Body.appToken = appToken; global::FoodCore.Service.Test.FoodService.ConnectionTestResponse retVal = ((global::FoodCore.Service.Test.FoodService.FoodServiceSoap)(this)).ConnectionTest(inValue); return retVal.Body.ConnectionTestResult; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] System.Threading.Tasks.Task<global::FoodCore.Service.Test.FoodService.ConnectionTestResponse> global::FoodCore.Service.Test.FoodService.FoodServiceSoap.ConnectionTestAsync(global::FoodCore.Service.Test.FoodService.ConnectionTestRequest request) { return base.Channel.ConnectionTestAsync(request); } public System.Threading.Tasks.Task<global::FoodCore.Service.Test.FoodService.ConnectionTestResponse> ConnectionTestAsync(string appToken) { global::FoodCore.Service.Test.FoodService.ConnectionTestRequest inValue = new global::FoodCore.Service.Test.FoodService.ConnectionTestRequest(); inValue.Body = new global::FoodCore.Service.Test.FoodService.ConnectionTestRequestBody(); inValue.Body.appToken = appToken; return ((global::FoodCore.Service.Test.FoodService.FoodServiceSoap)(this)).ConnectionTestAsync(inValue); } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] global::FoodCore.Service.Test.FoodService.LoginUserResponse global::FoodCore.Service.Test.FoodService.FoodServiceSoap.LoginUser(global::FoodCore.Service.Test.FoodService.LoginUserRequest request) { return base.Channel.LoginUser(request); } public bool LoginUser(string usuario, string password) { global::FoodCore.Service.Test.FoodService.LoginUserRequest inValue = new global::FoodCore.Service.Test.FoodService.LoginUserRequest(); inValue.Body = new global::FoodCore.Service.Test.FoodService.LoginUserRequestBody(); inValue.Body.usuario = usuario; inValue.Body.password = password; global::FoodCore.Service.Test.FoodService.LoginUserResponse retVal = ((global::FoodCore.Service.Test.FoodService.FoodServiceSoap)(this)).LoginUser(inValue); return retVal.Body.LoginUserResult; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] System.Threading.Tasks.Task<global::FoodCore.Service.Test.FoodService.LoginUserResponse> global::FoodCore.Service.Test.FoodService.FoodServiceSoap.LoginUserAsync(global::FoodCore.Service.Test.FoodService.LoginUserRequest request) { return base.Channel.LoginUserAsync(request); } public System.Threading.Tasks.Task<global::FoodCore.Service.Test.FoodService.LoginUserResponse> LoginUserAsync(string usuario, string password) { global::FoodCore.Service.Test.FoodService.LoginUserRequest inValue = new global::FoodCore.Service.Test.FoodService.LoginUserRequest(); inValue.Body = new global::FoodCore.Service.Test.FoodService.LoginUserRequestBody(); inValue.Body.usuario = usuario; inValue.Body.password = password; return ((global::FoodCore.Service.Test.FoodService.FoodServiceSoap)(this)).LoginUserAsync(inValue); } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] global::FoodCore.Service.Test.FoodService.CreateUserResponse global::FoodCore.Service.Test.FoodService.FoodServiceSoap.CreateUser(global::FoodCore.Service.Test.FoodService.CreateUserRequest request) { return base.Channel.CreateUser(request); } public bool CreateUser(FoodCore.Service.Test.FoodService.User usuario) { global::FoodCore.Service.Test.FoodService.CreateUserRequest inValue = new global::FoodCore.Service.Test.FoodService.CreateUserRequest(); inValue.Body = new global::FoodCore.Service.Test.FoodService.CreateUserRequestBody(); inValue.Body.usuario = usuario; global::FoodCore.Service.Test.FoodService.CreateUserResponse retVal = ((global::FoodCore.Service.Test.FoodService.FoodServiceSoap)(this)).CreateUser(inValue); return retVal.Body.CreateUserResult; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] System.Threading.Tasks.Task<global::FoodCore.Service.Test.FoodService.CreateUserResponse> global::FoodCore.Service.Test.FoodService.FoodServiceSoap.CreateUserAsync(global::FoodCore.Service.Test.FoodService.CreateUserRequest request) { return base.Channel.CreateUserAsync(request); } public System.Threading.Tasks.Task<global::FoodCore.Service.Test.FoodService.CreateUserResponse> CreateUserAsync(FoodCore.Service.Test.FoodService.User usuario) { global::FoodCore.Service.Test.FoodService.CreateUserRequest inValue = new global::FoodCore.Service.Test.FoodService.CreateUserRequest(); inValue.Body = new global::FoodCore.Service.Test.FoodService.CreateUserRequestBody(); inValue.Body.usuario = usuario; return ((global::FoodCore.Service.Test.FoodService.FoodServiceSoap)(this)).CreateUserAsync(inValue); } } }
Una demostración de como se define un objeto que se encuentra en el servicio web. (el código es generado automáticamente por Visual Studio)

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.