Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Delphi para la web
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 27-12-2021
Muriel Muriel is offline
Miembro
 
Registrado: ago 2008
Posts: 19
Poder: 0
Muriel Va por buen camino
consumir web service SOAP con TOKEN en delphi

Hola amigos del foro,
Acudo a ustedes por la inexperiencia que tengo en consumir servicios web y peor todavía con un token que no se envía como parámetro, espero que ayuden , de ante mano les agradezca mucho.
Esto es el ejemplo que pone el proveedor en NETCORE y PHP y algo de recomendación que les deja abajo.


Para realizar el consumo de los servicios que solicitan la autenticación mediante el uso de token, se debe considerar en el header del servicio el parámetro: Authorization y el valor: “Token VALORTOKEN”. Donde la variable “VALORTOKEN” es el Token que se obtuvo a través del servicio de autenticación.

Nota.- La inclusión del Token de la petición SOAP debe hacerse en la cabecera HTTP y no así en la cabecera XML del request

Para efectos ilustrativos, se ejemplifica en los siguientes lenguajes:

Código en PHP:

<?php

/** Ejemplo de manejo de SOAP con libreria de PHP php-soap */

$wsdl = "https://pilotosiatservicios.impuestos.gob.bo/v1/FacturacionCodigos?wsdl";

$token = 'VALOR_TOKEN';

$opts = array(
'http' => array(
'header' => "Authorization: Token $token",
)
);

$context = stream_context_create($opts);

$client = new \SoapClient($wsdl, [
'stream_context' => $context,
'cache_wsdl' => WSDL_CACHE_NONE,
'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | SOAP_COMPRESSION_DEFLATE,

// other options
]);

$respons = $client->verificarComunicacion();
?>

Código en .NETCORE:

using System;
using System.ServiceModel;
using ServiceReference;
using System.Xml;
using System.Threading.Tasks;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
using System.ServiceModel.Channels;

namespace client
{
class Program
{
private static string endpointAddress = "https://pilotosiatservicios.impuestos.gob.bo/v1/FacturacionCodigos?wsdl";
static void Main(string[] args)
{
string token = "TOKEN";

BasicHttpBinding binding = new BasicHttpBinding
{
SendTimeout = TimeSpan.FromSeconds(1000),
MaxBufferSize = int.MaxValue,
MaxReceivedMessageSize = int.MaxValue,
AllowCookies = true,
ReaderQuotas = XmlDictionaryReaderQuotas.Max
};
binding.Security.Mode = BasicHttpSecurityMode.Transport; // https
//binding.Security.Mode = BasicHttpSecurityMode.None; // http
EndpointAddress address = new EndpointAddress(endpointAddress);
ServicioFacturacionCodigosClient servicio = new ServicioFacturacionCodigosClient(binding, address);
servicio.Endpoint.EndpointBehaviors.Add(new CustomAuthenticationBehaviour($"Token {token}"));
try {
Task<verificarComunicacionResponse> resp = servicio.verificarComunicacionAsync();
resp.Wait();
Console.WriteLine(resp.Result.@return);
} catch (Exception e) {
Console.WriteLine($"{e.Message}");
}
}
}

public class CustomMessageInspector : IClientMessageInspector
{
readonly string _authToken;

public CustomMessageInspector(string authToken)
{
_authToken = authToken;
}

public object BeforeSendRequest(ref Message request, IClientChannel channel)
{
var reqMsgProperty = new HttpRequestMessageProperty();
reqMsgProperty.Headers.Add("Authorization", _authToken);
request.Properties[HttpRequestMessageProperty.Name] = reqMsgProperty;
return null;
}

public void AfterReceiveReply(ref Message reply, object correlationState)
{ }
}
}
Responder Con Cita
  #2  
Antiguo 28-12-2021
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - España
Posts: 18.233
Poder: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
Cita:
Empezado por Muriel Ver Mensaje
Para realizar el consumo de los servicios que solicitan la autenticación mediante el uso de token, se debe considerar en el header del servicio el parámetro: Authorization y el valor: “Token VALORTOKEN”.

Donde la variable “VALORTOKEN” es el Token que se obtuvo a través del servicio de autenticación.

Por lo que entiendo, primero debes hacer una llamada al servicio de autenticación para obener el token.
De este servicio no comentas nada, así que supongo que la documentación debe explicar cómo hacer la llamada.


Una vez que tengas el token, importa el WSDl desde Delphi y realiza la llamada con HTTPRIO de la forma estandard. Lo único que para añadir el parámetro a la cabecera tal vez tengas que utilizar el evento HTTPRio.HTTPWebNode.OnBeforePost. Aquí tienes un ejemplo, aunque si buscas por la web encontrarás más.
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita
  #3  
Antiguo 28-12-2021
Muriel Muriel is offline
Miembro
 
