C# 无法分析soap 1.1消息wcf客户端
大家好,我正在通过WCF客户端使用ApacheAxis上构建的SOAP1.1服务。问题是,WCF的内置反序列化程序并没有解析错误和正常响应,当通过WCF客户端调用web操作时,我遇到了一个与XML解析相关的异常。当我检查消息时,我得到以下信息:C# 无法分析soap 1.1消息wcf客户端,c#,.net,wcf,axis,soap-client,C#,.net,Wcf,Axis,Soap Client,大家好,我正在通过WCF客户端使用ApacheAxis上构建的SOAP1.1服务。问题是,WCF的内置反序列化程序并没有解析错误和正常响应,当通过WCF客户端调用web操作时,我遇到了一个与XML解析相关的异常。当我检查消息时,我得到以下信息: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<s:Header xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" />
<soapenv:Body>
<V2Response xmlns="urn:ETS">
<V2Return xsi:type="ns1:TResponse" xmlns:ns1="urn:ETS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<fulfilmentRef></fulfilmentRef>
<paymentRef></paymentRef>
<statusCode>2013</statusCode>
<statusDescription>ePayments: Invalid client password specified in request.</statusDescription>
<transactionId xsi:nil="true" />
<transactionTimeStamp>2013-06-21T08:22:16.483Z</transactionTimeStamp>
</V2Return>
</V2Response>
</soapenv:Body>
</soapenv:Envelope>
2013
ePayments:请求中指定的客户端密码无效。
2013-06-21T08:22:16.483Z
我得到的例外情况是:
> The specified type was not recognized: name='TResponse', namespace='urn:ETS', at <V2Return xmlns='urn:ETS'>
>无法识别指定的类型:name='treponse',namespace='urn:ETS',位于
我在
Reference.cs
中有一个有效的treesponse
类,请告诉我是否可以通过更改配置来处理此问题,我希望WCF客户端能够解析任何soap消息,但它无法,我无法在服务器端更改任何内容,这是第三方api。我可以通过在svcutil.exe生成的代理类中手动更改名称空间来解决此问题。“TResponse”类在代理代码中定义了一些不同的名称空间,当我将名称空间更改为urn:ETS时,soap响应很容易反序列化到类中。在此之前,我已经检查了来自SoapUI的响应,并验证了soap响应,一切看起来都很完美,然后我继续搜索,找到了。在再次阅读异常之后,我意识到问题出在名称空间中
以下是我所做的改变:
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.4927")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://axis.webservices.api.etransactions")]
public partial class TResponse : object, System.ComponentModel.INotifyPropertyChanged {
........
//
[System.CodeDom.Compiler.GeneratedCodeAttribute(“System.Xml”,“2.0.50727.4927”)]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute(“代码”)]
[System.Xml.Serialization.XmlTypeAttribute(命名空间=”http://axis.webservices.api.etransactions")]
公共部分类响应:对象,System.ComponentModel.INotifyPropertyChanged{
........
我用“urn:ETransactionsService”替换了“”,它成功了:)!您的服务有WSDL吗?是的,我有WSDL,我正在.Net项目V2Return中添加服务引用,该项目继承自TreResponse?TreResponse是一个名为V2Return的对象