WCF WSDL生成有关每个部分的含义和内容的详细信息

时间:2011-08-22 12:10:42

标签: wcf wsdl wcf-client

我对WCF世界很陌生。

我一直在寻找并试图理解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>

查询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:

你可以告诉我上面wsdl片段中的“tns:IEvalService_SubmitEval_InputMessage”是什么?

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

是否可以从WCF代码中删除上述不必要的命名空间?我只知道如何更改名称空间。

谢谢你。

1 个答案:

答案 0 :(得分:0)

  1. 此部分取决于所涉及的组件数量。第一行代表您的服务程序集,第二行始终包含 - 某些MS预定义元素(但仍然是有效的可互操作XSD),第三行可能是包含数据协定的库。
  2. 默认模式是ServiceContractName_OperationContractName_X,其中X是InputMessage或OutputMessage,在请求和响应之间不同。部分定义消息的内容,元素是对XSD方案的引用 - 该元素将在第一个问题的第一个或第二个模式导入中定义。
  3. tns可能代表目标命名空间 - 它是WSDL文档中定义的元素的前缀。它只是对第二个问题中定义的消息的引用。
  4. 默认的东西没有。您可能需要自定义编码器。
  5. 导入WSDL时您的客户有什么错误?所有这些部分都是有效的。