【发布时间】:2010-01-05 11:21:47
【问题描述】:
嗨,
我的工作是创建一个网络服务,它充当我们拥有的另一个网络服务,因此客户不会注意到其中的差异。我创建了整个 web 服务,它在我使用它时运行良好,并且输出都是相同的。问题是,我创建了一个使用旧 Web 服务的客户端应用程序,如果我将 Web 引用的 url 更改为新服务并重试,我会收到错误:
System.Web.Services.Protocols.SoapException: 服务器无法识别 HTTP 标头 SOAPAction
如果我查看我的两个 Web 服务中 Reference.cs 的差异,我会发现属性存在细微差异,我认为这是问题所在。
新服务:
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.3053")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="SprWebServiceSoap", Namespace="http://ws.hl7.trispark.com/")]
public partial class SprWebService : System.Web.Services.Protocols.SoapHttpClientProtocol {
旧服务:
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.3053")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="SprWebServiceRemoteBinding", Namespace="http://ws.hl7.trispark.com/")]
public partial class SprWebService : System.Web.Services.Protocols.SoapHttpClientProtocol {
而且使用的方法也不同:
新:
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://ws.hl7.trispark.com/invoke", RequestNamespace="http://ws.hl7.trispark.com/", ResponseNamespace="http://ws.hl7.trispark.com/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public invokeResponse invoke(invoke inv) {
旧:
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare)]
[return: System.Xml.Serialization.XmlElementAttribute("invokeResponse", Namespace="http://ws.hl7.trispark.com/types")]
public invokeResponse invoke([System.Xml.Serialization.XmlElementAttribute("invoke", Namespace="http://ws.hl7.trispark.com/types")] invoke invoke1) {
首先我认为问题可能是我的版本是在 vs2008 中创建的,而旧版本是在 vs2005 中创建的,所以我在 2005 年重新创建了它,但这并没有改变任何东西。
问题是我没有旧代码的代码,所以我看不到使用了哪些特定属性。
有人知道我必须设置哪些属性才能获得相同的东西吗?
非常感谢!
【问题讨论】:
标签: c# soap web-services reference