简体   繁体   中英

WCF service keeps tempUri namespace

So I need to create some WCF services for legacy clients.

The thing is, after generating the contract from wdsl file, I'm getting deserialization errors because the service is expecting the http://tempuri.org/ namespace, even tho, the proper namespace is in the contract.

Heres the configuration for service:

    <services>
        <service name="SystemNotificationHandling.Services.NotificationHandling">
            <endpoint address="" binding="basicHttpBinding" bindingConfiguration="secureHttpBinding" contract="INotificationHandlingBinding"/>
        </service>
    </services>

    <bindings>
        <basicHttpBinding>
            <binding name="secureHttpBinding">
                <security mode="Transport">
                    <transport clientCredentialType="None"/>
                </security>
            </binding>
        </basicHttpBinding>
    </bindings>
    
    <behaviors>
        <serviceBehaviors>
            <behavior>
                <serviceMetadata httpGetEnabled="false" httpsGetEnabled="false" />
                <serviceDebug includeExceptionDetailInFaults="true" />
            </behavior>
        </serviceBehaviors>
    </behaviors>

And here is the contract:

    [ServiceContract]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.8.3928.0")]
    [System.Web.Services.WebServiceBindingAttribute(Name="NotificationHandlingBinding", Namespace="http://xx.com/fake/1.0")]
    [System.Xml.Serialization.XmlIncludeAttribute(typeof(ResponseMessage))]
    [System.Xml.Serialization.XmlIncludeAttribute(typeof(Header))]
    [System.Xml.Serialization.XmlIncludeAttribute(typeof(NotificationRequestMessage))]
    public interface INotificationHandlingBinding 
    {
        
        [OperationContract]
        [System.Web.Services.WebMethodAttribute()]
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://xx.com/fake/1.0/notifyEvent", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare)]
        [return: System.Xml.Serialization.XmlElementAttribute("NotifyEventResponse", Namespace="http://xx.com/fake/1.0")]
         NotifyEventResponse notifyEvent([System.Xml.Serialization.XmlElementAttribute(Namespace="http://xx.com/fake/1.0")] NotifyEventRequest NotifyEventRequest);
        
    }

Thanks for any help.

So it turns out, the contract generation was faulty. We generated contract again via svcutil and this time it added namespaces to the OperationContract attribute and ServiceContract attribute.

Thanks Lan Huang, your comment kinda pointed me to right direction.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM