views:

185

answers:

1

I get the following error when attempting to consume a wcf web service with a wcf client:

Error in deserializing body of request message for operation 'GetUpcomingRaces'. OperationFormatter encountered an invalid Message body. Expected to find node type 'Element' with name 'GetUpcomingRaces' and namespace 'http://tempuri.org/'. Found node type 'Element' with name 'e:EncryptedData' and namespace 'http://www.w3.org/2001/04/xmlenc#'

My service is being hosted on local IIS via VS2010, is using basicHttpBinding, message security mode, certificate authententer code hereication and CertificateValidationMode = PeerTrust. My system.ServiceModel sections of the service and client .config files are attached.

Client *system.serviceModel config section*

 <system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_IRaceService" 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="Message">
                    <transport realm="" />
                    <message clientCredentialType="Certificate" />
                </security>
            </binding>
        </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost/RaceListingService2/RaceListingService.svc"
          binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IRaceService"
          contract="ServiceReference1.IRaceService" name="BasicHttpBinding_IRaceService" behaviorConfiguration ="RaceServiceBehavior">
        <identity>
          <dns value ="ServerSide" />
        </identity>
      </endpoint>
    </client>
  <behaviors>
    <endpointBehaviors>
      <behavior name="RaceServiceBehavior" >
        <clientCredentials>
          <clientCertificate
            findValue="ClientSide"
            storeLocation="LocalMachine"
            storeName="My"
            x509FindType="FindBySubjectName"
          />
          <serviceCertificate>
            <authentication certificateValidationMode="PeerOrChainTrust" />
            <defaultCertificate
            findValue="ServerSide"
            storeLocation ="LocalMachine"
            storeName ="My"
            x509FindType ="FindBySubjectName"
            />
          </serviceCertificate>
        </clientCredentials>
      </behavior>
    </endpointBehaviors>
  </behaviors>
</system.serviceModel>

Service system.serviceModel config section

<system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding_IRaceService">
      <security mode="Message">
        <message clientCredentialType="Certificate" />
      </security>
    </binding>
  </basicHttpBinding>
</bindings>
<services>
  <service name="RaceListingService" behaviorConfiguration="RaceServiceBehavior" />
</services>

Any help resolving this error is appreciated.

Thanks, Brent

A: 

did you find out where was the problem? I have the same error for WCF-BasicHttp or WCF-WSHttp. Thanks for reply. Martin

Martin