Registrado: ago 2008
Posts: 19
Poder: 0
Muriel Va por buen camino
Cita:
Empezado por Neftali [Germán.Estévez] Ver Mensaje
Por lo que entiendo, primero debes hacer una llamada al servicio de autenticación para obener el token.
De este servicio no comentas nada, así que supongo que la documentación debe explicar cómo hacer la llamada.


Una vez que tengas el token, importa el WSDl desde Delphi y realiza la llamada con HTTPRIO de la forma estandard. Lo único que para añadir el parámetro a la cabecera tal vez tengas que utilizar el evento HTTPRio.HTTPWebNode.OnBeforePost. Aquí tienes un ejemplo, aunque si buscas por la web encontrarás más.
Hola Neftali te agradezco mucho por responder, te comento que yo tengo en TOKEN pero no tengo ni la menor idea de como utilizar eso.
no lo pongo aquí el TOKEN polo delicado que es eso si puedes hacer un ejemplo con un token ficticio según tu criterio te agradecería o en todo caso te lo puedo enviar por algún medio internamente.
Responder Con Cita
  #4  
Antiguo 28-12-2021
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - España
Posts: 18.233
Poder: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
No hace falta que pongas aquí el token, ya nos imaginamos que es una determinada cadena XXXXXXXXX.
Aquí tienes un ejemplo de cómo utilizar los compoenntes SOAP (revisa el tercer ejemplo de la página) para acceder a un WebService.
Paso a paso te explica cómo importar el WSDL desde tu proyecto y cómo utilizarlo en Delphi. Eso mismo tendrás que hacer con el WSDL que has colocado antes.
La diferencia es el parámetro de "autentificación" y para eso tienes código de ejemplo en los links anteriores.
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita
  #5  
Antiguo 02-01-2022
CrazySoft CrazySoft is offline
Miembro
 
Registrado: abr 2005
Posts: 96
Poder: 19
CrazySoft Va por buen camino
Buen día, yo tambien estoy con problemas con el sevicio que ofrecen, porque no aparecen algunas funciones al importra el servicio, por ejemplo la solicitud del CUIS deberia haber una funcion "SolicitudCuis" segun el manual https://siatinfo.impuestos.gob.bo/in...solicitud-cuis






