7

Non riesco a ottenere l'aggiunta di riferimento del servizio in VS 2010 o 2012 per funzionare per servizi Web creati su ServiceStack. Ho seguito lo guide su github, inclusa l'aggiunta dell'attributo ContractNameSpace al file AssemblyInfo.cs e assicurando che tutti i miei DTO si trovino nello stesso spazio dei nomi ma senza fortuna. Invece ricevo un numero di messaggi di errore sugli avvisi di build che ho incluso di seguito.Aggiungi errore di riferimento servizio "Impossibile importare wsdl: portType"

Qualcuno ha qualche suggerimento su cosa sta andando male?

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

La disattivazione "tipi di riutilizzo in assemblee di riferimento" nella Guida Servizio di configurazione di riferimento? – Moofafa

+0

Benvenuti in SO, per favore usate la sezione commenti per lasciare la domanda –

+0

Sono davvero alle prese con questo, i miei DTO hanno datacontract e datamember attribtutes su di essi e li ho resi davvero semplici da provare e farlo funzionare , si blocca ancora come il tuo sopra – ozz

risposta

5

Ho scoperto la radice del mio problema. Uno dei miei DTO non è stato decorato con gli attributi [DataContract] e [DataMember].

Ciò significava che il WSDL prodotto da ServiceStack non conteneva le informazioni sul tipo per questo DTO, quindi quando una delle sottosezioni del messaggio del WSDL si riferiva a questo tipo di DTO, VS non riusciva a trovarlo e lanciava l'eccezione.

Speriamo che questo aiuti qualcun altro. Mi ci è voluto un po 'di tempo per capire cosa ho sbagliato.

+1

Sì, questo è già elencato nella [Pagina wiki di supporto SOAP] (https://github.com/ServiceStack/ServiceStack/wiki/SOAP-support) in "Assicurarsi che gli oggetti DTO abbiano attributo [DataContract] ..." – mythz

0

Un altro motivo potrebbe essere: Verificare che lo spazio dei nomi target possa aver creato conflitti, rimuovere qualsiasi istanza di tempuri.org - inserire uno spazio dei nomi coerente in modo appropriato, risolvere l'errore precedente.

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

Speranza che aiuta

+0

Non c'è nulla di intrinsecamente sbagliato nell'usare 'tempuri.org', a patto che venga usato in modo coerente. – Abel