2012-03-30 50 views
0

上缺少名称空间我们在Windows服务中托管了我们的WCF Web服务。我们正在使用basicHttpBinding。我们需要保持与SOAP 1.1 Web服务的向后兼容性。我们的问题是缺少web方法参数中元素EPTalkMessage上的名称空间。我搜索了很多,但我没有找到一种方法来给这个元素添加命名空间。从旧的Web服务Wcf向后兼容性问题 - 方法参数

肥皂是:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> 
<s:Header> 
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://aaa.sk/EPTalk/IssueDocument</Action> 
</s:Header> 
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
<IssueDocument xmlns="http://aaa.sk/EPTalk"> 
    <EPTalkMessage xmlns="http://aaa.sk/EPTalk/ToSignInput" /> 
</IssueDocument> 
</s:Body> 
</s:Envelope> 

新生成的SOAP是:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> 
    <s:Header> 
    <Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://aaa.sk/EPTalk/IssueDocument</Action> 
    </s:Header> 
    <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
    <IssueDocument xmlns="http://aaa.sk/EPTalk"> 
     <EPTalkMessage /> 
    </IssueDocument > 
    </s:Body> 
</s:Envelope> 

服务的签名如下:

[ServiceContract (Namespace = "http://aaa.sk/EPTalk")] 
[XmlSerializerFormat(Use = OperationFormatUse.Literal, Style = OperationFormatStyle.Document)] 
public interface IRegistryInputWebService 
{ 
    [OperationContract(Action = "http://aaa.sk/EPTalk/IssueDocument")] 
    RegistryServiceResult IssueDocument([MessageParameter(Name = "EPTalkMessage")] 
     UpvsPortalEmulator.ToSignInput.EPTalkMessage message); 
} 

绑定:

BasicHttpBinding 
{     
MaxReceivedMessageSize = 1024 * 1024 * 10, 
MaxBufferSize = 1024 * 1024 * 10, 
ReaderQuotas = 
       { 
       MaxArrayLength = 1024 * 1024 * 10, 
       MaxStringContentLength = 1024 * 1024 * 10 
       }, 
MessageEncoding = WSMessageEncoding.Text, 
Security = new BasicHttpSecurity 
       { 
       Mode = BasicHttpSecurityMode.None 
       } 
}; 

已编辑:已添加EPTalkMessage定义。

[XmlType, XmlRoot (ElementName = "EPTalkMessage", Namespace = Declarations.SchemaVersion, IsNullable = false), Serializable] 
    public class EPTalkMessage 
{ 
} 

非常感谢您的帮助

回答

0

搜索一段时间后,我决定用MessageContracts这个问题。