我正在努力让SOAPUI在我的服务中显示我的操作,我从暴露的MEX端点生成我的WSDL(所以不是手动的)然后我从生成的WSDL创建我的CLIENT代理。从代码的角度来看,这样可以正常工作(如果主机正在运行,我的单元测试会通过,如果主机运行则会失败)。
我想使用SOAPUI进行一些低级别测试,但如果我使用相同的WSDL来生成代理,那么它就不会显示任何操作(即使WSDL正在运行)
生成WSDL svcutil / target:metadata" net.tcp:// localhost:10109 / AnimalService"
生成代理 svcutil / t:code .. *。wsdl .. *。xsd /out:Proxy.cs /config:Proxy.config
我认为我做错了什么,任何帮助都会受到赞赏。
主要WSDL
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:i0="http://spikes/WcfCodeFirstExample/services/AnimalService" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://tempuri.org/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" name="AnimalService" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:import namespace="http://spikes/WcfCodeFirstExample/services/AnimalService" location="" />
<wsdl:types />
<wsdl:service name="AnimalService">
<wsdl:port name="NetTCPBinding_IAnimalService" binding="i0:NetTCPBinding_IAnimalService">
<soap12:address location="net.tcp://localhost:10109/AnimalService.svc" />
<wsa10:EndpointReference>
<wsa10:Address>net.tcp://localhost:10109/AnimalService.svc</wsa10:Address>
</wsa10:EndpointReference>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
辅助WSDL(首先引用)
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:i0="Spike.Contracts.Services" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://spikes/WcfCodeFirstExample/services/AnimalService" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" targetNamespace="http://spikes/WcfCodeFirstExample/services/AnimalService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsp:Policy wsu:Id="NetTCPBinding_IAnimalService_policy">
<wsp:ExactlyOne>
<wsp:All>
<msb:BinaryEncoding xmlns:msb="http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1"></msb:BinaryEncoding>
<wsaw:UsingAddressing></wsaw:UsingAddressing>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
<wsdl:import namespace="Spike.Contracts.Services" location="" />
<wsdl:types />
<wsdl:binding name="NetTCPBinding_IAnimalService" type="i0:IAnimalService">
<wsp:PolicyReference URI="#NetTCPBinding_IAnimalService_policy"></wsp:PolicyReference>
<soap12:binding transport="http://schemas.microsoft.com/soap/tcp" />
<wsdl:operation name="GetAvailableAnimalTypes">
<soap12:operation soapAction="Spike.Contracts.Services/IAnimalService/GetAvailableAnimalTypes" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="AddPetAnimalType">
<soap12:operation soapAction="Spike.Contracts.Services/IAnimalService/AddPetAnimalType" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
</wsdl:definitions>
请记住,这是生成的WSDL和XSD没有手动滚动。我尝试了netTcpbinding和basicHttpBinding配置。很可能是因为我错误地使用了SOAPUI但是如果我尝试使用示例WSDL(http://www.webservicex.com/CurrencyConvertor.asmx?wsdl),我确实看到了相关的操作,所以我假设我做得对。
我正在使用SOAPUI 5.0。
答案 0 :(得分:0)
我遇到了完全相同的问题,结果发现我使用的是WebHttpBinding
而不是BasicHttpBinding
。一旦我切换为使用BasicHttpBinding
,所有的操作/方法都将显示在SoapUI中。
答案 1 :(得分:0)
以防万一有人像我一样在 6 年后还在看这个。在我的例子中,我有几个 WebMethod 调用显示,但一个新的 WebMethod 不会显示。跑了几次,SoapUI说更新了133个方法,新方法还是没有显示。
对我来说,修复是删除现有定义,然后添加新定义而不是更新现有定义,然后在新定义中显示新方法。一个简单的解决方案,但不确定为什么更新不起作用。