Código Delphi [-]// ************************************************************************ // // The types declared in this file were generated from data read from the // WSDL File described below: // WSDL : https://pilotosiatservicios.impuesto...utarizada?wsdl // >Import : https://pilotosiatservicios.impuesto...cturacion.wsdl // >Import : https://pilotosiatservicios.impuestos.gob.bo/v2/ServicioFacturacionComputarizada?wsdl=ServicioFacturacion.wsdl>0 // Encoding : UTF-8 // Codegen : [wfServer+, wfOutputLiteralTypes+, wfMapStringsToWideStrings+, wfMapArraysToClasses+, wfGenTrueGUIDs+, wfAllowOutParameters+, wfUseSettersAndGetters+, wfUseXSTypeForSimpleNillable+, wfCreateArrayElemTypeAlias+, wfMergeDuplicateTypes+] // Version : 1.0 // (18/12/2021 07:00:08 a. m. - - $Rev: 103843 $) // ************************************************************************ // unit ServicioFacturacionComputarizada; interface //uses Soap.InvokeRegistry, Soap.SOAPHTTPClient, System.Types, Soap.XSBuiltIns; uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns; const IS_OPTN = $0001; IS_UNBD = $0002; IS_NLBL = $0004; IS_UNQL = $0008; 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. // ************************************************************************ // // !:long - "http://www.w3.org/2001/XMLSchema"[Gbl] // !:int - "http://www.w3.org/2001/XMLSchema"[Gbl] // !:string - "http://www.w3.org/2001/XMLSchema"[Gbl] // !:boolean - "http://www.w3.org/2001/XMLSchema"[Gbl] // !:base64Binary - "http://www.w3.org/2001/XMLSchema"[Gbl] model = class; { "https://siat.impuestos.gob.bo/"[GblCplx] } modelDto = class; { "https://siat.impuestos.gob.bo/"[GblCplx] } respuestaComunicacion = class; { "https://siat.impuestos.gob.bo/"[GblCplx] } mensajeServicio = class; { "https://siat.impuestos.gob.bo/"[GblCplx] } mensajeRecepcion = class; { "https://siat.impuestos.gob.bo/"[GblCplx] } solicitudRecepcion = class; { "https://siat.impuestos.gob.bo/"[GblCplx] } solicitudVerificacionEstado = class; { "https://siat.impuestos.gob.bo/"[GblCplx] } solicitudAnulacion = class; { "https://siat.impuestos.gob.bo/"[GblCplx] } solicitudValidacionRecepcion = class; { "https://siat.impuestos.gob.bo/"[GblCplx] } solicitudRecepcionFactura = class; { "https://siat.impuestos.gob.bo/"[GblCplx] } solicitudRecepcionPaquete = class; { "https://siat.impuestos.gob.bo/"[GblCplx] } solicitudRecepcionMasiva = class; { "https://siat.impuestos.gob.bo/"[GblCplx] } respuestaRecepcion = class; { "https://siat.impuestos.gob.bo/"[GblCplx] } Array_Of_mensajeRecepcion = array of mensajeRecepcion; { "https://siat.impuestos.gob.bo/"[GblUbnd] } Array_Of_mensajeServicio = array of mensajeServicio; { "https://siat.impuestos.gob.bo/"[GblUbnd] } // ************************************************************************ // // XML : model, global, // Namespace : https://siat.impuestos.gob.bo/ // ************************************************************************ // model = class(TRemotable) private published end; // ************************************************************************ // // XML : modelDto, global, // Namespace : https://siat.impuestos.gob.bo/ // ************************************************************************ // modelDto = class(model) private published end; // ************************************************************************ // // XML : respuestaComunicacion, global, // Namespace : https://siat.impuestos.gob.bo/ // ************************************************************************ // respuestaComunicacion = class(modelDto) private FmensajesList: Array_Of_mensajeServicio; FmensajesList_Specified: boolean; Ftransaccion: Boolean; Ftransaccion_Specified: boolean; function GetmensajesList(Index: Integer): Array_Of_mensajeServicio; procedure SetmensajesList(Index: Integer; const AArray_Of_mensajeServicio: Array_Of_mensajeServicio); function mensajesList_Specified(Index: Integer): boolean; function Gettransaccion(Index: Integer): Boolean; procedure Settransaccion(Index: Integer; const ABoolean: Boolean); function transaccion_Specified(Index: Integer): boolean; published property mensajesList: Array_Of_mensajeServicio Index (IS_OPTN or IS_UNBD or IS_NLBL or IS_UNQL) read GetmensajesList write SetmensajesList stored mensajesList_Specified; property transaccion: Boolean Index (IS_OPTN or IS_UNQL) read Gettransaccion write Settransaccion stored transaccion_Specified; end; // ************************************************************************ // // XML : mensajeServicio, global, // Namespace : https://siat.impuestos.gob.bo/ // ************************************************************************ // mensajeServicio = class(modelDto) private Fcodigo: Integer; Fcodigo_Specified: boolean; Fdescripcion: WideString; Fdescripcion_Specified: boolean; function Getcodigo(Index: Integer): Integer; procedure Setcodigo(Index: Integer; const AInteger: Integer); function codigo_Specified(Index: Integer): boolean; function Getdescripcion(Index: Integer): WideString; procedure Setdescripcion(Index: Integer; const AWideString: WideString); function descripcion_Specified(Index: Integer): boolean; published property codigo: Integer Index (IS_OPTN or IS_UNQL) read Getcodigo write Setcodigo stored codigo_Specified; property descripcion: WideString Index (IS_OPTN or IS_UNQL) read Getdescripcion write Setdescripcion stored descripcion_Specified; end; // ************************************************************************ // // XML : mensajeRecepcion, global, // Namespace : https://siat.impuestos.gob.bo/ // ************************************************************************ // mensajeRecepcion = class(mensajeServicio) private Fadvertencia: Boolean; Fadvertencia_Specified: boolean; FnumeroArchivo: Integer; FnumeroArchivo_Specified: boolean; FnumeroDetalle: Integer; FnumeroDetalle_Specified: boolean; function Getadvertencia(Index: Integer): Boolean; procedure Setadvertencia(Index: Integer; const ABoolean: Boolean); function advertencia_Specified(Index: Integer): boolean; function GetnumeroArchivo(Index: Integer): Integer; procedure SetnumeroArchivo(Index: Integer; const AInteger: Integer); function numeroArchivo_Specified(Index: Integer): boolean; function GetnumeroDetalle(Index: Integer): Integer; procedure SetnumeroDetalle(Index: Integer; const AInteger: Integer); function numeroDetalle_Specified(Index: Integer): boolean; published property advertencia: Boolean Index (IS_OPTN or IS_UNQL) read Getadvertencia write Setadvertencia stored advertencia_Specified; property numeroArchivo: Integer Index (IS_OPTN or IS_UNQL) read GetnumeroArchivo write SetnumeroArchivo stored numeroArchivo_Specified; property numeroDetalle: Integer Index (IS_OPTN or IS_UNQL) read GetnumeroDetalle write SetnumeroDetalle stored numeroDetalle_Specified; end; // ************************************************************************ // // XML : solicitudRecepcion, global, // Namespace : https://siat.impuestos.gob.bo/ // ************************************************************************ // solicitudRecepcion = class(modelDto) private FcodigoAmbiente: Integer; FcodigoDocumentoSector: Integer; FcodigoEmision: Integer; FcodigoModalidad: Integer; FcodigoPuntoVenta: Integer; FcodigoPuntoVenta_Specified: boolean; FcodigoSistema: WideString; FcodigoSucursal: Integer; Fcufd: WideString; Fcuis: WideString; Fnit: Int64; FtipoFacturaDocumento: Integer; function GetcodigoAmbiente(Index: Integer): Integer; procedure SetcodigoAmbiente(Index: Integer; const AInteger: Integer); function GetcodigoDocumentoSector(Index: Integer): Integer; procedure SetcodigoDocumentoSector(Index: Integer; const AInteger: Integer); function GetcodigoEmision(Index: Integer): Integer; procedure SetcodigoEmision(Index: Integer; const AInteger: Integer); function GetcodigoModalidad(Index: Integer): Integer; procedure SetcodigoModalidad(Index: Integer; const AInteger: Integer); function GetcodigoPuntoVenta(Index: Integer): Integer; procedure SetcodigoPuntoVenta(Index: Integer; const AInteger: Integer); function codigoPuntoVenta_Specified(Index: Integer): boolean; function GetcodigoSistema(Index: Integer): WideString; procedure SetcodigoSistema(Index: Integer; const AWideString: WideString); function GetcodigoSucursal(Index: Integer): Integer; procedure SetcodigoSucursal(Index: Integer; const AInteger: Integer); function Getcufd(Index: Integer): WideString; procedure Setcufd(Index: Integer; const AWideString: WideString); function Getcuis(Index: Integer): WideString; procedure Setcuis(Index: Integer; const AWideString: WideString); function Getnit(Index: Integer): Int64; procedure Setnit(Index: Integer; const AInt64: Int64); function GettipoFacturaDocumento(Index: Integer): Integer; procedure SettipoFacturaDocumento(Index: Integer; const AInteger: Integer); published property codigoAmbiente: Integer Index (IS_UNQL) read GetcodigoAmbiente write SetcodigoAmbiente; property codigoDocumentoSector: Integer Index (IS_UNQL) read GetcodigoDocumentoSector write SetcodigoDocumentoSector; property codigoEmision: Integer Index (IS_UNQL) read GetcodigoEmision write SetcodigoEmision; property codigoModalidad: Integer Index (IS_UNQL) read GetcodigoModalidad write SetcodigoModalidad; property codigoPuntoVenta: Integer Index (IS_OPTN or IS_UNQL) read GetcodigoPuntoVenta write SetcodigoPuntoVenta stored codigoPuntoVenta_Specified; property codigoSistema: WideString Index (IS_UNQL) read GetcodigoSistema write SetcodigoSistema; property codigoSucursal: Integer Index (IS_UNQL) read GetcodigoSucursal write SetcodigoSucursal; property cufd: WideString Index (IS_UNQL) read Getcufd write Setcufd; property cuis: WideString Index (IS_UNQL) read Getcuis write Setcuis; property nit: Int64 Index (IS_UNQL) read Getnit write Setnit; property tipoFacturaDocumento: Integer Index (IS_UNQL) read GettipoFacturaDocumento write SettipoFacturaDocumento; end; // ************************************************************************ // // XML : solicitudVerificacionEstado, global, // Namespace : https://siat.impuestos.gob.bo/ // ************************************************************************ // solicitudVerificacionEstado = class(solicitudRecepcion) private Fcuf: WideString; function Getcuf(Index: Integer): WideString; procedure Setcuf(Index: Integer; const AWideString: WideString); published property cuf: WideString Index (IS_UNQL) read Getcuf write Setcuf; end; // ************************************************************************ // // XML : solicitudAnulacion, global, // Namespace : https://siat.impuestos.gob.bo/ // ************************************************************************ // solicitudAnulacion = class(solicitudRecepcion) private FcodigoMotivo: Integer; Fcuf: WideString; function GetcodigoMotivo(Index: Integer): Integer; procedure SetcodigoMotivo(Index: Integer; const AInteger: Integer); function Getcuf(Index: Integer): WideString; procedure Setcuf(Index: Integer; const AWideString: WideString); published property codigoMotivo: Integer Index (IS_UNQL) read GetcodigoMotivo write SetcodigoMotivo; property cuf: WideString Index (IS_UNQL) read Getcuf write Setcuf; end; // ************************************************************************ // // XML : solicitudValidacionRecepcion, global, // Namespace : https://siat.impuestos.gob.bo/ // ************************************************************************ // solicitudValidacionRecepcion = class(solicitudRecepcion) private FcodigoRecepcion: WideString; function GetcodigoRecepcion(Index: Integer): WideString; procedure SetcodigoRecepcion(Index: Integer; const AWideString: WideString); published property codigoRecepcion: WideString Index (IS_UNQL) read GetcodigoRecepcion write SetcodigoRecepcion; end; // ************************************************************************ // // XML : solicitudRecepcionFactura, global, // Namespace : https://siat.impuestos.gob.bo/ // ************************************************************************ // solicitudRecepcionFactura = class(solicitudRecepcion) private Farchivo: TByteSOAPArray; FfechaEnvio: WideString; FhashArchivo: WideString; function Getarchivo(Index: Integer): TByteSOAPArray; procedure Setarchivo(Index: Integer; const ATByteSOAPArray: TByteSOAPArray); function GetfechaEnvio(Index: Integer): WideString; procedure SetfechaEnvio(Index: Integer; const AWideString: WideString); function GethashArchivo(Index: Integer): WideString; procedure SethashArchivo(Index: Integer; const AWideString: WideString); published property archivo: TByteSOAPArray Index (IS_UNQL) read Getarchivo write Setarchivo; property fechaEnvio: WideString Index (IS_UNQL) read GetfechaEnvio write SetfechaEnvio; property hashArchivo: WideString Index (IS_UNQL) read GethashArchivo write SethashArchivo; end; // ************************************************************************ // // XML : solicitudRecepcionPaquete, global, // Namespace : https://siat.impuestos.gob.bo/ // ************************************************************************ // solicitudRecepcionPaquete = class(solicitudRecepcionFactura) private Fcafc: WideString; Fcafc_Specified: boolean; FcantidadFacturas: Integer; FcodigoEvento: Int64; function Getcafc(Index: Integer): WideString; procedure Setcafc(Index: Integer; const AWideString: WideString); function cafc_Specified(Index: Integer): boolean; function GetcantidadFacturas(Index: Integer): Integer; procedure SetcantidadFacturas(Index: Integer; const AInteger: Integer); function GetcodigoEvento(Index: Integer): Int64; procedure SetcodigoEvento(Index: Integer; const AInt64: Int64); published property cafc: WideString Index (IS_OPTN or IS_UNQL) read Getcafc write Setcafc stored cafc_Specified; property cantidadFacturas: Integer Index (IS_UNQL) read GetcantidadFacturas write SetcantidadFacturas; property codigoEvento: Int64 Index (IS_UNQL) read GetcodigoEvento write SetcodigoEvento; end; // ************************************************************************ // // XML : solicitudRecepcionMasiva, global, // Namespace : https://siat.impuestos.gob.bo/ // ************************************************************************ // solicitudRecepcionMasiva = class(solicitudRecepcionFactura) private FcantidadFacturas: Integer; function GetcantidadFacturas(Index: Integer): Integer; procedure SetcantidadFacturas(Index: Integer; const AInteger: Integer); published property cantidadFacturas: Integer Index (IS_UNQL) read GetcantidadFacturas write SetcantidadFacturas; end; // ************************************************************************ // // XML : respuestaRecepcion, global, // Namespace : https://siat.impuestos.gob.bo/ // ************************************************************************ // respuestaRecepcion = class(modelDto) private FcodigoDescripcion: WideString; FcodigoDescripcion_Specified: boolean; FcodigoEstado: Integer; FcodigoEstado_Specified: boolean; FcodigoRecepcion: WideString; FcodigoRecepcion_Specified: boolean; FmensajesList: Array_Of_mensajeRecepcion; FmensajesList_Specified: boolean; Ftransaccion: Boolean; Ftransaccion_Specified: boolean; function GetcodigoDescripcion(Index: Integer): WideString; procedure SetcodigoDescripcion(Index: Integer; const AWideString: WideString); function codigoDescripcion_Specified(Index: Integer): boolean; function GetcodigoEstado(Index: Integer): Integer; procedure SetcodigoEstado(Index: Integer; const AInteger: Integer); function codigoEstado_Specified(Index: Integer): boolean; function GetcodigoRecepcion(Index: Integer): WideString; procedure SetcodigoRecepcion(Index: Integer; const AWideString: WideString); function codigoRecepcion_Specified(Index: Integer): boolean; function GetmensajesList(Index: Integer): Array_Of_mensajeRecepcion; procedure SetmensajesList(Index: Integer; const AArray_Of_mensajeRecepcion: Array_Of_mensajeRecepcion); function mensajesList_Specified(Index: Integer): boolean; function Gettransaccion(Index: Integer): Boolean; procedure Settransaccion(Index: Integer; const ABoolean: Boolean); function transaccion_Specified(Index: Integer): boolean; published property codigoDescripcion: WideString Index (IS_OPTN or IS_UNQL) read GetcodigoDescripcion write SetcodigoDescripcion stored codigoDescripcion_Specified; property codigoEstado: Integer Index (IS_OPTN or IS_UNQL) read GetcodigoEstado write SetcodigoEstado stored codigoEstado_Specified; property codigoRecepcion: WideString Index (IS_OPTN or IS_UNQL) read GetcodigoRecepcion write SetcodigoRecepcion stored codigoRecepcion_Specified; property mensajesList: Array_Of_mensajeRecepcion Index (IS_OPTN or IS_UNBD or IS_NLBL or IS_UNQL) read GetmensajesList write SetmensajesList stored mensajesList_Specified; property transaccion: Boolean Index (IS_OPTN or IS_UNQL) read Gettransaccion write Settransaccion stored transaccion_Specified; end; // ************************************************************************ // // Namespace : https://siat.impuestos.gob.bo/ // transport : http://schemas.xmlsoap.org/soap/http // style : document // use : literal // binding : ServicioFacturacionSoapBinding // service : ServicioFacturacion // port : ServicioFacturacionPort // URL : https://pilotosiatservicios.impuesto...nComputarizada // ************************************************************************ // ServicioFacturacion = interface(IInvokable) ['{BDB92EDF-C1F2-45B6-A3C2-F9173455259B}'] function recepcionPaqueteFactura(const SolicitudServicioRecepcionPaquete: solicitudRecepcionPaquete): respuestaRecepcion; stdcall; function verificarComunicacion: respuestaComunicacion; stdcall; function recepcionFactura(const SolicitudServicioRecepcionFactura: solicitudRecepcionFactura): respuestaRecepcion; stdcall; function validacionRecepcionMasivaFactura(const SolicitudServicioValidacionRecepcionMasiva: solicitudValidacionRecepcion): respuestaRecepcion; stdcall; function recepcionMasivaFactura(const SolicitudServicioRecepcionMasiva: solicitudRecepcionMasiva): respuestaRecepcion; stdcall; function verificacionEstadoFactura(const SolicitudServicioVerificacionEstadoFactura: solicitudVerificacionEstado): respuestaRecepcion; stdcall; function validacionRecepcionPaqueteFactura(const SolicitudServicioValidacionRecepcionPaquete: solicitudValidacionRecepcion): respuestaRecepcion; stdcall; function anulacionFactura(const SolicitudServicioAnulacionFactura: solicitudAnulacion): respuestaRecepcion; stdcall; end; implementation type ServicioFacturacionImpl = class(TInvokableClass, ServicioFacturacion) public { ServicioFacturacion } function recepcionPaqueteFactura(const SolicitudServicioRecepcionPaquete: solicitudRecepcionPaquete): respuestaRecepcion; stdcall; function verificarComunicacion: respuestaComunicacion; stdcall; function recepcionFactura(const SolicitudServicioRecepcionFactura: solicitudRecepcionFactura): respuestaRecepcion; stdcall; function validacionRecepcionMasivaFactura(const SolicitudServicioValidacionRecepcionMasiva: solicitudValidacionRecepcion): respuestaRecepcion; stdcall; function recepcionMasivaFactura(const SolicitudServicioRecepcionMasiva: solicitudRecepcionMasiva): respuestaRecepcion; stdcall; function verificacionEstadoFactura(const SolicitudServicioVerificacionEstadoFactura: solicitudVerificacionEstado): respuestaRecepcion; stdcall; function validacionRecepcionPaqueteFactura(const SolicitudServicioValidacionRecepcionPaquete: solicitudValidacionRecepcion): respuestaRecepcion; stdcall; function anulacionFactura(const SolicitudServicioAnulacionFactura: solicitudAnulacion): respuestaRecepcion; stdcall; end; function ServicioFacturacionImpl.recepcionPaqueteFactura(const SolicitudServicioRecepcionPaquete: solicitudRecepcionPaquete): respuestaRecepcion; begin { TODO - Implement method recepcionPaqueteFactura } end; function ServicioFacturacionImpl.verificarComunicacion: respuestaComunicacion; begin { TODO - Implement method verificarComunicacion } end; function ServicioFacturacionImpl.recepcionFactura(const SolicitudServicioRecepcionFactura: solicitudRecepcionFactura): respuestaRecepcion; begin { TODO - Implement method recepcionFactura } end; function ServicioFacturacionImpl.validacionRecepcionMasivaFactura(const SolicitudServicioValidacionRecepcionMasiva: solicitudValidacionRecepcion): respuestaRecepcion; begin { TODO - Implement method validacionRecepcionMasivaFactura } end; function ServicioFacturacionImpl.recepcionMasivaFactura(const SolicitudServicioRecepcionMasiva: solicitudRecepcionMasiva): respuestaRecepcion; begin { TODO - Implement method recepcionMasivaFactura } end; function ServicioFacturacionImpl.verificacionEstadoFactura(const SolicitudServicioVerificacionEstadoFactura: solicitudVerificacionEstado): respuestaRecepcion; begin { TODO - Implement method verificacionEstadoFactura } end; function ServicioFacturacionImpl.validacionRecepcionPaqueteFactura(const SolicitudServicioValidacionRecepcionPaquete: solicitudValidacionRecepcion): respuestaRecepcion; begin { TODO - Implement method validacionRecepcionPaqueteFactura } end; function ServicioFacturacionImpl.anulacionFactura(const SolicitudServicioAnulacionFactura: solicitudAnulacion): respuestaRecepcion; begin { TODO - Implement method anulacionFactura } end; function respuestaComunicacion.GetmensajesList(Index: Integer): Array_Of_mensajeServicio; begin Result := FmensajesList; end; procedure respuestaComunicacion.SetmensajesList(Index: Integer; const AArray_Of_mensajeServicio: Array_Of_mensajeServicio); begin FmensajesList := AArray_Of_mensajeServicio; FmensajesList_Specified := True; end; function respuestaComunicacion.mensajesList_Specified(Index: Integer): boolean; begin Result := FmensajesList_Specified; end; function respuestaComunicacion.Gettransaccion(Index: Integer): Boolean; begin Result := Ftransaccion; end; procedure respuestaComunicacion.Settransaccion(Index: Integer; const ABoolean: Boolean); begin Ftransaccion := ABoolean; Ftransaccion_Specified := True; end; function respuestaComunicacion.transaccion_Specified(Index: Integer): boolean; begin Result := Ftransaccion_Specified; end; function mensajeServicio.Getcodigo(Index: Integer): Integer; begin Result := Fcodigo; end; procedure mensajeServicio.Setcodigo(Index: Integer; const AInteger: Integer); begin Fcodigo := AInteger; Fcodigo_Specified := True; end; function mensajeServicio.codigo_Specified(Index: Integer): boolean; begin Result := Fcodigo_Specified; end; RemClassRegistry.RegisterXSClass(respuestaRecepcion, 'https://siat.impuestos.gob.bo/', 'respuestaRecepcion'); end.
Responder Con Cita
  #6  
