2

I have a WCF service which returns the data for SSRS. As I am not able to call my Interface method in SSRS rdl.

Error in deserializing body of request message for operation 'CatReport'. OperationFormatter encountered an invalid Message body. Expected to find node type 'Element' with name 'ParameterClass' and namespace 'http://tempuri.org/'. Found node type 'Element' with name 'CatReport' and namespace 'http://tempuri.org/' (mscorlib)

Interface code in WCF

[ServiceContract]
public interface IService1
{
    [OperationContract]
    ResponseContr CatReport(ParameterClass bbb);
}

ParameterClass

[MessageContract(IsWrapped = true)]
public class ParameterClass
{
    [MessageBodyMember]
    public string InformationType { get; set; }
    [MessageBodyMember]
    public string ItemLocation { get; set; }
    [MessageBodyMember]
}

ResponseContr

[MessageContract(IsWrapped = true)]
public class ResponseContr
{
    [MessageBodyMember]
    public List<Book> Books { get; set; }
}

Book Class

[DataContract]
public class Book
{
    [DataMember]
    public string Type { get; set; }

    [DataMember]
    public int NoOfCopies { get; set; }
}

Web.config

  <system.serviceModel>
<client>
  <endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding" contract="ReportingService.IService1" name="BasicHttpBinding" />
</client>
<diagnostics>
  <messageLogging logEntireMessage="true"
                  logMessagesAtServiceLevel="false"
                  logMessagesAtTransportLevel="false"
                  logMalformedMessages="true"
                  maxMessagesToLog="5000"
                  maxSizeOfMessageToLog="2000">
  </messageLogging>
</diagnostics>
<behaviors>
  <serviceBehaviors>
    <behavior name="ReportingService.LibraryServiceBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding" allowCookies="true" maxBufferPoolSize="2147483647"
      maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
        maxArrayLength="2147483647" />
    </binding>
  </basicHttpBinding>
</bindings>
<services>
  <service behaviorConfiguration="ReportingService.LibraryServiceBehavior"
   name="ReportingService.Service1">
    <endpoint address=""
    binding="basicHttpBinding" name="BasicHttpBinding" bindingConfiguration="BasicHttpBinding"
    contract="ReportingService.IService1">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex"
    binding="mexHttpBinding"
    contract="IMetadataExchange" />
  </service>
</services>




<!--<behaviors>
  <serviceBehaviors>
    <behavior>
      -->
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<!--
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
      -->
<!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
<!--
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
  </serviceBehaviors>
</behaviors>-->
<protocolMapping>
  <add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />

Implement Interface

public class Service1 : IService1
{
    public ResponseContr CatReport(ParameterClass bbb)
    {
        return _clc.CatalogueList(bbb);
    }
}

Rdl DataSet Query

<Query>
<Method Namespace="http://tempuri.org/" Name="CatReport">
</Method>
<SoapAction>http://tempuri.org/IService1/CatReport</SoapAction>
</Query>

Any help to this problem will be highly appreciated.

DonMax
  • 970
  • 3
  • 12
  • 47

1 Answers1

0

Breaking the error message down into parts by sentence A - Obviously an error with deserialization! B - OK. The message body is invalid. C - This tells us it's ParameterClass that isn't been added to the hierarchy. D - CatReport is found, so it's below this.

Looking at the ParameterClass there appears to be a serialization directive but no element specified underneath. Suggested modification:

[MessageContract(IsWrapped = true)]
public class ParameterClass
{
    [MessageBodyMember]
    public string InformationType { get; set; }
    [MessageBodyMember]
    public string ItemLocation { get; set; }
}
Ian
  • 1