Hey there!
I am getting the following exception and don't have much clue about what and how it should be fixed:
The operation 'ShowData' could not be loaded because it has a parameter or return type of type System.ServiceModel.Channels.Message or a type that has MessageContractAttribute and other parameters of different types. When using System.ServiceModel.Channels.Message or types with MessageContractAttribute, the method must not use any other types of parameters.
My code:
[ServiceContract(SessionMode=SessionMode.NotAllowed)]
public interface IHelper
{
[WebGet(UriTemplate = "/cgi/manager.exe?GetData={data}")]
[OperationContract]
Message ShowData(int data);
}
public class Helper : IHelper
{
public Message ShowData(int data)
{
var result = new StringBuilder(...);
foreach (...)
{
result.AppendFormat(...);
}
result.AppendLine(...);
return WebOperationContext.Current.CreateTextResponse(result.ToString(), "text/xml", Encoding.ASCII);
}
I guess it says that I can't intermix Message
with int
? What is the correct way to rely on parsing the request than?