Antiguo 03-01-2022
Muriel Muriel is offline
Miembro
 
Registrado: ago 2008
Posts: 19
Poder: 0
Muriel Va por buen camino
[quote=CrazySoft;544774]Buen día, yo tambien estoy con problemas con el sevicio que ofrecen, porque no aparecen algunas funciones al importra el servicio, por ejemplo la solicitud del CUIS deberia haber una funcion "SolicitudCuis" segun el manual https://siatinfo.impuestos.gob.bo/in...solicitud-cuis

Hola buen dia, subí un archivo comprimido si te sirve es impetrado de la v1
Yo estoy luchando con el envío del TOKEN si me comentas como hacer te agradecería
Archivos Adjuntos
Tipo de Archivo: rar FacturacionCodigos.rar (3,3 KB, 12 visitas)
Responder Con Cita
  #7  
Antiguo 06-01-2022
Muriel Muriel is offline
Miembro
 
Registrado: ago 2008
Posts: 19
Poder: 0
Muriel Va por buen camino
Hola buenas Señores del foro
les comento que sigo luchando con este teme de querer poner el token como encabezado en http pero por mas que me ponga a leer en muchos foros ejemplos similares no logro comprender nada, en todo esto lo único que pude hacer es esto, pero el servidor me sigue generando el error.

Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
var Peticion: verificarComunicacion;
    Respuesta: verificarComunicacionResponse;
    Token: String;
