我只是想在客户端通过wsdl添加服务引用,但它没有选择生成的wsdl
然后我找到一个示例wsdl pnline并尝试导入它并且它工作得很好,所以可以有人告诉我在wicedl中做了什么改变,使其逻辑上像“工作一个”
工作一:
<definitions name="HelloService"
targetNamespace="http://www.examples.com/wsdl/HelloService.wsdl"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.examples.com/wsdl/HelloService.wsdl"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<message name="SayHelloRequest">
<part name="firstName" type="xsd:string"/>
</message>
<message name="SayHelloResponse">
<part name="greeting" type="xsd:string"/>
</message>
<portType name="Hello_PortType">
<operation name="sayHello">
<input message="tns:SayHelloRequest"/>
<output message="tns:SayHelloResponse"/>
</operation>
</portType>
<binding name="Hello_Binding" type="tns:Hello_PortType">
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="sayHello">
<soap:operation soapAction="sayHello"/>
<input>
<soap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:examples:helloservice"
use="encoded"/>
</input>
<output>
<soap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:examples:helloservice"
use="encoded"/>
</output>
</operation>
</binding>
<service name="Hello_Service">
<documentation>WSDL File for HelloService</documentation>
<port binding="tns:Hello_Binding" name="Hello_Port">
<soap:address
location="http://www.examples.com/SayHello/" />
</port>
</service>
</definitions>
而不是工作(我的生成wsdl):
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" name="RoutingService" targetNamespace="http://tempuri.org/">
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="http://10.111.21.97:8884/?xsd=xsd0" namespace="http://tempuri.org/"/>
<xsd:import schemaLocation="http://10.111.21.97:8884/?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="IRoutingService_RouteEnd_InputMessage">
<wsdl:part name="parameters" element="tns:RouteEnd"/>
</wsdl:message>
<wsdl:message name="IRoutingService_RouteEnd_OutputMessage">
<wsdl:part name="parameters" element="tns:RouteEndResponse"/>
</wsdl:message>
<wsdl:message name="IRoutingService_RouteRequest_InputMessage">
<wsdl:part name="parameters" element="tns:RouteRequest"/>
</wsdl:message>
<wsdl:message name="IRoutingService_RouteRequest_OutputMessage">
<wsdl:part name="parameters" element="tns:RouteRequestResponse"/>
</wsdl:message>
<wsdl:message name="IRoutingService_Test_InputMessage">
<wsdl:part name="parameters" element="tns:Test"/>
</wsdl:message>
<wsdl:message name="IRoutingService_Test_OutputMessage">
<wsdl:part name="parameters" element="tns:TestResponse"/>
</wsdl:message>
<wsdl:portType name="IRoutingService">
<wsdl:operation name="RouteEnd">
<wsdl:input wsam:Action="http://tempuri.org/IRoutingService/RouteEnd" message="tns:IRoutingService_RouteEnd_InputMessage"/>
<wsdl:output wsam:Action="http://tempuri.org/IRoutingService/RouteEndResponse" message="tns:IRoutingService_RouteEnd_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="RouteRequest">
<wsdl:input wsam:Action="http://tempuri.org/IRoutingService/RouteRequest" message="tns:IRoutingService_RouteRequest_InputMessage"/>
<wsdl:output wsam:Action="http://tempuri.org/IRoutingService/RouteRequestResponse" message="tns:IRoutingService_RouteRequest_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="Test">
<wsdl:input wsam:Action="http://tempuri.org/IRoutingService/Test" message="tns:IRoutingService_Test_InputMessage"/>
<wsdl:output wsam:Action="http://tempuri.org/IRoutingService/TestResponse" message="tns:IRoutingService_Test_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="BasicHttpBinding_IRoutingService" type="tns:IRoutingService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="RouteEnd">
<soap:operation soapAction="http://tempuri.org/IRoutingService/RouteEnd" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="RouteRequest">
<soap:operation soapAction="http://tempuri.org/IRoutingService/RouteRequest" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="Test">
<soap:operation soapAction="http://tempuri.org/IRoutingService/Test" 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="RoutingService">
<wsdl:port name="BasicHttpBinding_IRoutingService" binding="tns:BasicHttpBinding_IRoutingService">
<soap:address location="http://10.111.21.97:8884/Soap"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
我正在通过代码
托管肥皂服务 BasicHttpBinding binding = new BasicHttpBinding();
var serviceMetaDataBehaviour = new ServiceMetadataBehavior { HttpGetEnabled=true, MetadataExporter = { PolicyVersion = PolicyVersion.Policy15 }};
_webserviceHost.Description.Behaviors.Add(serviceMetaDataBehaviour);
_webserviceHost.AddServiceEndpoint(typeof(IRoutingService), binding, "Soap");
//_webserviceHost.AddServiceEndpoint(typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexHttpBinding(), "mex");
_webserviceHost.Open();
请帮助 我必须生成Soap1.1兼容的wsdl我从所有这些
诱导