2011-08-20 2 views
2

VS2010의 "서비스 참조 추가"대화 상자를 사용하여 서비스 참조를 성공적으로 추가했습니다.VS2010의 "서비스 참조 추가"를 사용하여 BasicHttpBinding 대신 WsHttpBinding 생성

Test method Test.Entities.DocumentumServiceClient_Tests.Can_Read_Client_Message threw 
exception: System.ServiceModel.ProtocolException: The content type multipart/related; 
type="application/xop+xml"; boundary="uuid:976dd31d-c531-4298-b12c-e799c8eb4bed"; 
start="<[email protected]>"; start-info="text/xml" of the response message 
does not match the content type of the binding (text/xml; charset=utf-8). 
If using a custom encoder, be sure that the IsContentTypeSupported method is implemented 
properly. The first 919 bytes of the response were: <code> 

'--uuid:976dd31d-c531-4298-b12c-e799c8eb4bed 
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"; 
Content-Transfer-Encoding: binary 
Content-ID: <[email protected]> 

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
    <soap:Body> 
    <ns8:getRepositoryNameResponse 
      xmlns:xs="http://www.w3.org/2001/XMLSchema" 
      xmlns:dfs-dm-core-profiles="http://irrelevant.com/" 
      xmlns:dfs-dm-core-context="http://irrelevant2.com/" 
      xmlns:dfs-dm-core-properties="http://irrelevant3.com/" 
      xmlns:dfs-dm-core-content="irrelevant4.com/" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xmlns:ns8="http://irrelevant5.com/">   
     <return>to the Dagobah system</return> 
    </ns8:getRepositoryNameResponse> 
    </soap:Body> 
</soap:Envelope> 
--uuid:976dd31d-c531-4298-b12c-e799c8eb4bed--'. 

이 모든 것, 광범위한 인터넷 검색 후, 서버와 SOAP에 SOAP 1.2 사이에 불일치가 될 : 나는 액세스하려고 할 때, 웹 서비스 방법, 나는 다음과 같은 ProtocolException 사용을 얻을 말했다 1.1 내 프로젝트에. 분명히 BasicHttpBinding 대신 WSHttpBinding을 사용해야합니다. 내가 WsHttpBinding과 가진 1.2 버전을 생성하는 서비스 참조 대화 상자에게 일을해야 다른 무언가가

<system.serviceModel> 
    <client> 
    <endpoint address="http://irrelevant.com/Service" 
       binding="basicHttpBinding" 
       bindingConfiguration="CMSPersistantManagerServiceServiceSoapBinding" 
       contract="DocumentumService.CMSPersistentManagerService" 
       name="CMSPersistentManagerServicePort" /> 
    </client> 
<bindings> 
    <basicHttpBinding> 
    <binding name="DfsAgentService" closeTimeout="00:01:00" openTimeout="00:01:00" 
     receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" 
     bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 
     maxBufferSize="1000000" maxBufferPoolSize="10000000" maxReceivedMessageSize="1000000" 
     messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" 
     useDefaultWebProxy="true"> 
     <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
     maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
     <security mode="None"> 
     <transport clientCredentialType="None" proxyCredentialType="None" 
      realm="" /> 
     <message clientCredentialType="UserName" algorithmSuite="Default" /> 
     </security> 
    </binding> 
    <binding name="DfsContextRegistryService" closeTimeout="00:01:00" 
     openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
     allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 
     maxBufferSize="1000000" maxBufferPoolSize="10000000" maxReceivedMessageSize="1000000" 
     messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" 
     useDefaultWebProxy="true"> 
     <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
     maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
     <security mode="None"> 
     <transport clientCredentialType="None" proxyCredentialType="None" 
      realm="" /> 
     <message clientCredentialType="UserName" algorithmSuite="Default" /> 
     </security> 
    </binding> 
    <binding name="DfsDefaultService" closeTimeout="00:01:00" openTimeout="00:01:00" 
     receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" 
     bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 
     maxBufferSize="1000000" maxBufferPoolSize="10000000" maxReceivedMessageSize="1000000" 
     messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" 
     useDefaultWebProxy="true"> 
     <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
     maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
     <security mode="None"> 
     <transport clientCredentialType="None" proxyCredentialType="None" 
      realm="" /> 
     <message clientCredentialType="UserName" algorithmSuite="Default" /> 
     </security> 
    </binding> 
    <binding name="CMSPersistantManagerServiceServiceSoapBinding" 
     closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" 
     sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" 
     hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" 
     maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" 
     textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> 
     <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
     maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
     <security mode="None"> 
     <transport clientCredentialType="None" proxyCredentialType="None" 
      realm="" /> 
     <message clientCredentialType="UserName" algorithmSuite="Default" /> 
     </security> 
    </binding> 
    </basicHttpBinding> 
</bindings> 

있습니까 : 여기의 app.config의 생성 관련 부분은 무엇입니까? WSDL의 잘못입니까? 나는 구글 로프의 끝에 있기 때문에 어떤 도움이라도 인정 될 것이다.

+1

서버가 사용하는 것은 무엇이든 사용해야합니다. –

+0

예, 알고 있습니다. 그러나 앞서 언급했듯이 서비스 참조 추가 대화 상자는 호환 서비스 (분명히)를 생성하지 않습니다. 나는 그들이 일치해야 얻을, 난 그냥 WSDL을 올바르게 읽는 경우, 어떻게 바보 바인딩 바인딩을 선택하는 이해가 안 돼요. –

답변

2

제 3 자 SOAP 웹 서버에서 제어 할 수없는 비슷한 문제가있었습니다. Visual Studio에서 BasicHttpBinding과 함께 추가하는 기본 SOAP 1.1 헤더가 아니라 SOAP 1.2를 사용해야한다는 사실을 발견했습니다.

나는 사용자 지정 바인딩을 생성하여, 당신은 BasicHttpBinding은 SOAP 1.2하지만, 따라서 당신의 .config를 수정하는 작업을 얻을 수 있도록, WsHttpBinding과의 보안 기능과 호환되지 않았습니다 소모 된 서비스 :

<system.serviceModel> 
    <bindings> 
    <customBinding> 
     <binding name="httpSoap12"> 
     <textMessageEncoding messageVersion="Soap12"/> 
     <httpTransport /> 
     </binding> 
    </customBinding> 
    </bindings> 
    <client> 
    <endpoint address="http://server.com/interface/SoapService.asmx" 
     binding="customBinding" bindingConfiguration="httpSoap12" 
     contract="Service.ThingsYouNeed" name="ThingsYouNeed" /> 
    </client> 
</system.serviceModel> 

만들기 Visual Studio 2010에서 서비스 참조를 추가 한 후 이러한 구성을 수정하십시오.

희망이 도움이됩니다.

관련 문제