2011-08-22 68 views
0

我對WCF世界很陌生。WCF WSDL Generation有關每節的含義和方式的詳細信息

我一直在尋找並試圖理解WCF生成的WSDL文件。我在尋找的原因是我們的客戶在使用Java和PHP時遇到了導入WSDL的問題。

任何人都可以請您幫我看看以下查詢:

- <xsd:schema targetNamespace="http://tempuri.org/Imports"> 
    <xsd:import schemaLocation="http://localhost:13818/WCFService2/Service.svc?xsd=xsd0" namespace="http://tempuri.org/" /> 
    <xsd:import schemaLocation="http://localhost:13818/WCFService2/Service.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/" /> 
    <xsd:import schemaLocation="http://localhost:13818/WCFService2/Service.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/EvalServiceLibrary" /> 
    </xsd:schema> 

查詢1

基於以上是進口的schemaLocation標記什麼情況下被產生的?它是基於(是什麼?)

- <wsdl:message name="IEvalService_SubmitEval_InputMessage"> 
    <wsdl:part name="parameters" element="tns:SubmitEval" /> 
    </wsdl:message> 
- <wsdl:message name="IEvalService_SubmitEval_OutputMessage"> 
    <wsdl:part name="parameters" element="tns:SubmitEvalResponse" /> 
    </wsdl:message> 

數據契約和成員或somethingelse數查詢2: 我沒有任何消息名稱IEvalService_SubmitEval_InputMessage。以上是如何產生的?什麼是零件名稱和元素?

<wsdl:portType name="IEvalService"> 
- <wsdl:operation name="SubmitEval"> 
    <wsdl:input wsaw:Action="http://tempuri.org/IEvalService/SubmitEval" message="tns:IEvalService_SubmitEval_InputMessage" /> 
    <wsdl:output wsaw:Action="http://tempuri.org/IEvalService/SubmitEvalResponse" message="tns:IEvalService_SubmitEval_OutputMessage" /> 
    </wsdl:operation> 
    </wsdl:portType> 

查詢3:

可以喲uplease告訴我什麼是 「TNS:IEvalService_SubmitEval_InputMessage」 上面的WSDL片段?

Fianally:

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://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"> 

是THRE任何方式除去從WCF代碼上述不必要的命名空間?我只知道如何改變命名空間。

謝謝你堆。

回答

0
  1. 這部分取決於所涉及的部件數量。第一行代表您的服務程序集,第二行始終包含 - 某些MS預定義的元素(但仍然是有效的可互操作的XSD),第三行可能是包含數據合同的庫。
  2. 默認模式是ServiceContractName_OperationContractName_X,其中X是請求和響應之間不同的InputMessage或OutputMessage。部分定義了消息的內容,元素是對XSD方案的引用 - 該元素將在第一個問題的第一個或第二個模式導入中定義。
  3. tns可能代表目標名稱空間 - 它是您的WSDL文檔中定義的元素的前綴。這只是對第二個問題中定義的消息的引用。
  4. 默認的東西沒有。您可能需要自定義編碼器。

導入WSDL時,客戶端有什麼錯誤?所有這些部分都是有效的。

+0

謝謝你@Ladislav Mrnka,非常有幫助。你用什麼樣的參考來掌握以上和WCF的整體? –

+0

WSDL是標準化的,WS-Policies是標準化的,XSD也是標準化的。您既可以閱讀規範,也可以直接從WSDL中學習使用(就像我一樣)。默認命名約定分散在MSDN中,但一旦看到它們,它們通常很直觀。 –