Home > Mobile >  WCF service keeps tempUri namespace
WCF service keeps tempUri namespace

Time:12-01

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.

CodePudding user response:

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.

  • Related