I am trying to write and call WCF web service, below are the details:
Web.config:
I believe mentioned error is quite self-explaining. According to the MSDN, using Message
class has its own restrictions:
You can use the Message class as an input parameter of an operation, the return value of an operation, or both. If Message is used anywhere in an operation, the following restrictions apply:
- The operation cannot have any out or ref parameters.
- There cannot be more than one input parameter. If the parameter is present, it must be either Message or a message contract type.
- The return type must be either void, Message, or a message contract type.
In case of your contract, the second restriction is violated. The easiest workaround is to create proper MessageContract:
[MessageContract]
public class RetrievePublishedDataInput
{
[MessageBodyMember] public string Pub;
[MessageBodyMember] public int Number;
}
private Message RetrievePublishedData(RetrievePublishedDataInput input)
{
....
}