begin
     Token:='ePyJ0eXwiOiJKV1QiLwthbGciOiJIUzUx...........elTokenEsUnaCadenaLarga';
     
     Peticion:= Nil;
     HTTPRIO1:= THTTPRIO.Create(self);
     HTTPRIO1.HTTPWebNode.Password:=Token;
     Try
         Respuesta:= GetServicioFacturacionCodigos(False,'',HTTPRIO1).verificarComunicacion(Peticion);
         ShowMessage(IntToStr(Respuesta.return));
     Except
          on E : Exception do
               ShowMessage('Error generado : '+E.Message);
     end;
 
end;


Si alguien me ayuda si estoy en la direccion correcta por favor.
Responder Con Cita
  #8  
Antiguo 22-01-2022
Muriel Muriel is offline
Miembro
 
Registrado: ago 2008
Posts: 19
Poder: 0
Muriel Va por buen camino
hola amigos del foro, estoy aquí o través con la misma cantaleta y es por que todavía no logro entender este teme de encasados http
pero tanto buscar encontré este ejemplo en algún foro pero no se si estoy en lo correcto

Código Delphi [-]
const
  IS_TEXT = $0020;

  apikey = class(TSOAPHeader)
  private
    FValue: string;
  published
    property Value: string Index (IS_TEXT) read FValue write FValue;
  end;

