locked
Getting the value from the request RRS feed

  • Question

  • User-1439110336 posted

    Hi

    I have a service in which I pass some string type parameters in the request, some <T> list etc. I have an Interceptor that validates and checks if everything is ok. Details are not important. In the inteceptor I want to pull the value of one parameter.

    I have a class prepared that accepts an object field called e.g. RequestInput (the name is also not important). I would like to get one value from this type of Object Requestpart: rq.RequestInput, of course, this is not my property, I tried in different ways with getType etc. but to no avail,

    Example code:

    privte class NewClassType
    {
      public string Name {get; set;}
      public object Request {get; set;}
    }

    And I want to read my data pass in request and their value. 

    Can I ask you for help?

    Friday, May 29, 2020 12:35 PM

All replies

  • User475983607 posted

    Antero00

    Hi

    I have a service in which I pass some string type parameters in the request, some <T> list etc. I have an Interceptor that validates and checks if everything is ok. Details are not important. In the inteceptor I want to pull the value of one parameter.

    I have a class prepared that accepts an object field called e.g. RequestInput (the name is also not important). I would like to get one value from this type of Object Requestpart: rq.RequestInput, of course, this is not my property, I tried in different ways with getType etc. but to no avail,

    Example code:

    privte class NewClassType
    {
      public string Name {get; set;}
      public object Request {get; set;}
    }

    And I want to read my data pass in request and their value. 

    Can I ask you for help?

    Honestly, your question makes little to no sense. 

    The class is private.  Misspelled but I assume you mean private.  Anyway, a private class can be a problem because only public properties are serialized by the framework.  Unfortunately, you have not provided enough details on how the HTTP request is generated.

    The HTTP POST message body contains the data.  The data format varies; JSON, XML, SOAP, or x-www-form-urlencoded.  All you need to do is read the request body and deserialize the data according to the content-type.  I assume you trying to grab the data in the HTTP pipeline given your vague problem statement.  Maybe this is this a WCF question?

    Friday, May 29, 2020 3:26 PM
  • User-1439110336 posted

    Hi, 

    Data format is SOAP, and I have service, and before started every services is exectued Interceptor where I check any parameters, session etc. 

    And I have implemented private class which has a property like 

    private class RqInput
    {
    object Request {get; set;}
    }

    I also have a method which retrives data from invocation and completes object about type RqInput 

    In this request I have many parameters like string name, List<...> somethingElse and I want to get value from for example name property which is passed in request. 

    In "Request" property which has object typa I have all parameters which is in rq. I want to write one value in a variable

    Friday, May 29, 2020 6:14 PM
  • User1535942433 posted

    Hi Antero00,

    Accroding to your description,I don't understand your requirment clearly.

    Could you tell us what the type of your project?Do you want to serialize and get the value from the request?

    Could you post more details of your requirments and full codes to us?It will help us to solve your problems.

    Best regards,

    Yijing Sun

    Tuesday, June 2, 2020 8:34 AM