Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > OOP
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 24-02-2016
jlrdz jlrdz is offline
Miembro
NULL
 
Registrado: ene 2011
Posts: 50
Poder: 14
jlrdz Va por buen camino
Question Error en componente HTTPRIO

Saludos a todos, desde hace días tengo un problema al tratar de consumir un Web Service el cual utilizo el componente THTTPRIO para hacer el llamado, ya importé el wsdl y me genera la Unit del servicio sin problema, tengo configurado las propiedades del componente, WSDLLocation, Service, Port...

Al momento de dar clic sobre el botón que me ejecuta el procedimiento me sale el error:

DTD is Prohibited
Line 1: <!DOCTYPE ...

Ya busqué en varios foros sobre este tema y me he revuelto, encontré la siguiente variable global que puse en False y el error continua:

Código Delphi [-]
function
TMSDOMDocument.GetMSDocument: IXMLDOMDocument;
begin
 Result := MSNode as IXMLDOMDocument;  

  if Result is IXMLDOMDocument2
  then

     (Result as IXMLDOMDocument2).ProhibitDTD := False;
end;

Actualmente no estoy usando algún componente TXMLDocument o algo que use la respuesta como XML, desconozco si tenga que hacerlo asi,
lo unico que tengo declarado es lo siguiente:

Código Delphi [-]
var
  resultadosF:Resultados; //Arreglo de resultado
  resultadoF :Resultado;
  l, i:Integer;
begin


    resultadosF := (HTTPRIO1 as MIWebServicePortType).ConsultaUsuario('usuario','password');

  l := Length(resultadosF);
  Memo1.Lines.Clear;

  for i := 0 to (l - 1) do begin
    resultadoF := resultadosF[i];

    Memo1.Lines.Add('Id: ' + IntToStr(resultadoF.Id));
    Memo1.Lines.Add('Mensaje: ' + resultadoF.msg);

  end;

end;

El proyecto lo estoy desarrollando con Delphi XE8, el mismo web service lo he consumido con otras herramientas y no da problema, una de ellas es la extensión para google chrome que se llama Boomerang, me regresa la información correcta y sin problemas, el service esta hecho con PHP y la libreria NUSOAP.

Espero por favor puedan ayudarme y de antemano muchas gracias por tomarse el tiempo de leer.
Saludos.
Responder Con Cita
  #2  
Antiguo 24-02-2016
bitbow bitbow is offline
Miembro
 
Registrado: jul 2006
Posts: 366
Poder: 18
bitbow Va camino a la fama
Debes revisar las unidades donde se define la interface con el webservice, las que se generan al importar el wsdl, si es posible publica el codigo para que podamos apoyarte mejor.

Saludos.
__________________
¡Ni como ayudarte Niño!!
bitbow
Responder Con Cita
  #3  
Antiguo 25-02-2016
jlrdz jlrdz is offline
Miembro
NULL
 
Registrado: ene 2011
Posts: 50
Poder: 14
jlrdz Va por buen camino
Cita:
Empezado por bitbow Ver Mensaje
Debes revisar las unidades donde se define la interface con el webservice, las que se generan al importar el wsdl, si es posible publica el codigo para que podamos apoyarte mejor.

Saludos.
Gracias por tu respuesta amigo, aquí publico el Unit que me genera al usar el wizard para importar el wsdl.

Saludos.

Código Delphi [-]
// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL     : http://localhost/monitor/index.php/PruebaWS?wsdl
//  >Import : http://localhost/monitor/index.php/PruebaWS?wsdl>0
// Encoding : ISO-8859-1
// Version  : 1.0
// (24/02/2016 05:30:33 p.m. - - $Rev: 56641 $)
// ************************************************************************ //

unit PruebaWS;

interface

uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;