esto hice debido a que en SoapUI funciona así como en la imagen que deje adjuntado.
con esto mi código en un botón me que da así

Saludos

Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
var Respuesta: respuestaComunicacion;
   Token: apikey;
begin
     Token:= apikey.Create;
     Token.Value:= 'TokenApi eyJ0eXA.eyJzdWIiOiJDLkkuQy5NLkjoiU0ZFIn0.a7fDfvP2CmB';

     HTTPRIO1.SOAPHeaders.SetOwnsSentHeaders(True);
     HTTPRIO1.SOAPHeaders.Send(Token);
     Try
          Respuesta:=GetServicioFacturacionCodigos(false, '', HTTPRIO1).verificarComunicacion;
          Edit1.Text:= Respuesta.mensajesList[0].descripcion;
     Except
          on E : Exception do
               ShowMessage('Error generado : '+E.Message);
     end;
end;


pero aun así no funciona, o no es así como se hace
por favor quisiera que me ayuden
Imágenes Adjuntas
Tipo de Archivo: jpg Captura.JPG (33,1 KB, 11 visitas)
Responder Con Cita
  #9  
Antiguo 24-01-2022
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - España
Posts: 18.233
Poder: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
Debería especificar los errores que te da con detalle.
Si nos dices sólo "no funciona" es difícil ayudarte o darte pistas de dónde puede estar el problema.
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita
  #10  
