I resolved the problem by creating this feature
function GetbillService(UseWSDL: Boolean; Addr: string;var HTTPRIO: THTTPRIO): billService;
const
defWSDL = 'https://www.sunat.gob.pe:443/ol-ti-itcpgem-beta/billService?wsdl';
defURL = 'https://www.sunat.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;
and I use it in this way
tBillServ:=GetbillService(True,'',HTTPRIO1);
tSendB:=sendBill.Create;
tSendBResp:=sendBillResponse.Create;
tSendB.fileName:='20100066603-01-F001-1.ZIP';
tSendB.contentFile:=FIleToByteArray('D:\E-Billing\20100066603-01-F001-1.ZIP');
tSendBResp:=tBillServ.sendBill(tSendB);
establish the connection but it appears that the security header is incorrect
need to have the following characteristic
<?xml version="1.0"?>
<SOAP-ENV:Envelope 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/"><SOAP-ENV:Body xmlns:NS1="http://service.sunat.gob.pe" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:NS2="urn:billService1"><NS1:sendBill><parameters href="#1"/></NS1:sendBill><NS2:sendBill id="1" xsi:type="NS2:sendBill"><fileName xsi:type="xsd:string">20100066603-01-F001-1.ZIP</fileName><contentFile xsi:type="xsd:base64Binary">UEsDBBQA.....DAwNBgAAAAAB
AAEAawAAAD0MAAAAAA==</contentFile></NS2:sendBill></SOAP-ENV:Body></SOAP-ENV:Envelope>
but it appears aso
<?xml version="1.0"?>
<SOAP-ENV:Envelope 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">
<SOAP-ENV:Body>
<sendBill xmlns="http://service.sunat.gob.pe">
<parameters>
<fileName>20100066603-01-F001-1.ZIP</fileName>
<contentFile>UEsDBB.....NjY2MDMtA==</contentFile>
</parameters></sendBill></SOAP-ENV:Body></SOAP-ENV:Envelope>
I have tried to manually send the xml with the correct parameters but even so the security header error I get
procedure TForm1.HTTPRIO1BeforeExecute(const MethodName: string;
SOAPRequest: TStream);
var
Str:String;
outs:TStream;
begin
Str:= {Code XML};
outs:=TStringStream.Create(Str);
SOAPRequest:=outs;
end;
Review the information on the WSSE.pas where the UsernameToken is added but my implementation is not clear