Add error to service link "Unable to import wsdl: portType"

I can’t get the Add Service Reference link in VS 2010 or 2012 to work for web services built on ServiceStack. I followed the guide on github, including adding the ContractNameSpace attribute to the AssemblyInfo.cs file and ensuring that all my DTOs are in the same namespace, but with no luck. Instead, I get some build error messages that I have included below.

Does anyone have any suggestions on what is going wrong?

Warning 1 Custom tool warning: Cannot import wsdl:portType Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter Error: Schema with target namespace 'http://schemas.servicestack.net/types' could not be found. XPath to Error Source: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:portType[@name='ISyncReply'] Warning 2 Custom tool warning: Cannot import wsdl:binding Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on. XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:portType[@name='ISyncReply'] XPath to Error Source: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:binding[@name='WSHttpBinding_ISyncReply'] Warning 3 Custom tool warning: Cannot import wsdl:port Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on. XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:binding[@name='WSHttpBinding_ISyncReply'] XPath to Error Source: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:service[@name='SyncReply']/wsdl:port[@name='WSHttpBinding_ISyncReply'] Warning 4 Custom tool warning: Cannot import wsdl:portType Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter Error: Schema with target namespace 'http://schemas.servicestack.net/types' could not be found. XPath to Error Source: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:portType[@name='IOneWay'] Warning 5 Custom tool warning: Cannot import wsdl:binding Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on. XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:portType[@name='IOneWay'] XPath to Error Source: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:binding[@name='WSHttpBinding_IOneWay'] Warning 6 Custom tool warning: Cannot import wsdl:port Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on. XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:binding[@name='WSHttpBinding_IOneWay'] XPath to Error Source: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:service[@name='AsyncOneWay']/wsdl:port[@name='WSHttpBinding_IOneWay'] Warning 1 Custom tool warning: Cannot import wsdl:portType Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter Error: Schema with target namespace 'http://schemas.servicestack.net/types' could not be found. XPath to Error Source: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:portType[@name='ISyncReply'] Warning 2 Custom tool warning: Cannot import wsdl:binding Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on. XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:portType[@name='ISyncReply'] XPath to Error Source: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:binding[@name='WSHttpBinding_ISyncReply'] Warning 3 Custom tool warning: Cannot import wsdl:port Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on. XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:binding[@name='WSHttpBinding_ISyncReply'] XPath to Error Source: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:service[@name='SyncReply']/wsdl:port[@name='WSHttpBinding_ISyncReply'] Warning 4 Custom tool warning: Cannot import wsdl:portType Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter Error: Schema with target namespace 'http://schemas.servicestack.net/types' could not be found. XPath to Error Source: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:portType[@name='IOneWay'] Warning 5 Custom tool warning: Cannot import wsdl:binding Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on. XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:portType[@name='IOneWay'] XPath to Error Source: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:binding[@name='WSHttpBinding_IOneWay'] Warning 6 Custom tool warning: Cannot import wsdl:port Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on. XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:binding[@name='WSHttpBinding_IOneWay'] XPath to Error Source: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:service[@name='AsyncOneWay']/wsdl:port[@name='WSHttpBinding_IOneWay'] 
+7
source share
2 answers

I discovered the root of my problem. One of my DTOs was not embellished with the [DataContract] and [DataMember] .

This meant that the WSDL created by ServiceStack did not contain type information for this DTO, so when one of the sections of the WSDL message related to this type of VS could not find it and threw an exception.

Hope this helps someone else. It took me a long time to understand what I did wrong.

+5
source

Another reason may be the following: Check targetNamespace can create a conflict, delete any instance of tempuri.org - place a consistent namespace accordingly, resolve the error above.

 targetNamespace='http://tempuri.org/']/wsdl:portType[@name='IMyInterafaceService' 

Hope this helps

0
source

All Articles