type

  // ************************************************************************ //
  // The following types, referred to in the WSDL document are not being represented
  // in this file. They are either aliases[@] of other types represented or were referred
  // to but never[!] declared in the document. The types from the latter category
  // typically map to predefined/known XML or Embarcadero types; however, they could also 
  // indicate incorrect WSDL documents that failed to declare or import a schema type.
  // ************************************************************************ //
  // !:string          - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:int             - "http://www.w3.org/2001/XMLSchema"[Gbl]

  Resultado            = class;                 { "http://localhost/monitor/index.php?/PruebaWS/"[GblCplx] }

  Resultados = array of Resultado;              { "http://localhost/monitor/index.php?/PruebaWS/"[GblCplx] }


  // ************************************************************************ //
  // XML       : Resultado, global, 
  // Namespace : http://localhost/monitor/index.php?/PruebaWS/
  // ************************************************************************ //
  Resultado = class(TRemotable)
  private
    Fid: Integer;
    Fmsg: string;
  published
    property id:  Integer  read Fid write Fid;
    property msg: string   read Fmsg write Fmsg;
  end;


  // ************************************************************************ //
  // Namespace : urn:PruebaWS
  // soapAction: urn:http://localhost/monitor/index.php?/...operationName%
  // transport : http://schemas.xmlsoap.org/soap/http
  // style     : rpc
  // use       : encoded
  // binding   : PruebaWSBinding
  // service   : PruebaWS
  // port      : PruebaWSPort
  // URL       : http://localhost/monitor/index.php/PruebaWS
  // ************************************************************************ //
  PruebaWSPortType = interface(IInvokable)
  ['{0165AD64-F0D9-9910-7FFC-A13240734C57}']
    function  ConsultaUsuario(const username: string; const password: string): Resultados; stdcall;
    function  ValidaDato(const username: string; const password: string; const identificador: string): Resultados; stdcall;
  end;

function GetPruebaWSPortType(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): PruebaWSPortType;


implementation
  uses SysUtils;

function GetPruebaWSPortType(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): PruebaWSPortType;
const
  defWSDL = 'http://localhost/monitor/index.php/PruebaWS?wsdl';
  defURL  = 'http://localhost/monitor/index.php/PruebaWS';
  defSvc  = 'PruebaWS';
  defPrt  = 'PruebaWSPort';
var
  RIO: THTTPRIO;
begin
  Result := nil;
  if (Addr = '') then
  begin
    if UseWSDL then
      Addr := defWSDL
    else
      Addr := defURL;
  end;
  if HTTPRIO = nil then
    RIO := THTTPRIO.Create(nil)
  else
    RIO := HTTPRIO;
  try
    Result := (RIO as PruebaWSPortType);
    if UseWSDL then
    begin
      RIO.WSDLLocation := Addr;
      RIO.Service := defSvc;
      RIO.Port := defPrt;
    end else
      RIO.URL := Addr;
  finally
    if (Result = nil) and (HTTPRIO = nil) then
      RIO.Free;
  end;
end;


initialization
  { PruebaWSPortType }
  InvRegistry.RegisterInterface(TypeInfo(PruebaWSPortType), 'urn:PruebaWS', 'ISO-8859-1');
  InvRegistry.RegisterDefaultSOAPAction(TypeInfo(PruebaWSPortType), 'urn:http://localhost/monitor/index.php?/...onName%');
  RemClassRegistry.RegisterXSInfo(TypeInfo(Resultados), 'http://localhost/monitor/index.php?/PruebaWS/', 'Resultados');
  RemClassRegistry.RegisterXSClass(Resultado, 'http://localhost/monitor/index.php?/PruebaWS/', 'Resultado');

end.
Responder Con Cita
  #4  
Antiguo 25-02-2016
Avatar de ElKurgan
[ElKurgan] ElKurgan is offline
Miembro Premium
 
Registrado: nov 2005
Posts: 1.234
Poder: 20
ElKurgan Va camino a la fama
tu no estas usando ningún XML, pero si el web service tiene definidos los campos dentro de un TDT entonces intentará cargarlo al abrir el WS.

¿Es un WS creado por ti? ¿Es uno creado por otros?

Normalmente, si el servicio tiene extensión "wsdl" se puede abrir con el navegador de Internet y ahí te muestra los archivos que utiliza para la validación, incluido cualquier tdt.

Si no, ¿podrías compartirlo con el grupo para que le echemos un vistazo?

Saludos
Responder Con Cita
  #5  
Antiguo 25-02-2016
jlrdz jlrdz is offline
Miembro
NULL
 
Registrado: ene 2011
Posts: 50
Poder: 14
jlrdz Va por buen camino
Cita:
Empezado por ElKurgan Ver Mensaje
tu no estas usando ningún XML, pero si el web service tiene definidos los campos dentro de un TDT entonces intentará cargarlo al abrir el WS.

¿Es un WS creado por ti? ¿Es uno creado por otros?

Normalmente, si el servicio tiene extensión "wsdl" se puede abrir con el navegador de Internet y ahí te muestra los archivos que utiliza para la validación, incluido cualquier tdt.

