2013-03-03 279 views
7

我無法獲得VS 2010或2012中的添加服務引用,以便爲構建於ServiceStack上的Web服務工作。我遵循github上的guide,包括將ContractNameSpace屬性添加到AssemblyInfo.cs文件,並確保我所有的DTO都位於相同的命名空間中,但沒有運氣。相反,我收到了一些我在下面包含的構建警告錯誤消息。添加服務引用錯誤「無法導入wsdl:portType」

有沒有人有什麼問題的建議?

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'] 
+4

是否在服務參考配置幫助禁用「中引用組件重用類型」? – Moofafa 2013-03-06 15:54:32

+0

歡迎來到SO,請使用評論部分留下問題 – 2013-03-06 15:57:30

+0

我真的很苦惱這個,我的DTO的數據合同和datamember attribtutes對他們雖然,我已經讓他們非常簡單,試圖讓它工作,仍然像上面那樣崩潰 – ozz 2013-08-09 12:50:29

回答

5

我發現了我的問題的根源。我的一個DTO沒有使用[DataContract][DataMember]屬性進行裝飾。

這意味着由ServiceStack生成的WSDL不包含此DTO的類型信息,因此當WSDL的某個消息子部分引用此DTO類型VS時,無法找到它並拋出異常。

希望這會幫助別人。我花了相當多的時間來弄清楚我做錯了什麼。

+1

是的,這已經在[SOAP支持wiki頁面](https://github.com/ServiceStack/ServiceStack/wiki/SOAP-support)上列出了'確保DTO對象具有[DataContract]屬性...' – mythz 2013-03-07 15:15:13

0

另一個原因可能是:檢查targetNamespace可能已經創建衝突,刪除tempuri.org的任何實例 - 適當地放置一致的名稱空間,將解決以上錯誤。

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

希望它可以幫助

+0

使用'tempuri.org'沒有任何內在的錯誤,只要它一直使用。 – Abel 2015-09-13 15:32:04

相關問題