Error: Cannot import wsdl:portType ... it does not match imported DataContract

Unanswered Error: Cannot import wsdl:portType ... it does not match imported DataContract

  • Saturday, March 01, 2008 2:14 PM
     
     

    Hi, when i try to use svcutil to generate a client, reusing types i get this error:

     

    Command line:

    Code Snippet
    C:\Proyectos\DotNet\TFS\Juridico\Main\Source\Desktop\ConMega.Juridico.Presentati
    on\ConMega.Juridico.Presentation\Service References>svcutil /r:c:\Proyectos\DotN
    et\TFS\Juridico\Main\Source\Services\ConMega.Juridico.WinFormServiceManager\ConM
    ega.Juridico.WinFormServiceManager\bin\Debug\ConMega.Juridico.Base.dll http://lo
    calhost:4040/AbogadoService?wsdl
    <P< A>

     

    Error:

    Code Snippet
    Error: Cannot import wsdl:portType
    Detail: An exception was thrown while running a WSDL import extension: System.Se
    rviceModel.Description.DataContractSerializerMessageContractImporter
    Error: Referenced type 'ConMega.Juridico.Base.EstructuraAbogado, ConMega.Juridic
    o.Base, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' with data contrac
    t name 'EstructuraAbogado' in namespace 'http://schemas.datacontract.org/2004/07
    /ConMega.Juridico.Base' cannot be used since it does not match imported DataCont
    ract. Need to exclude this type from referenced types.
    XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/'
    ]/wsdl:portType[@name='IAbogadoService']

     

     

    How can i find in wich way "does not match imported DataContract", the type is defined once in a only assembly..

     

    If i remove te references option in svcutil command line the error goes away and files are generates, but types arent reused...

     

    Where i can find the XSD file?

     

    Any help please ?

     

    Thanks

     

     

All Replies

  • Wednesday, July 09, 2008 7:34 PM
     
     
    Have you ever resolved this issue?

     

  • Wednesday, July 09, 2008 10:03 PM
     
     

    The error occurs because the data contract defined by the complexType in the xsd file does not match the class defined in the code file.

     

    Could you paste a snippet of the complexType and class definition that you're having a problem with?

     

    An

  • Wednesday, July 09, 2008 10:09 PM
     
     
    I have just installed .net framework 3.5 SP1 beta and now everything works fine.

     

  • Monday, February 09, 2009 7:38 PM
     
     
    Some times the visual studio says it is unable to refresh the dll based on the .dll.refresh files. if you delete the refresh files or change the patch in the refresh files, then things will work ok.
    sometimes I just close the solution and visual studio and reopen the solution in studio update the web service reference, then things work.
    I dont know the actual cause, but it is really wasting time and frustrating.

    Sanjai
  • Thursday, July 23, 2009 11:13 AM
     
     
    I also had this problem. The problem for me was that I used a Generic class with the IsReference=True. My WCF Service returned this class and there was the problem. So for more information about this problem I have written an article on my blog. http://www.amkohartman.nl/post/2009/07/23/Adding-Service-Reference-results-in-empty-Referencecs(Referencevb).aspx

    Hope that this helps solving somebody's problem.