如何为消息类型中具有句点的服务生成有效的WCF代理?

时间:2012-11-29 20:40:55

标签: wcf soap wsdl rpc period

我正在连接我无法控制的Web服务,它有消息(输入/输出)和包含句点的动作(。)

当svcutil生成代理时,它包括:

[MessageContractAttribute(WrapperName="The.Request",...)]
public partial class TheRequest
{ ... }

[MessageContractAttribute(WrapperName="The.Response",...)]
public partial class TheResponse
{ ... }

为WSDL建模:

<wsdl:message name="The.Request">
    <wsdl:part name="Input" type="tns:InputType" />
</wsdl:message>
<wsdl:message name="The.Response">
    <wsdl:part name="Return" type="tns:Return" />
</wsdl:message>

运行代码时,收到错误消息:

RPC Message TheRequest in operation DoIt has an invalid body name Input. It must be TheRequest

堆栈追踪:

at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.OperationReflector.EnsureMessageInfos()    在System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.EnsureMessageInfos()    在System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.OperationReflector.get_Request()    在System.ServiceModel.Description.XmlSerializerOperationBehavior.CreateFormatter()    在System.ServiceModel.Description.XmlSerializerOperationBehavior.System.ServiceModel.Description.IOperationBehavior.ApplyClientBehavior(OperationDescription description,ClientOperation proxy)    在System.ServiceModel.Description.DispatcherBuilder.BindOperations(ContractDescription合同,ClientRuntime代理,DispatchRuntime调度)    在System.ServiceModel.Description.DispatcherBuilder.ApplyClientBehavior(ServiceEndpoint serviceEndpoint,ClientRuntime clientRuntime)    在System.ServiceModel.Description.DispatcherBuilder.BuildProxyBehavior(ServiceEndpoint serviceEndpoint,BindingParameterCollection&amp; parameters)    在System.ServiceModel.Channels.ServiceChannelFactory.BuildChannelFactory(ServiceEndpoint serviceEndpoint,Boolean useActiveAutoClose)    在System.ServiceModel.ChannelFactory.CreateFactory()

...

我找不到更改验证以接受邮件名称的方法。

任何人都可以告诉我该怎么做,或者至少指出我正确的方向?

感谢。

0 个答案:

没有答案