Entwickler-Ecke

ASP.NET und Web - dynamic web service


frenz123 - Di 28.12.10 00:49
Titel: dynamic web service
Guten Tag

Ich versuche einen Client zu schreiben, der sich dynamisch einen Service aufruft. Dies funktioniert indem ich die WSDL datei nehme und hierraus die Information erlange. Es klappt auch super bis ich versuche die wsdl datei von meinem Eigenen service nehme, da ich dann diese Fehler meldung kriege:

Unable to import binding 'BasicHttpBinding_IService' from namespace 'http://tempuri.org/'.

Meine web.conf:

<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>

<serviceMetadata httpGetEnabled="true"/>

<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>

Meine WSDL sieht folgendermassen aus:

<wsdl:definitions name="Service" targetNamespace="http://tempuri.org/">

<wsdl:types>

<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="http://localhost:49617/ServiceCE/Service.svc?xsd=xsd0" namespace="http://tempuri.org/"/>
<xsd:import schemaLocation="http://localhost:49617/ServiceCE/Service.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
<xsd:import schemaLocation="http://localhost:49617/ServiceCE/Service.svc?xsd=xsd2" namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
</xsd:schema>
</wsdl:types>

<wsdl:message name="IService_compile_InputMessage">
<wsdl:part name="parameters" element="tns:compile"/>
</wsdl:message>

<wsdl:message name="IService_compile_OutputMessage">
<wsdl:part name="parameters" element="tns:compileResponse"/>
</wsdl:message>

<wsdl:message name="IService_execute_InputMessage">
<wsdl:part name="parameters" element="tns:execute"/>
</wsdl:message>

<wsdl:message name="IService_execute_OutputMessage">
<wsdl:part name="parameters" element="tns:executeResponse"/>
</wsdl:message>

<wsdl:portType name="IService">

<wsdl:operation name="compile">
<wsdl:input wsaw:Action="http://tempuri.org/IService/compile" message="tns:IService_compile_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/IService/compileResponse" message="tns:IService_compile_OutputMessage"/>
</wsdl:operation>

<wsdl:operation name="execute">
<wsdl:input wsaw:Action="http://tempuri.org/IService/execute" message="tns:IService_execute_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/IService/executeResponse" message="tns:IService_execute_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>

<wsdl:binding name="BasicHttpBinding_IService" type="tns:IService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>

<wsdl:operation name="compile">
<soap:operation soapAction="http://tempuri.org/IService/compile" style="document"/>

<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>

<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>

<wsdl:operation name="execute">
<soap:operation soapAction="http://tempuri.org/IService/execute" style="document"/>

<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>

<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>

<wsdl:service name="Service">

<wsdl:port name="BasicHttpBinding_IService" binding="tns:BasicHttpBinding_IService">
<soap:address location="http://localhost:49617/ServiceCE/Service.svc"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

Kann mir bitte jemand helfen?

Vielen Dank

Frenz


Th69 - Di 28.12.10 13:33

Du solltest den Namespace "http://tempuri.org" für ein Release ändern, s.a.
http://tempuri.org/
http://en.wikipedia.org/wiki/Tempuri
http://support.microsoft.com/kb/811586/en-us?fr=1

Ob das der (alleinige) Fehler ist, kann ich aber nicht mit Sicherheit sagen.


frenz123 - Di 28.12.10 21:03

Vielen Dank

Ich habe jetzt mehrere Post nachgeschaut um tempuri.org aus meiner WSDL zu entfernen. Habe auch beinahe alle weg bis auf einen.

<wsdl:definitions name="Service" targetNamespace="http://schemas.umbraworks.net/rebuildall">
<wsdl:import namespace="http://tempuri.org/" location="http://localhost:50181/WCFService1/Service.svc?wsdl=wsdl0"/>

<wsdl:types>

<xsd:schema targetNamespace="http://schemas.umbraworks.net/rebuildall/Imports">
<xsd:import schemaLocation="http://localhost:50181/WCFService1/Service.svc?xsd=xsd0" namespace="http://schemas.umbraworks.net/rebuildall"/>
<xsd:import schemaLocation="http://localhost:50181/WCFService1/Service.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
</xsd:schema>
</wsdl:types>

<wsdl:message name="IService_LocalBindingMethod_InputMessage">
<wsdl:part name="parameters" element="tns:LocalBindingMethod"/>
</wsdl:message>

<wsdl:message name="IService_LocalBindingMethod_OutputMessage">
<wsdl:part name="parameters" element="tns:LocalBindingMethodResponse"/>
</wsdl:message>

<wsdl:portType name="IService">

<wsdl:operation name="LocalBindingMethod">
<wsdl:input wsaw:Action="http://schemas.umbraworks.net/rebuildall/IService/LocalBindingMethod" message="tns:IService_LocalBindingMethod_InputMessage"/>
<wsdl:output wsaw:Action="http://schemas.umbraworks.net/rebuildall/IService/LocalBindingMethodResponse" message="tns:IService_LocalBindingMethod_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>

<wsdl:service name="Service">

<wsdl:port name="BasicHttpBinding_IService" binding="i0:BasicHttpBinding_IService">
<soap:address location="http://localhost:50181/WCFService1/Service.svc"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

Ich habe einige Post durchgesucht. Alle beschreiben, dass man bei alle endpoint das bindingNamespace Attribut sezten soll. Jedoch habe ich in der Web.config keine endpoint Einträge. Wenn ich diese auch Manuel einfüge, ändert sich gar nicht.

Kann mir bitte jemand helfen?

Vielen Dank

Frenz