Ver Mensaje Individual
  #6  
Antiguo 19-03-2015
frankizzio frankizzio is offline
Miembro
NULL
 
Registrado: abr 2013
Posts: 10
Reputación: 0
frankizzio Va por buen camino
Consumir servicio con WDSL - autentificación WS-Security

Lo resolví utilizando esta función

Código Delphi [-]
function GetbillService(UseWSDL: Boolean; Addr: string;var HTTPRIO: THTTPRIO): billService;
 const
  defWSDL = 'htt ps://ww w. sunat. gob. pe:443/ol-ti-itcpgem-beta/billService?wsdl';
  defURL  = 'htt ps://w ww.s unat. gob. pe:443/ol-ti-itcpgem-beta/billService';
  defSvc  = 'billService';
  defPrt  = 'BillServicePort';
 var
  RIO: THTTPRIO;
 begin
  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 billService);
    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;

Y utilizandolo en la acción del botón

Código Delphi [-]
    tBillServ:=GetbillService(True,'',HTTPRIO1);

Establezco la conexión pero el WSDL Importer no generó la cabecera de seguridad UsernameToken, ahora un nuevo dilema, buscando en internet encuentro info sobre como implementar una unit llamada WSSE.pas pero no me queda claro su función
Cómo puedo configurar la cabecera para que aparezca de la siguiente manera

Código:
<soapenv:Envelope xmlns:soapenv="ht tp:// sc hem as. xmls ap .o rg/soap/env elope/" xmlns:ser="h tt p: //ser vice. sun at .go b .pe" xmlns:wsse="ht tp:// do cs. oasis- op en. org /wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> <soapenv:Header> <wsse:Security> <wsse:UsernameToken> <wsse:Username>20100066603MODDATOS</wsse:Username> <wsse:Password>moddatos</wsse:Password> </wsse:UsernameToken> </wsse:Security> </soapenv:Header> <soapenv:Body> <ser:sendBill> <fileName>20100066603-01-F001-1.zip</fileName> <contentFile>cid:20100066603-01-F001-1.zip</contentFile> </ser:sendBill> </soapenv:Body> </soapenv:Envelope>
Responder Con Cita