• Martes 16 de Abril de 2024, 14:48

Autor Tema:  .net Remoting Y Wsdl  (Leído 2544 veces)

Jonny

  • Nuevo Miembro
  • *
  • Mensajes: 3
    • Ver Perfil
.net Remoting Y Wsdl
« en: Miércoles 5 de Abril de 2006, 15:47 »
0
Buenas,

Estoy intentando publicar un servicio web mediante remoting, para ello utilizo una clase que hereda de MarshalByRefObject. Esta clase únicamente tiene un método, al que como parámetro se le pasa otra clase [Serializable] que he creado. Esta última clase hace implemeta un interface también creada por mí, que contiene unos metodos básicos para tratamiento de objetos.

De forma más clara:

ObjetoRemoto.cs

/* Librerias importadas ... */

public class ObjetoRemoto : MarshalByRefObject
{
  /* Campos ... */

  public override object InitializeLifetimeService()
  {
    /* Cuerpo ... */
  }

  public int Metodo(ObjetoSerializable obj)
  {
    /* Cuerpo ... */
  }
}

- - - - - - - - - - - - - - - - - - - - - - - - - - - -

ObjetoSerializable.cs

/* Librerias importadas ... */

[Serializable]
public class ObjetoSerializable : IMiInterface
{
  /* Campos ... */

  /* Metodos ... */
}

- - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMiInterface.cs

/* Librerias importadas ... */

public interface IMiInterface
{
  /* Métodos básicos ... */
}

Cuando publico este servicio en el puerto 5000 y con el nombre "Servicio.soap", la comunicación por remoting funciona bien, pero cuando intento generar la clase proxy mediante Soapsuds me da un error de servidor, y cuando pongo en el navegador http://localhost:5000/Servicio.soap?wsdl me da la siguiente excepción:

System.NullReferenceException: Referencia a objeto no establecida como instancia de un objeto.
   at System.Runtime.Remoting.MetadataServices.RealSchemaType.PrintMessageWsdl(TextWriter textWriter, StringBuilder sb, String indent, ArrayList refNames)
   at System.Runtime.Remoting.MetadataServices.XMLNamespace.PrintMessageWsdl(TextWriter textWriter, StringBuilder sb, String indent, ArrayList refNames)
   at System.Runtime.Remoting.MetadataServices.WsdlGenerator.PrintWsdl()
   at System.Runtime.Remoting.MetadataServices.WsdlGenerator.Generate()
   at System.Runtime.Remoting.MetadataServices.SUDSGenerator.Generate()
   at System.Runtime.Remoting.MetadataServices.MetaData.ConvertTypesToSchemaToStream(ServiceType[] serviceTypes, SdlType sdlType, Stream outputStream)
   at System.Runtime.Remoting.MetadataServices.SdlChannelSink.GenerateSdl(SdlType sdlType, IServerResponseChannelSinkStack sinkStack, ITransportHeaders requestHeaders, ITransportHeaders responseHeaders, Stream& outputStream)
   at System.Runtime.Remoting.MetadataServices.SdlChannelSink.ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders, Stream& responseStream)
   at System.Runtime.Remoting.Channels.Http.HttpServerTransportSink.ServiceRequest(Object state)
   at System.Runtime.Remoting.Channels.SocketHandler.ProcessRequestNow()

He comprobado que al no obligar al ObjetoSerializable a implementar el interface IMiInterface no me da ningún problema. Cada uno de estos tres ficheros pertenece a un assembly dirente, y también espacios de nombres diferentes. Mi objetivo es que se genere el WSDL en el primer ejemplo, ya que si el ObjetoSerializable no implementa IMiInterface pierde todas las funcionalidades de tratamiento de objetos que necesito.

¿Esto es un fallo del framework? ¿Tiene solución mi problema?

Gracias de antemano.

JuanK

  • Miembro de ORO
  • ******
  • Mensajes: 5393
  • Nacionalidad: co
    • Ver Perfil
    • http://juank.io
Re: .net Remoting Y Wsdl
« Respuesta #1 en: Jueves 24 de Agosto de 2006, 15:48 »
0
No se como lo estas implementando realmente... porque no colocas el codigo que estas usando...

En fi aca te coloco un ejemplo hecho con .net framework 2.0 usando remoting, http channels , este 'por debajo'  serializa datos con el SOAP Formatter. pero eso es transparente en su uso.

Espero te sea de ayuda.
El mensaje contiene 1 archivo adjunto. Debes ingresar o registrarte para poder verlo y descargarlo.
[size=109]Juan Carlos Ruiz Pacheco
[/size]
Microsoft Technical Evangelist
@JuanKRuiz
http://juank.io

JuanK

  • Miembro de ORO
  • ******
  • Mensajes: 5393
  • Nacionalidad: co
    • Ver Perfil
    • http://juank.io
Re: .net Remoting Y Wsdl
« Respuesta #2 en: Jueves 24 de Agosto de 2006, 15:50 »
0
Este es otro ejemplo.
Puntualmente serializacion SOAP usando el SOAP Formatter directamente.
El mensaje contiene 1 archivo adjunto. Debes ingresar o registrarte para poder verlo y descargarlo.
[size=109]Juan Carlos Ruiz Pacheco
[/size]
Microsoft Technical Evangelist
@JuanKRuiz
http://juank.io