c# - Routing JSON string in ServiceStack -


i have service accepts encrypted json data want decrypt json data using external service can pass unencrypted data serialized , handled appropriate service handler.

the dto encrypted data looks this:

[route("/encrypted", "post")] public encrypted {     public string data { get; set; } // value stored here encrypted } 

here's sample dto decrypted data:

[route("/book", "post")] public book {     public string author { get; set; } } 

the decryption , book services this:

public class decryptionservice : service {     public string post(encrypted request)     {          // decrypt request.data , return decrypted json string     } }  public class bookservice : service {     public object post(book request)     {         // return list of books based on author     } } 

in servicestack apphost read raw json data request input stream deserialize encrypted object, calling encryptedservice class decrypt data , return unencrypted json string:

// bit done in request filter method encrypted encdto = jsonserializer.deserializefromstring<encrypted>(reqinputstreamcontent); string jsonresult = new encryptedservice().post(encdto); 

i want requests come in on regular resource routes, eg. /book or /person, etc. json requests looking like:

{     "data":"some encrypted data" } 

then data gets decrypted , passed on appropriate verb handler, whether book.post or person.post, etc. tricky part wont know plain json request looks until decrypted. after decrypted i'll have determine service handler should handle request.

how can pass unencrypted json string appropriate service handler? tried deserializing decrypted json string object publish object in hopes correct registered message handler pick , handler it, didn't work though.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -