我正在開發一個簡單的wcf服務,並試圖將其公開爲Soap出於兼容性原因:客戶端將是一個具有良好動作的Flash應用程序。作爲肥皂的Wcf:取決於客戶的不同問題
我明顯使用basicHttpBinding來生成肥皂兼容的WSDL。
這裏緊跟我的配置(匿名當然敏感數據):
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="soapBinding" />
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="BasicBehavior" name="MyCustomer.MyProject.WebService.MyService">
<endpoint address="mex" binding="mexHttpBinding" name="mex" contract="IMetadataExchange" />
<endpoint binding="basicHttpBinding" bindingConfiguration="soapBinding"
name="Basic" bindingNamespace="http://myurl"
contract="MyCustomer.MyProject.WebService.IMyService">
</endpoint>
<host>
<baseAddresses>
<add baseAddress="http://myurl" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="BasicBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
這真的很簡單。現在開發Flash應用程序的人說他有一些麻煩,他看到了唯一存在的方法(稱爲ValidateForm),但他沒有看到參數列表。
我試過如下:
- 使用風暴調用web服務(storm.codeplex.com):小心:風暴,而不是WCF風暴。 Storm只適用於普通的Web服務,它不能以本地WCF模式連接。這工作正常。我看到參數,可以填充它們,調用並接收正確的響應。
- 使用http://soapclient.com/soaptest.html調用服務:這會讀取我的wsdl,看到參數列表,但是在調用「意外錯誤」時發生。
- 使用http://www.validwsdl.com/調用webservice:它讀取wsdl,但根本看不到參數列表,調用失敗。
我的服務顯然有問題。這裏遵循WSDL,也許有人可以告訴我,什麼是錯的(再次匿名):
<wsdl:definitions name="mycustomermyprojectService" targetNamespace="http://www1.myproject.mydomain.com" 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://www1.myproject.mydomain.com" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/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">
<wsdl:types>
<xsd:schema targetNamespace="http://www1.myproject.mydomain.com/Imports">
<xsd:import schemaLocation="http://www1.myproject.mydomain.com/?xsd=xsd0" namespace="http://www1.myproject.mydomain.com"/>
<xsd:import schemaLocation="http://www1.myproject.mydomain.com/?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
<xsd:import schemaLocation="http://www1.myproject.mydomain.com/?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/mycustomer.myproject.WebService.Models"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="ImycustomermyprojectService_ValidateForm_InputMessage">
<wsdl:part name="parameters" element="tns:ValidateForm"/>
</wsdl:message>
<wsdl:message name="ImycustomermyprojectService_ValidateForm_OutputMessage">
<wsdl:part name="parameters" element="tns:ValidateFormResponse"/>
</wsdl:message>
<wsdl:portType name="ImycustomermyprojectService">
<wsdl:operation name="ValidateForm">
<wsdl:input wsaw:Action="http://www1.myproject.mydomain.com/ImycustomermyprojectService/ValidateForm" message="tns:ImycustomermyprojectService_ValidateForm_InputMessage"/>
<wsdl:output wsaw:Action="http://www1.myproject.mydomain.com/ImycustomermyprojectService/ValidateFormResponse" message="tns:ImycustomermyprojectService_ValidateForm_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="Basic" type="tns:ImycustomermyprojectService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="ValidateForm">
<soap:operation soapAction="http://www1.myproject.mydomain.com/ImycustomermyprojectService/ValidateForm" 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="mycustomermyprojectService">
<wsdl:port name="Basic" binding="tns:Basic">
<soap:address location="http://www1.myproject.mydomain.com/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
任何人都可以提供一些線索?謝謝。
我一直在調查,它真的好像是這個問題。我遇到了一些關於WCF互操作的「Wsdl Flattening」主題。我仍在試驗,如果我做到了,我一定會爲自己的問題發佈解決方案。 –