Antiguo 25-01-2022
Muriel Muriel is offline
Miembro
 
Registrado: ago 2008
Posts: 19
Poder: 0
Muriel Va por buen camino
Cita:
Empezado por Neftali [Germán.Estévez] Ver Mensaje
Debería especificar los errores que te da con detalle.
Si nos dices sólo "no funciona" es difícil ayudarte o darte pistas de dónde puede estar el problema.

Gracias por contestar amigo, creo que eres el único que tiene interés en querer ayudarme.
no se si es relevante el error que muestra solo dice esto "EL SERVICIO REQUIERE API KEY"
puse una captura adjuntado para que lo veas.
me gustaría pasarte el token para que lo pruebes si se puede en un correo electrónico

un abraso
Imágenes Adjuntas
Tipo de Archivo: jpg Captura.JPG (14,3 KB, 11 visitas)
Responder Con Cita
  #11  
Antiguo 25-01-2022
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - España
Posts: 18.233
Poder: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
Cita:
Empezado por Muriel Ver Mensaje
no se si es relevante el error que muestra solo dice esto "EL SERVICIO REQUIERE API KEY"
puse una captura adjuntado para que lo veas.

El error parece claro. Revisa la documentación.

En algún lugar de la llamada debes añadir esa información que imagino que te la tendrán que dar ellos.
O como campo en la llamada, como datos dentro del cuerpo o a veces en la cabecera.
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita
  #12  
