Ver Mensaje Individual
  #2  
Antiguo 16-09-2016
bucanero bucanero is offline
Miembro
 
Registrado: nov 2013
Ubicación: Almería, España
Posts: 208
Reputación: 11
bucanero Va camino a la fama
Tras investigar un poco el tema del envío y recepción de datos por parte de los componentes implicados en THTTPRIO, veo que lo datos que necesito obtener no llegan nunca al componente, por la forma en que este esta construido.

El componente donde se reciben los datos es THTTPReqResp y la parte del código donde se reciben dichos datos es:

Código Delphi [-]
unit Soap.SOAPHTTPTrans;

...

procedure THTTPReqResp.Receive(Context: Integer; Resp: TStream; IsGet: Boolean);
const
  MaxStatusTest = 4096;
  MaxContentType= 1024;
var
  Size, Downloaded, Status, Len, Index: DWord;
  S: string;
{$IFDEF UNICODE}
  Bytes: TBytes;
{$ENDIF}
begin
  Len := SizeOf(Status);
  Index := 0;

  { Handle error }
  if HttpQueryInfo(Pointer(Context), HTTP_QUERY_STATUS_CODE or HTTP_QUERY_FLAG_NUMBER,
    @Status, Len, Index) and (Status >= 300) and (Status <> 500) then
  begin
    Index := 0;
    Size := MaxStatusTest;
    SetLength(S, Size);
    if HttpQueryInfo(Pointer(Context), HTTP_QUERY_STATUS_TEXT, @S[Low(string)], Size, Index) then
    begin
      SetLength(S, Size div sizeof(Char));
      raise ESOAPHTTPException.CreateFmt('%s (%d) - ''%s''', [S, Status, FURL], Status);
    end;
  end;

  { Ask for Content-Type }
  Size := MaxContentType;
  SetLength(FContentType, MaxContentType);
  if (HttpQueryInfo(Pointer(Context), HTTP_QUERY_CONTENT_TYPE, @FContentType[Low(string)], Size, Index)) then
    SetLength(FContentType, Size div sizeof(Char))
  else
    // Raise GetLastError!
    Check(True);

...

end;

Al recibir la respuesta si su estado no es 200 ( y en mi caso devuelve error 400) inmediatamente salta una excepcion en siguiente linea

Código Delphi [-]
raise ESOAPHTTPException.CreateFmt('%s (%d) - ''%s''', [S, Status, FURL], Status);

sin terminar ya de ejecutar la siguiente parte del código, que es la que realmente obtiene el contenido del mensaje.

¿Hay alguna forma de sobreescribir ese método en particular sin tener que modificar todo el componente?
O alguna otra forma de obtener el RAW completo de la respuesta que devuelve el servidor.


Gracias de nuevo por su tiempo
Un saludo
Responder Con Cita