The Pipeline is not valid

Topics: Web Api
Dec 22, 2010 at 7:45 AM

I have a a method with this signature:

[WebInvoke(Method = "POST", UriTemplate = "sessions", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
public string LogIN(string email, string password)

{

return "test";

}

I  have create a Processor like this:

    public class JsonNetProcessor : MediaTypeProcessor
    {
        private Type parameterType;
        public JsonNetProcessor(HttpOperationDescription operation, MediaTypeProcessorMode mode)
            : base(operation, mode)
        {
            if (this.Parameter != null)
            {
                this.parameterType = this.Parameter.ParameterType;
            }
        }
        public override IEnumerable<string> SupportedMediaTypes
        {
            get
            {
                return new List<string> { "text/json", "application/json" };
            }
        }
        public override void WriteToStream(object instance, Stream stream, HttpRequestMessage request)
        {
            var serializer = new JsonSerializer();
            
            using (var sw = new StreamWriter(stream))
            using (var writer = new JsonTextWriter(sw))
            {
                serializer.Serialize(writer, instance);
            }
        }
        public override object ReadFromStream(Stream stream, HttpRequestMessage request)
        {
            var serializer = new JsonSerializer();
            using (var sr = new StreamReader(stream))
            using (var reader = new JsonTextReader(sr))
            {
                var result = serializer.Deserialize(reader, parameterType);
                return result;
            }
        }
    }
when running the project I am getting this message:
The Pipeline is not valid because the input ProcessArgument with name 'password' on the Processor of type 'PipelineExitProcessor' at index '5' will never receive a value because it is not bound to the output of any Processor.

what is the PipelineExitProcessor? why do I get this message? what can I do to solve it?
Thanks in advanced,
Alon

Coordinator
Dec 22, 2010 at 8:50 AM
Wrapped body style is not supported currently. I am assuming you are passing email and password in Json.

To use the processor you have below you need to create a type that has Email and Password string properties and have a Param of that type on your operation.

You can also look at using our JsonProcessor and then supply the param as JsonValue which is an untyped way to work with Json,

We will support wrapped in the near future.

On Dec 22, 2010, at 12:47 AM, "shmely" <notifications@codeplex.com> wrote:

From: shmely

I have a a method with this signature:

[WebInvoke(Method = "POST", UriTemplate = "sessions", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
public string LogIN(string email, string password)

{

return "test";

}

I have create a Processor like this:

    public class JsonNetProcessor : MediaTypeProcessor
    {
        private Type parameterType;
        public JsonNetProcessor(HttpOperationDescription operation, MediaTypeProcessorMode mode)
            : base(operation, mode)
        {
            if (this.Parameter != null)
            {
                this.parameterType = this.Parameter.ParameterType;
            }
        }
        public override IEnumerable<string> SupportedMediaTypes
        {
            get
            {
                return new List<string> { "text/json", "application/json" };
            }
        }
        public override void WriteToStream(object instance, Stream stream, HttpRequestMessage request)
        {
            var serializer = new JsonSerializer();
            
            using (var sw = new StreamWriter(stream))
            using (var writer = new JsonTextWriter(sw))
            {
                serializer.Serialize(writer, instance);
            }
        }
        public override object ReadFromStream(Stream stream, HttpRequestMessage request)
        {
            var serializer = new JsonSerializer();
            using (var sr = new StreamReader(stream))
            using (var reader = new JsonTextReader(sr))
            {
                var result = serializer.Deserialize(reader, parameterType);
                return result;
            }
        }
    }
when running the project I am getting this message:
The Pipeline is not valid because the input ProcessArgument with name 'password' on the Processor of type 'PipelineExitProcessor' at index '5' will never receive a value because it is not bound to the output of any Processor.

what is the PipelineExitProcessor? why do I get this message? what can I do to solve it?
Thanks in advanced,
Alon

Dec 22, 2010 at 4:02 PM

Hi

 

Thank you.

It's partly working.

I have create an object with user and password.

I Can see that the function ReadFromStream ,Deserialize the object ok,

But on the login function: the sesssionDataobject is null.

[WebInvoke(Method = "POST", UriTemplate = "sessions")]       
        public string LogIN(SessionOperationData sessionData)

 

also tryed with the jsonvalue and it's null too.

Thanks in Advanced,

Alon