<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel><category>pcsoft.us.windev</category><copyright>Copyright 2026, PC SOFT</copyright><lastBuildDate>6 Jun 2016 12:16:06 Z</lastBuildDate><pubDate>6 Jun 2016 12:16:06 Z</pubDate><description>Greetings everyone, &#13;
&#13;
I'm trying to migrate a vb.net project I realized, it seems it's much more difficult than I thought ...&#13;
&#13;
In the project, I'm trying to consume a web service to send a zipped xml file, in response, the response is a zipped xml file, it shows if the file I sent is accepted or not.&#13;
&#13;
I'm calling this web service : https://www.sunat.gob.pe/ol-ti-itcpgem-beta/billService?wsdl&#13;
And I'm trying to send this zip file : https://www.dropbox.com/s/en2tl63u6iozkjb/20450835600-01-FF11-56.zip?dl=0&#13;
&#13;
About the web service I'm using, I call the sendBill method, here are its parameters :&#13;
- filename : the zip filename to send (its extension is required, so, in my test, its value is 20450835600-01-FF11-56.zip )&#13;
- contentFile : byte array value, represents the zip file to send&#13;
&#13;
The returned value is a byte array value, represents the zip file received.&#13;
&#13;
The call of the web service requires an identification, here are the id identifications :&#13;
username : 20450835600MODDATOS&#13;
password : MODDATOS&#13;
&#13;
So far, I put this wlangage code :&#13;
[code:wl]&#13;
sFilename is string= "20450835600-01-FF11-56.zip"&#13;
l_zipFileToSend is string="C:\Mes Projets\EnvoiWindev\" + sFilename&#13;
l_cheminReponse is string="C:\Mes Projets\EnvoiWindev\reponseSUNAT.zip"&#13;
&#13;
l_ws is billServiceClient&#13;
l_ws.ClientCredentials.CreateSecurityTokenManager()&#13;
l_ws.ClientCredentials.UserName.username="20450835600MODDATOS"&#13;
l_ws.ClientCredentials.UserName.password="MODDATOS"&#13;
&#13;
l_ws.Open()&#13;
l_wsSettings is sendBill&#13;
l_wsSettings.fileName=sFilename&#13;
l_wsSettings.contentFile=fChargeBuffer(l_zipFileToSend)&#13;
&#13;
l_reponse is Variant=l_ws.sendBill(l_wsSettings)&#13;
l_ws.close()&#13;
[/code]&#13;
&#13;
but it seems it's not possible to instantiate a billServiceClient object, this error message pops-up in debug mode :&#13;
&#13;
The .NET framework returned the following error:&#13;
An exception was thrown by the target of an invocation.&#13;
&#13;
Any idea? &#13;
&#13;
My wlangage code is based on this vb.net code :&#13;
&#13;
Dim _ZIPFile as string="C:\Mes Projets\EnvoiWindev\20450835600-01-FF11-56.zip"&#13;
 Dim NomFichierZIP As String = System.IO.Path.GetFileName(_ZIPFile)&#13;
 Dim usernametoken_login As String ="20450835600MODDATOS"&#13;
 Dim usernametoken_pwd As String = "MODDATOS"&#13;
&#13;
 System.Net.ServicePointManager.UseNagleAlgorithm = True&#13;
 System.Net.ServicePointManager.Expect100Continue = False&#13;
 System.Net.ServicePointManager.CheckCertificateRevocationList = True&#13;
&#13;
 Dim ws As New ServiceBeta.billServiceClient&#13;
 Dim Retour As Byte()&#13;
&#13;
 Dim data As Byte() = System.IO.File.ReadAllBytes(_ZIPFile)&#13;
&#13;
 ws.ClientCredentials.CreateSecurityTokenManager()&#13;
 ws.ClientCredentials.UserName.UserName = usernametoken_login&#13;
 ws.ClientCredentials.UserName.Password = usernametoken_pwd&#13;
&#13;
 ws.Open()&#13;
 Retour = ws.sendBill(NomFichierZIP, data)&#13;
 ws.Close()&#13;
&#13;
 System.IO.File.WriteAllBytes("C:\Mes Projets\EnvoiWindev\reponseSUNAT.zip", Retour)&#13;
&#13;
PS :&#13;
1) this webservice is simply used to verify if the zip file sent can be accepted or not next time I'll try to send it via the production one&#13;
2) as it's a test webservice, every user has the exact same password, only the numerical part of the username can change</description><ttl>30</ttl><generator>WEBDEV</generator><language>en_US</language><link>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/57980-consume-web-service-send-and-receive-zip-file/read.awp</link><title>Consume a web service to send and receive a ZIP file</title><managingEditor>moderateur@pcsoft.fr (El moderador)</managingEditor><webMaster>webmaster@pcsoft.fr (El webmaster)</webMaster></channel></rss>