Antiguo 25-01-2022
Muriel Muriel is offline
Miembro
 
Registrado: ago 2008
Posts: 19
Poder: 0
Muriel Va por buen camino
Cita:
Empezado por Muriel Ver Mensaje
Para realizar el consumo de los servicios que solicitan la autenticación mediante el uso de token, se debe considerar en el header del servicio el parámetro: Authorization y el valor: “Token VALORTOKEN”. Donde la variable “VALORTOKEN” es el Token que se obtuvo a través del servicio de autenticación.

Nota.- La inclusión del Token de la petición SOAP debe hacerse en la cabecera HTTP y no así en la cabecera XML del request
Hola amigo me alegra que estés aquí queriendo me ayudar
te comento que según este documento me queda clatro que el token se debe poner en la cabecera HTTP lo que no se es como poner ese cabecera HTTP con esa información en delphi ya que al importar el WSDL no aparece ese detalle y eso es lo que me tiene desconcertado peor cuando no tengo experiencia
en servicios web.
cualquier sugerencia creo que me servirá para ir probando.

un abraso.
Responder Con Cita
  #13  
Antiguo 25-01-2022
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - España
Posts: 18.233
Poder: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
Cita:
Empezado por Muriel Ver Mensaje
...según este documento me queda clatro que el token se debe poner en la cabecera HTTP lo que no se es como poner ese cabecera HTTP con esa información en delphi ya que al importar el WSDL

Los parámetros que debas añadir en la cabecera, deben incluirse en la documentación, no estará en la información del WSDL.
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita
  #14  
Antiguo 05-02-2022
Muriel Muriel is offline
Miembro
 
Registrado: ago 2008
Posts: 19
Poder: 0
Muriel Va por buen camino
Hola a todos tengan un Buendía
Hoy estoy muy Feliz y quiero coméntales que logre resolver este problema que era tan sencillo.
les agradezco por la ayuda especialmente a Neftali que a estado aquí Gracias Neftali y un abraso.
Responder Con Cita
  #15  
Antiguo 07-02-2022
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - España
Posts: 18.233
Poder: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
De nada.
Si nos dices lo que fallaba y cómo se ha solucionado finalmente, es posible que le pueda servir a otro usaurio que posteriormente tenga un problema similar al tuyo y revise este hilo.

Gracias.
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

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
Como puedo consumir un soap en java uper JAVA 1 07-08-2019 18:36:12
Como consumir Rest Service que retorna cadena en formato JSON desde delphi 7 JuanPa1 Internet 0 20-12-2013 19:07:20
Web Service SOAP con Delphi 5 socger Internet 7 26-07-2012 23:25:51
Consumir un Web Service lbidi Varios 4 17-04-2012 15:28:37
Consumir WebService. Ayuda con XML,WSDL,XSD,SOAP josemmerida Internet 2 23-12-2010 14:37:16


La franja horaria es GMT +2. Ahora son las 13:27:41.


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