Si no, ¿podrías compartirlo con el grupo para que le echemos un vistazo?

Saludos

Gracias por tu respuesta ElKurgan, y sí, el ws lo hice yo, este es el wsdl.
Código PHP:
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://localhost/monitor/index.php?/PruebaWS/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://localhost/monitor/index.php?/PruebaWS/">
<
types>
<
xsd:schema targetNamespace="http://localhost/monitor/index.php?/PruebaWS/">
<
xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<
xsd:import namespace="http://schemas.xmlsoap.org/wsdl/"/>
<
xsd:complexType name="Resultado">
<
xsd:all>
<
xsd:element name="id" type="xsd:int"/>
<
xsd:element name="msg" type="xsd:string"/>
</
xsd:all>
</
xsd:complexType>
<
xsd:complexType name="Resultados">
<
xsd:complexContent>
<
xsd:restriction base="SOAP-ENC:Array">
<
xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:Resultado[]"/>
</
xsd:restriction>
</
xsd:complexContent>
</
xsd:complexType>
</
xsd:schema>
</
types>
<
message name="ConsultaUsuarioRequest">
<
part name="username" type="xsd:string"/>
<
part name="password" type="xsd:string"/>
</
message>
<
message name="ConsultaUsuarioResponse">
<
part name="return" type="tns:Resultados"/>
</
message>
<
message name="ValidaDatoRequest">
<
part name="username" type="xsd:string"/>
<
part name="password" type="xsd:string"/>
<
part name="identificador" type="xsd:string"/>
</
message>
<
message name="ValidaDatoResponse">
<
part name="return" type="tns:Resultados"/>
</
message>
<
portType name="PruebaWSPortType">
<
operation name="ConsultaUsuario">
<
documentation>Valida usuario en sistema.</documentation>
<
input message="tns:ConsultaUsuarioRequest"/>
<
output message="tns:ConsultaUsuarioResponse"/>
</
operation>
<
operation name="ValidaDato">
<
documentation>Valida dato emitido.</documentation>
<
input message="tns:ValidaDatoRequest"/>
<
output message="tns:ValidaDatoResponse"/>
</
operation>
</
portType>
<
binding name="PruebaWSBinding" type="tns:PruebaWSPortType">
<
soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<
operation name="ConsultaUsuario">
<
soap:operation soapAction="urn:http://localhost/monitor/index.php?/PruebaWS/ConsultaUsuario" style="rpc"/>
<
input>
<
soap:body use="encoded" namespace="urn:PruebaWS" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</
input>
<
output>
<
soap:body use="encoded" namespace="urn:PruebaWS" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</
output>
</
operation>
<
operation name="ValidaDato">
<
soap:operation soapAction="urn:http://localhost/monitor/index.php?/PruebaWS/ValidaDato" style="rpc"/>
<
input>
<
soap:body use="encoded" namespace="urn:PruebaWS" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</
input>
<
output>
<
soap:body use="encoded" namespace="urn:PruebaWS" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</
output>
</
operation>
</
binding>
<
service name="PruebaWS">
<
port name="PruebaWSPort" binding="tns:PruebaWSBinding">
<
soap:address location="http://localhost/monitor/index.php/PruebaWS"/>
</
port>
</
service>
</
definitions
Responder Con Cita
  #6  
Antiguo 29-02-2016
Avatar de ElKurgan
[ElKurgan] ElKurgan is offline
Miembro Premium
 
Registrado: nov 2005
Posts: 1.234
Poder: 20
ElKurgan Va camino a la fama
Perdona que haya tardado tanto en contestar. No tengo PHP ni la librería que comentas, pero he creado un webservice (más o menos) como el tuyo desde Delphi XE7 y no me ha dado ningún problema.

¿Es posible que sea la librería la que internamente esté indicando que haya que cargar algún archivo y que se nos pase por alto?

Ya te digo, haciendo todos los pasos en el propio Delphi no da ningún problema.
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
WebServices HTTPRIO SOAP XmlBlackBox ppb Internet 1 06-11-2012 17:55:04
Problema con HTTPRIO. JFHS3811 Internet 0 30-12-2011 15:38:14
error componente!!!!! MARLON1 Varios 1 17-12-2009 20:19:06
HTTPRIO e hilos azulin Internet 1 04-04-2009 14:22:31
HTTPRIO y el Registry ¿unica opción? kaopectate Internet 5 08-11-2007 17:21:35


La franja horaria es GMT +2. Ahora son las 03:24:25.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi