2012-02-07 3 views
0

SOAP 끝점 (wsHttpBinding) 및 끝내기 끝점 (webHttpBinding)을 통해 노출되어야하는 WCF 서비스가 있습니다. 버젼 관리 (tempuri.org는 WSDL에서 완전히 제거되어야 함)를 돕기 위해 관련 속성에 이름과 네임 스페이스를 포함 시켰습니다. 어떤 이유로, webHttpBinding 엔드 포인트에 bindingNamepace 속성을 추가하지 않으면 WSDL에 tempuri.org 네임 스페이스가 추가됩니다. 예제 WSDL 출력은 아래와 같습니다. bindingNamespace없이bindingNamespace 속성이 제외 된 경우 webHttpBinding endpoint가 WSDL에 temuri.org 네임 스페이스를 추가합니다.

WSDL - bindingNamespace와

<wsdl:definitions name="State" targetNamespace="http://example.com/services/masterdat/state/2012/02/05" 
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://example.com/services/masterdata/state/2012/02/05" 
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" 
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" 
xmlns:i0="http://tempuri.org/" 
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 -

<wsdl:definitions name="State" targetNamespace="http://example.com/services/masterdata/state/2012/02/05" 
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://example.com/services/masterdata/state/2012/02/05" 
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"> 

다음은 엔드 포인트에 대한 내 Web.config를합니다. WCFExtras를 사용하여 WSDL (즉, wsHttpBinding 끝점의 behaviorConfiguration)을 평평하게 만들었지 만 그 동작은 동일하지 않습니다.

<services> 
    <service name="MasterDataExample.Services.StateService"> 
    <!-- bindingConfiguration="defaultWsBinding" --> 
    <endpoint address="soap" 
       behaviorConfiguration="flatWsdl" 
       binding="wsHttpBinding" 
       bindingNamespace="http://example.com/services/masterdata/state/2012/02/05" 
       contract="MasterDataExample.Services.IStateService" 
       name="soap" /> 
    <!-- --> 
    <endpoint address="json" 
       behaviorConfiguration="json" 
       binding="webHttpBinding" 
       bindingNamespace="http://example.com/services/masterdata/state/2012/02/05" 
       contract="MasterDataExample.Services.IStateService" 
       name="ajax" /> 
    </service> 
</services> 

나는 내 솔루션에 WCFExtras을로드 내가 더 성공 tempuri.org의 언급을 찾을 수 있는지 확인하기 위해 WsdlExporter 살펴 보았다. 또한 XSharper.Core를 사용하여 개체 그래프를 덤프하여 찾을 수 있는지 확인했습니다. 거기 있지 않습니다.

누구나 전에 경험 했습니까? 해결 방법은 webHttpBinding 끝점에 bindingNamespace를 포함시켜 WSDL을 깨끗하게 유지하는 것입니다. 그러나 이것이 왜 발생 하는지를 알고 싶습니다.

감사합니다.

답변

3

WSDL에서 tempuri.org 네임 스페이스를 완전히 제거하려면 끝점 구성에 BindingNamespace가 필요합니다. this post (항목 3)을 참조하십시오.