如果wsdl是这样的,我只能说是对方的WCF有问题。只能让对方改,你这边木有任何办法的。
你写的不是有吗?照着你写的把他写的修改下。
wsdl没法修改吧 ,生成的配置文件里也不知道该修改成什么
@Moulton: 我不是让你该客户端,而是让你改服务端,如果对方不愿意修改,你尝试直接添加服务引用看能得到代理类不?
@Launcher: 可以看到代理类就是配置文件里什么也没有生成
@Moulton: 代理类贴出来看看
@Launcher:
@Moulton:
@Moulton: 能给看个源码不,这样我猜不出来是Binding.
@Launcher:
namespace WindowsFormsApplication1.ServiceReference1 { 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="ResponseMessage", Namespace="")] [System.SerializableAttribute()] public partial class ResponseMessage : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged { [System.NonSerializedAttribute()] private System.Runtime.Serialization.ExtensionDataObject extensionDataField; [System.Runtime.Serialization.OptionalFieldAttribute()] private string ErrCodeField; [System.Runtime.Serialization.OptionalFieldAttribute()] private string ValueField; [global::System.ComponentModel.BrowsableAttribute(false)] public System.Runtime.Serialization.ExtensionDataObject ExtensionData { get { return this.extensionDataField; } set { this.extensionDataField = value; } } [System.Runtime.Serialization.DataMemberAttribute()] public string ErrCode { get { return this.ErrCodeField; } set { if ((object.ReferenceEquals(this.ErrCodeField, value) != true)) { this.ErrCodeField = value; this.RaisePropertyChanged("ErrCode"); } } } [System.Runtime.Serialization.DataMemberAttribute()] public string Value { get { return this.ValueField; } set { if ((object.ReferenceEquals(this.ValueField, value) != true)) { this.ValueField = value; this.RaisePropertyChanged("Value"); } } } 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(Namespace="Dfss", ConfigurationName="ServiceReference1.APPService")] public interface APPService { [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/DoWork", ReplyAction="Dfss/APPService/DoWorkResponse")] void DoWork(); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/Call", ReplyAction="Dfss/APPService/CallResponse")] string Call(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/GetTP", ReplyAction="Dfss/APPService/GetTPResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage GetTP(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/GetOrg2", ReplyAction="Dfss/APPService/GetOrg2Response")] string GetOrg2(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/GetOrg", ReplyAction="Dfss/APPService/GetOrgResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage GetOrg(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/GetOrgJson", ReplyAction="Dfss/APPService/GetOrgJsonResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage GetOrgJson(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/GetIndexBannerAndNews", ReplyAction="Dfss/APPService/GetIndexBannerAndNewsResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage GetIndexBannerAndNews(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/GetIndexBanner", ReplyAction="Dfss/APPService/GetIndexBannerResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage GetIndexBanner(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/GetIndexNews", ReplyAction="Dfss/APPService/GetIndexNewsResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage GetIndexNews(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/GetNewsList", ReplyAction="Dfss/APPService/GetNewsListResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage GetNewsList(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/GetNewsByID", ReplyAction="Dfss/APPService/GetNewsByIDResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage GetNewsByID(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/GetCerType", ReplyAction="Dfss/APPService/GetCerTypeResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage GetCerType(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/GetCarType", ReplyAction="Dfss/APPService/GetCarTypeResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage GetCarType(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/GetLessonType", ReplyAction="Dfss/APPService/GetLessonTypeResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage GetLessonType(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/GetTrainPrice", ReplyAction="Dfss/APPService/GetTrainPriceResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage GetTrainPrice(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/GetDepReg", ReplyAction="Dfss/APPService/GetDepRegResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage GetDepReg(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/GetBusLine", ReplyAction="Dfss/APPService/GetBusLineResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage GetBusLine(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/GetNewOrderID", ReplyAction="Dfss/APPService/GetNewOrderIDResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage GetNewOrderID(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/GetSMSValidCode", ReplyAction="Dfss/APPService/GetSMSValidCodeResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage GetSMSValidCode(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/CheckSMSValidCode", ReplyAction="Dfss/APPService/CheckSMSValidCodeResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage CheckSMSValidCode(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/GetOnlinePayType", ReplyAction="Dfss/APPService/GetOnlinePayTypeResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage GetOnlinePayType(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/SaveReg", ReplyAction="Dfss/APPService/SaveRegResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage SaveReg(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/StudentLogin", ReplyAction="Dfss/APPService/StudentLoginResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage StudentLogin(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/GetStudentInfo", ReplyAction="Dfss/APPService/GetStudentInfoResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage GetStudentInfo(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/ModifyPhone", ReplyAction="Dfss/APPService/ModifyPhoneResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage ModifyPhone(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/GetCarList", ReplyAction="Dfss/APPService/GetCarListResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage GetCarList(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/DatingCar", ReplyAction="Dfss/APPService/DatingCarResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage DatingCar(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/GetDatingCar", ReplyAction="Dfss/APPService/GetDatingCarResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage GetDatingCar(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/CancelCarByID", ReplyAction="Dfss/APPService/CancelCarByIDResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage CancelCarByID(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/GetStuPeriod", ReplyAction="Dfss/APPService/GetStuPeriodResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage GetStuPeriod(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/GetExam", ReplyAction="Dfss/APPService/GetExamResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage GetExam(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/GetCoachByStu", ReplyAction="Dfss/APPService/GetCoachByStuResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage GetCoachByStu(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/EvaluateCoach", ReplyAction="Dfss/APPService/EvaluateCoachResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage EvaluateCoach(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/CancelEvaluateCoach", ReplyAction="Dfss/APPService/CancelEvaluateCoachResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage CancelEvaluateCoach(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/ModifyPwd", ReplyAction="Dfss/APPService/ModifyPwdResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage ModifyPwd(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/GetNotifyMsg", ReplyAction="Dfss/APPService/GetNotifyMsgResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage GetNotifyMsg(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/GetBL", ReplyAction="Dfss/APPService/GetBLResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage GetBL(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/GetBLStop", ReplyAction="Dfss/APPService/GetBLStopResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage GetBLStop(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/GetKMQ", ReplyAction="Dfss/APPService/GetKMQResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage GetKMQ(string appToken, string dataString); [System.ServiceModel.OperationContractAttribute(Action="Dfss/APPService/GetKMA", ReplyAction="Dfss/APPService/GetKMAResponse")] WindowsFormsApplication1.ServiceReference1.ResponseMessage GetKMA(string appToken, string dataString); } [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] public interface APPServiceChannel : WindowsFormsApplication1.ServiceReference1.APPService, System.ServiceModel.IClientChannel { } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] public partial class APPServiceClient : System.ServiceModel.ClientBase<WindowsFormsApplication1.ServiceReference1.APPService>, WindowsFormsApplication1.ServiceReference1.APPService { public APPServiceClient() { } public APPServiceClient(string endpointConfigurationName) : base(endpointConfigurationName) { } public APPServiceClient(string endpointConfigurationName, string remoteAddress) : base(endpointConfigurationName, remoteAddress) { } public APPServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : base(endpointConfigurationName, remoteAddress) { } public APPServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : base(binding, remoteAddress) { } public void DoWork() { base.Channel.DoWork(); } public string Call(string appToken, string dataString) { return base.Channel.Call(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage GetTP(string appToken, string dataString) { return base.Channel.GetTP(appToken, dataString); } public string GetOrg2(string appToken, string dataString) { return base.Channel.GetOrg2(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage GetOrg(string appToken, string dataString) { return base.Channel.GetOrg(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage GetOrgJson(string appToken, string dataString) { return base.Channel.GetOrgJson(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage GetIndexBannerAndNews(string appToken, string dataString) { return base.Channel.GetIndexBannerAndNews(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage GetIndexBanner(string appToken, string dataString) { return base.Channel.GetIndexBanner(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage GetIndexNews(string appToken, string dataString) { return base.Channel.GetIndexNews(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage GetNewsList(string appToken, string dataString) { return base.Channel.GetNewsList(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage GetNewsByID(string appToken, string dataString) { return base.Channel.GetNewsByID(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage GetCerType(string appToken, string dataString) { return base.Channel.GetCerType(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage GetCarType(string appToken, string dataString) { return base.Channel.GetCarType(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage GetLessonType(string appToken, string dataString) { return base.Channel.GetLessonType(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage GetTrainPrice(string appToken, string dataString) { return base.Channel.GetTrainPrice(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage GetDepReg(string appToken, string dataString) { return base.Channel.GetDepReg(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage GetBusLine(string appToken, string dataString) { return base.Channel.GetBusLine(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage GetNewOrderID(string appToken, string dataString) { return base.Channel.GetNewOrderID(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage GetSMSValidCode(string appToken, string dataString) { return base.Channel.GetSMSValidCode(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage CheckSMSValidCode(string appToken, string dataString) { return base.Channel.CheckSMSValidCode(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage GetOnlinePayType(string appToken, string dataString) { return base.Channel.GetOnlinePayType(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage SaveReg(string appToken, string dataString) { return base.Channel.SaveReg(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage StudentLogin(string appToken, string dataString) { return base.Channel.StudentLogin(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage GetStudentInfo(string appToken, string dataString) { return base.Channel.GetStudentInfo(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage ModifyPhone(string appToken, string dataString) { return base.Channel.ModifyPhone(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage GetCarList(string appToken, string dataString) { return base.Channel.GetCarList(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage DatingCar(string appToken, string dataString) { return base.Channel.DatingCar(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage GetDatingCar(string appToken, string dataString) { return base.Channel.GetDatingCar(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage CancelCarByID(string appToken, string dataString) { return base.Channel.CancelCarByID(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage GetStuPeriod(string appToken, string dataString) { return base.Channel.GetStuPeriod(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage GetExam(string appToken, string dataString) { return base.Channel.GetExam(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage GetCoachByStu(string appToken, string dataString) { return base.Channel.GetCoachByStu(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage EvaluateCoach(string appToken, string dataString) { return base.Channel.EvaluateCoach(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage CancelEvaluateCoach(string appToken, string dataString) { return base.Channel.CancelEvaluateCoach(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage ModifyPwd(string appToken, string dataString) { return base.Channel.ModifyPwd(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage GetNotifyMsg(string appToken, string dataString) { return base.Channel.GetNotifyMsg(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage GetBL(string appToken, string dataString) { return base.Channel.GetBL(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage GetBLStop(string appToken, string dataString) { return base.Channel.GetBLStop(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage GetKMQ(string appToken, string dataString) { return base.Channel.GetKMQ(appToken, dataString); } public WindowsFormsApplication1.ServiceReference1.ResponseMessage GetKMA(string appToken, string dataString) { return base.Channel.GetKMA(appToken, dataString); } } }
@Moulton: 应该是比较简单的,自己写个配置文件,用 basicHttpBinding 就行了。
@Launcher:那 name填什么呢?
@Moulton:
1 <configuration>
2 <system.serviceModel>
3 <bindings>
4 <basicHttpBinding>
5 <binding name="Moulton">
8 <security mode="None" />
9 </binding>
10 </basicHttpBinding>
11 </bindings>
12 <client>
13 <endpoint address="http://localhost/APPService.svc"
14 binding="basicHttpBinding" bindingConfiguration="Moulton"
15 contract="ServiceReference1.APPService" name="Moulton_APPService" />
16 </client>
17 </system.serviceModel>
18 </configuration>
@Launcher: 不行。。。
@Moulton: 提示啥错误?
@Moulton: 你把服务地址贴出来,我测试看看。
他是不是在服务的操作上面加[operationContract]呀
他是不是在服务的操作上面没有加[OperationContract]呀