2013-03-03 27 views
7

Tôi không thể lấy tham chiếu thêm dịch vụ trong VS 2010 hoặc 2012 để làm việc cho các dịch vụ web được xây dựng trên ServiceStack. Tôi đã theo sau guide trên github, bao gồm thêm thuộc tính ContractNameSpace vào tệp AssemblyInfo.cs và đảm bảo tất cả các DTO của tôi nằm trong cùng một không gian tên nhưng không có may mắn. Thay vào đó, tôi nhận được một số thông báo lỗi cảnh báo xây dựng mà tôi đã đưa vào bên dưới.Thêm lỗi tham chiếu dịch vụ "Không thể nhập wsdl: portType"

Có ai có bất kỳ đề xuất nào về những gì đang xảy ra không?

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

Có vô hiệu hóa "loại tái sử dụng trong hội đồng tham chiếu" trong sự giúp đỡ Cấu hình tham khảo dịch vụ? – Moofafa

+0

Chào mừng bạn đến với SO, Vui lòng sử dụng phần bình luận để để câu hỏi –

+0

Tôi thực sự đấu tranh với điều này, DTO của tôi có datacontract và datamember attribtutes trên chúng mặc dù và tôi đã làm cho họ thực sự đơn giản để thử và chỉ nhận được nó làm việc , vẫn bị treo giống như của bạn ở trên – ozz

Trả lời

5

Tôi đã khám phá ra gốc rễ của sự cố của mình. Một trong các DTO của tôi không được trang trí với các thuộc tính [DataContract][DataMember]. Điều này có nghĩa là WSDL được sản xuất bởi ServiceStack không chứa thông tin kiểu cho DTO này, do đó, khi một trong các phần con tin nhắn của WSDL được gọi là loại DTO VS này không thể tìm thấy nó và đã ném ngoại lệ.

Hy vọng điều này sẽ giúp người khác. Tôi đã mất khá nhiều thời gian để tìm hiểu tôi đã làm gì sai.

+1

Điều này đã được liệt kê trong trang [Hỗ trợ SOAP wiki] (https://github.com/ServiceStack/ServiceStack/wiki/SOAP-support) tại 'Đảm bảo rằng đối tượng DTO có thuộc tính [DataContract] ...' – mythz

0

Một lý do khác có thể là: Kiểm tra targetNamespace có thể đã tạo xung đột, loại bỏ bất kỳ thể hiện nào của tempuri.org - đặt không gian tên nhất quán một cách thích hợp, sẽ giải quyết lỗi trên.

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

Hy vọng nó giúp

+0

Không có gì sai khi sử dụng 'tempuri.org', miễn là nó được sử dụng nhất quán. – Abel

Các vấn đề liên quan