¿Es posible implementar un redirector / proxy inverso usando SolicitudInterCeptor del kit de inicio de resorte WCF?

StackOverflow https://stackoverflow.com/questions/6054310

  •  15-11-2019
  •  | 
  •  

Pregunta

Estoy intentando implementar un proxy inverso usando el SolicitudIntereptor del kit de inicio de reposo WCF.Soy capaz de establecer las propiedades básicas del encabezado y configurar las llamadas.Me estoy quedando atascado con los siguientes aspectos:

  1. Devolver una respuesta apropiada: mi servicio web puede devolver el texto + XML, imagen o JSON.No puedo enviar el tipo de respuesta apropiado.Las sobrecargas de mensajes.creeMessage son todos alineados con jabón, es decir, solo aceptan construcciones XML, por lo que no puedo enviar transmisiones de JSON o imágenes.Necesito convertirlos en Xelements, definitivamente estoy haciendo algo mal aquí.

  2. También quiero que el proxy inverso funcione bien en presencia de cookies, gzip / deflate y SSL.

    Según los requisitos anteriores, ¿cree que tiene sentido hacer esto usando el kit de inicio de descanso?El requestorno fue bastante fácil de conectar, sin embargo, el resto del código me está impulsando las nueces.

¿Fue útil?

Solución

There is a mapping between both JSON and arbitrary binary content to XML which is used in messages for WCF (see some examples at http://blogs.msdn.com/b/carlosfigueira/archive/2011/04/19/wcf-extensibility-message-inspectors.aspx), so you can use Message.CreateMessage to create non-XML messages as well.

Having said that, it's really not intuitive to do that in WCF as of now. The new libraries in the WCF Web API - http://wcf.codeplex.com - provide a very nice way of intercepting / redirecting / bypassing the WCF pipeline especifically for HTTP messages. Also, it support multiple formats in a native way (i.e., without need to do some mapping to XML).

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top