Problem Creating Service Contract from WSDL

Topics: General Discussion Forum, July and December Releases Forum
Apr 19, 2007 at 10:47 PM
Hi

I have tried several WSDL files one is a sample and another is real world, but come up with the same error.

Microsoft.Practices.RecipeFramework.ActionExecutionException: An exception occurred during the binding of reference or execution of recipe GenerateWCFServiceContractFromWsdl. Error was: Action CreateServiceContractFromWsdl failed to execute:
Cannot import wsdl:port
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Channels.TransportBindingElementImporter
Error: Invalid URI: The URI is empty.
XPath to Error Source: //wsdl:definitions@targetNamespace='urn:thinktecture-com:demos:restaurantservice:webservice:v1'/wsdl:service@name='RestaurantServicePort'/wsdl:port@name='RestaurantServicePort'.
You can remove the reference to this recipe through the Guidance Package Manager. ---> System.InvalidOperationException: Cannot import wsdl:port
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Channels.TransportBindingElementImporter
Error: Invalid URI: The URI is empty.
XPath to Error Source: //wsdl:definitions@targetNamespace='urn:thinktecture-com:demos:restaurantservice:webservice:v1'/wsdl:service@name='RestaurantServicePort'/wsdl:port@name='RestaurantServicePort'
at Microsoft.Practices.SoftwareFactories.ServiceFactory.WCF.Description.ContractGenerator.ThrowOnMetadataConversionErrors(Collection`1 errors)
at Microsoft.Practices.SoftwareFactories.ServiceFactory.WCF.Description.ContractGenerator.Generate(WsdlImporter wsdlImporter, Boolean updateConfigurationFile)
at Microsoft.Practices.SoftwareFactories.ServiceFactory.WCF.Description.ContractGenerator.Generate(MetadataSet metadataSet)
at Microsoft.Practices.ServiceFactory.WCF.Actions.ServiceModel.CreateServiceConctractFromWsdl.Execute()
at Microsoft.Practices.RecipeFramework.Recipe.Microsoft.Practices.RecipeFramework.Services.IActionExecutionService.Execute(String actionName, Dictionary`2 inputValues)
at Microsoft.Practices.RecipeFramework.Recipe.Microsoft.Practices.RecipeFramework.Services.IActionExecutionService.Execute(String actionName)
at Microsoft.Practices.RecipeFramework.Extensions.Coordinators.ConditionalCoordinator.Run(Dictionary`2 declaredActions, XmlElement coordinationData)
at Microsoft.Practices.RecipeFramework.Recipe.ExecuteActions(IDictionaryService readOnlyArguments, IDictionaryService arguments, ITypeResolutionService resolution)
--- End of inner exception stack trace ---
at Microsoft.Practices.RecipeFramework.Recipe.UndoExecutedActionsAndRethrow(Exception ex)
at Microsoft.Practices.RecipeFramework.Recipe.ExecuteActions(IDictionaryService readOnlyArguments, IDictionaryService arguments, ITypeResolutionService resolution)
at Microsoft.Practices.RecipeFramework.Recipe.Execute(Boolean allowSuspend)
at Microsoft.Practices.RecipeFramework.GuidancePackage.Execute(String recipe, IAssetReference reference, IDictionary arguments)
at Microsoft.Practices.RecipeFramework.GuidancePackage.Execute(IAssetReference reference)
at Microsoft.Practices.RecipeFramework.RecipeReference.OnExecute()
at Microsoft.Practices.RecipeFramework.AssetReference.Execute()
at Microsoft.Practices.RecipeFramework.VisualStudio.RecipeMenuCommand.OnExec()
at Microsoft.Practices.RecipeFramework.VisualStudio.AssetMenuCommand.Invoke()

Here is the WSDL:
<definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:thinktecture-com:demos:restaurantservice:webservice:v1" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:import1="urn:thinktecture-com:demos:restaurantservice:headerdata:v1" xmlns:import0="urn:thinktecture-com:demos:restaurantservice:messages:v1" targetNamespace="urn:thinktecture-com:demos:restaurantservice:webservice:v1" name="RestaurantService" xmlns="http://schemas.xmlsoap.org/wsdl/">
<documentation>This is the entry point into the Restaurant Service application.</documentation>
<types>
<xsd:schema>
<xsd:import schemaLocation="RestaurantMessages.xsd" namespace="urn:thinktecture-com:demos:restaurantservice:messages:v1" />
<xsd:import schemaLocation="RestaurantHeaderData.xsd" namespace="urn:thinktecture-com:demos:restaurantservice:headerdata:v1" />
</xsd:schema>
</types>
<message name="getRestaurantsIn">
<part name="messagePart" element="import0:getRestaurants" />
</message>
<message name="getRestaurantsOut">
<part name="messagePart" element="import0:getRestaurantsResponse" />
</message>
<message name="addRestaurantIn">
<part name="messagePart" element="import0:addRestaurant" />
</message>
<message name="addRestaurantInHeader1">
<part name="messagePart" element="import1:userCredentials" />
</message>
<message name="rateRestaurantIn">
<part name="messagePart" element="import0:rateRestaurant" />
</message>
<portType name="RestaurantServiceInterface">
<documentation>This is the entry point into the Restaurant Service application.</documentation>
<operation name="getRestaurants">
<input message="tns:getRestaurantsIn" />
<output message="tns:getRestaurantsOut" />
</operation>
<operation name="addRestaurant">
<input message="tns:addRestaurantIn" />
</operation>
<operation name="rateRestaurant">
<input message="tns:rateRestaurantIn" />
</operation>
</portType>
<binding name="RestaurantService" type="tns:RestaurantServiceInterface">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
<operation name="getRestaurants">
<soap:operation soapAction="urn:thinktecture-com:demos:restaurantservice:webservice:v1:getRestaurantsIn" style="document" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
<operation name="addRestaurant">
<soap:operation soapAction="urn:thinktecture-com:demos:restaurantservice:webservice:v1:addRestaurantIn" style="document" />
<input>
<soap:body use="literal" />
<soap:header message="tns:addRestaurantInHeader1" part="messagePart" use="literal" />
</input>
</operation>
<operation name="rateRestaurant">
<soap:operation soapAction="urn:thinktecture-com:demos:restaurantservice:webservice:v1:rateRestaurantIn" style="document" />
<input>
<soap:body use="literal" />
</input>
</operation>
</binding>
<service name="RestaurantServicePort">
<port name="RestaurantServicePort" binding="tns:RestaurantService">
<soap:address location="" />
</port>
</service>
</definitions>

There are three other XSD files, but I can't paste them in the this message body or attach them. Any ideas what this 'Invalid URI: The URI is empty.' error message problem is?

Thanks,
Eric
Apr 20, 2007 at 2:16 PM
My first guess is that the empty URI value is because of the emtpty value "" in <soap:address location="" /> located at the bottom of your WSDL file. Try adding some uri value there and run again that recipe.
Apr 20, 2007 at 4:45 PM

charlyfriend wrote:
My first guess is that the empty URI value is because of the emtpty value "" in <soap:address location="" /> located at the bottom of your WSDL file. Try adding some uri value there and run again that recipe.



Thanks very much charlyfriend, that worked. I'm not the wsdl expert so I totally missed that missing element.

Eric