Hi i want to know how the skelton of Service created from a WSDL file
for example i have a created a simple WCF Service
IService.cs
using System;
using System.Data;
using System.ServiceModel;
[ServiceContract]
public interface IService
{
[OperationContract]
DataTable DoWork();
}
Service.cs
using System;
using System.Data;
using System.ServiceModel;
public class Service : IService
{
public DataTable DoWork()
{
DataTable dt = new DataTable();
DataRow dr = dt.NewRow();
dr["Name"] = "Tza";
dt.Rows.Add(dr);
dt.AcceptChanges();
return dt;
}
}
using System.Data;
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(ConfigurationName="IService")]
public interface IService
{
// CODEGEN: Parameter 'DoWorkResult' requires additional schema information that cannot be captured using the parameter mode. The specific attribute is 'System.Xml.Serialization.XmlElementAttribute'.
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IService/DoWork", ReplyAction="http://tempuri.org/IService/DoWorkResponse")]
[System.ServiceModel.XmlSerializerFormatAttribute()]
DoWorkResponse DoWork(DoWorkRequest request);
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
[System.ServiceModel.MessageContractAttribute(WrapperName="DoWork", WrapperNamespace="http://tempuri.org/", IsWrapped=true)]
public partial class DoWorkRequest
{
public DoWorkRequest()
{
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
[System.ServiceModel.MessageContractAttribute(WrapperName="DoWorkResponse", WrapperNamespace="http://tempuri.org/", IsWrapped=true)]
public partial class DoWorkResponse
{
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://tempuri.org/", Order=0)]
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
public System.Data.DataTable DoWorkResult;
public DoWorkResponse()
{
}
public DoWorkResponse(System.Data.DataTable DoWorkResult)
{
this.DoWorkResult = DoWorkResult;
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public interface IServiceChannel : IService, System.ServiceModel.IClientChannel
{
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class ServiceClient : System.ServiceModel.ClientBase<IService>, IService
{
public ServiceClient()
{
}
public ServiceClient(string endpointConfigurationName) :
base(endpointConfigurationName)
{
}
public ServiceClient(string endpointConfigurationName, string remoteAddress) :
base(endpointConfigurationName, remoteAddress)
{
}
public ServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
base(endpointConfigurationName, remoteAddress)
{
}
public ServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
base(binding, remoteAddress)
{
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
DoWorkResponse IService.DoWork(DoWorkRequest request)
{
return base.Channel.DoWork(request);
}
public System.Data.DataTable DoWork()
{
DoWorkRequest inValue = new DoWorkRequest();
DoWorkResponse retVal = ((IService)(this)).DoWork(inValue);
return retVal.DoWorkResult;
}
}
which is the skelton file for service if i am not wrong, but i dont know how do i create a skelton with above file which returns to me by svcutil command
orignal file contains simple neet and clean code but the code provide by svcutil is very long, i unable to understand
Please advice how i create a skelton from wsdl file
I dont want to use the service at client side. Every service has a wsdl file by using it we exposes service at client side, know about service methods etc.
but the reverse engineering using the wsdl file i want to create service which has the same method defintion as in service. (that mean the skelton of service)
i Google out how do i do that found the [svcutil .wsdl] command which returns me the above long
service.cs file & output.config file unfortunately the service.cs not understand by me, i am confuse how can i reuse the code
tahazubairah...
Participant
887 Points
798 Posts
create service skelton from WSDL file
Aug 07, 2012 10:09 AM|LINK
Hi i want to know how the skelton of Service created from a WSDL file
for example i have a created a simple WCF Service
IService.cs
using System; using System.Data; using System.ServiceModel; [ServiceContract] public interface IService { [OperationContract] DataTable DoWork(); }Service.cs
using System; using System.Data; using System.ServiceModel; public class Service : IService { public DataTable DoWork() { DataTable dt = new DataTable(); DataRow dr = dt.NewRow(); dr["Name"] = "Tza"; dt.Rows.Add(dr); dt.AcceptChanges(); return dt; } }Above service returns me the url: http://localhost/TestWCFService1/Service.svc?wsdl
For create skelton i try the command svcutil http://localhost/TestWCFService1/Service.svc?wsdl which returns me a service.cs and output.config file
using System.Data; [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.ServiceModel.ServiceContractAttribute(ConfigurationName="IService")] public interface IService { // CODEGEN: Parameter 'DoWorkResult' requires additional schema information that cannot be captured using the parameter mode. The specific attribute is 'System.Xml.Serialization.XmlElementAttribute'. [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IService/DoWork", ReplyAction="http://tempuri.org/IService/DoWorkResponse")] [System.ServiceModel.XmlSerializerFormatAttribute()] DoWorkResponse DoWork(DoWorkRequest request); } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] [System.ServiceModel.MessageContractAttribute(WrapperName="DoWork", WrapperNamespace="http://tempuri.org/", IsWrapped=true)] public partial class DoWorkRequest { public DoWorkRequest() { } } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] [System.ServiceModel.MessageContractAttribute(WrapperName="DoWorkResponse", WrapperNamespace="http://tempuri.org/", IsWrapped=true)] public partial class DoWorkResponse { [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://tempuri.org/", Order=0)] [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] public System.Data.DataTable DoWorkResult; public DoWorkResponse() { } public DoWorkResponse(System.Data.DataTable DoWorkResult) { this.DoWorkResult = DoWorkResult; } } [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] public interface IServiceChannel : IService, System.ServiceModel.IClientChannel { } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] public partial class ServiceClient : System.ServiceModel.ClientBase<IService>, IService { public ServiceClient() { } public ServiceClient(string endpointConfigurationName) : base(endpointConfigurationName) { } public ServiceClient(string endpointConfigurationName, string remoteAddress) : base(endpointConfigurationName, remoteAddress) { } public ServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : base(endpointConfigurationName, remoteAddress) { } public ServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : base(binding, remoteAddress) { } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] DoWorkResponse IService.DoWork(DoWorkRequest request) { return base.Channel.DoWork(request); } public System.Data.DataTable DoWork() { DoWorkRequest inValue = new DoWorkRequest(); DoWorkResponse retVal = ((IService)(this)).DoWork(inValue); return retVal.DoWorkResult; } }which is the skelton file for service if i am not wrong, but i dont know how do i create a skelton with above file which returns to me by svcutil command
orignal file contains simple neet and clean code but the code provide by svcutil is very long, i unable to understand
Please advice how i create a skelton from wsdl file
Thank you
Taha Zubair Ahmed
http://www.tahazubair.blogspot.com
Haixia Xie -...
Contributor
3022 Points
294 Posts
Microsoft
Re: create service skelton from WSDL file
Aug 08, 2012 08:04 AM|LINK
What do you mean with "skelton of Service "? If you want to using the service in client side, please take a look at my response in this thread:
http://forums.asp.net/p/1831146/5099577.aspx/1?p=True&t=634799951306763304
Best Regards,
Feedback to us
Develop and promote your apps in Windows Store
tahazubairah...
Participant
887 Points
798 Posts
Re: create service skelton from WSDL file
Aug 08, 2012 07:45 PM|LINK
I dont want to use the service at client side. Every service has a wsdl file by using it we exposes service at client side, know about service methods etc.
but the reverse engineering using the wsdl file i want to create service which has the same method defintion as in service. (that mean the skelton of service)
i Google out how do i do that found the [svcutil .wsdl] command which returns me the above long service.cs file & output.config file unfortunately the service.cs not understand by me, i am confuse how can i reuse the code
Taha Zubair Ahmed
http://www.tahazubair.blogspot.com