Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

Visual Basic 6.0 Examples

Web API Categories

ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Cloud Signature CSC
Code Signing
Compression
DKIM / DomainKey
DNS
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text
HTTP

HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
MS Storage Providers
Microsoft Graph
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
Secrets
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl
uncategorized

 

 

 

(Visual Basic 6.0) SOAP Request to Issue Documents in Facto.cl

Demonstrates how to make a SOAP HTTP request to issue a document using the facto.cl webservice.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

' This example requires the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.

' --------------------------------------------------------------------------------
' Also see Chilkat's Online WSDL Code Generator
' to generate code and SOAP Request and Response XML for each operation in a WSDL.
' --------------------------------------------------------------------------------

Dim success As Long

' Here is an example of an HTTP POST Request we'll be sending:

' POST /documento.php HTTP/1.1
' Content-Type: text/xml;charset=UTF-8
' SOAPAction: https://conexion.facto.cl/documento.php/emitirDocumento
' 
' <soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:server">
'    <soapenv:Header/>
'    <soapenv:Body>
'       <urn:emitirDocumento soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
'          <documento xsi:type="urn:emitir_dte">
'             <encabezado xsi:type="urn:encabezado">
'                <tipo_dte xsi:type="xsd:string">39</tipo_dte>
'                <fecha_emision xsi:type="xsd:date">2019-08-03</fecha_emision>
'                <condiciones_pago xsi:type="xsd:string">0</condiciones_pago>
'                <receptor_email xsi:type="xsd:string">example@gmail.com</receptor_email>
'             </encabezado>
'             <detalles xsi:type="urn:detalles">
'                <detalle xsi:type="urn:detalle">
'                   <cantidad xsi:type="xsd:int">3</cantidad>
'                   <glosa xsi:type="xsd:string">Recarga Agua Purificada</glosa>
'                   <monto_unitario xsi:type="xsd:decimal">1932.773109</monto_unitario>
'                   <exento_afecto xsi:type="xsd:boolean">1</exento_afecto>
'                </detalle>
'             </detalles>
'             <totales xsi:type="urn:totales">
'                <total_exento xsi:type="xsd:int">0</total_exento>
'                <total_afecto xsi:type="xsd:int">5798</total_afecto>
'                <total_iva xsi:type="xsd:int">1102</total_iva>
'                <total_final xsi:type="xsd:Int">6900</total_final>
'             </totales>
'          </documento>
'       </urn:emitirDocumento>
'    </soapenv:Body>
' </soapenv:Envelope>

' Use this online tool to generate code from sample XML: 
' Generate Code to Create XML

Dim xml As New ChilkatXml
xml.Tag = "soapenv:Envelope"
success = xml.AddAttribute("xmlns:xsi","http://www.w3.org/2001/XMLSchema-instance")
success = xml.AddAttribute("xmlns:xsd","http://www.w3.org/2001/XMLSchema")
success = xml.AddAttribute("xmlns:soapenv","http://schemas.xmlsoap.org/soap/envelope/")
success = xml.AddAttribute("xmlns:urn","urn:server")
xml.UpdateChildContent "soapenv:Header",""
success = xml.UpdateAttrAt("soapenv:Body|urn:emitirDocumento",1,"soapenv:encodingStyle","http://schemas.xmlsoap.org/soap/encoding/")
success = xml.UpdateAttrAt("soapenv:Body|urn:emitirDocumento|documento",1,"xsi:type","urn:emitir_dte")
success = xml.UpdateAttrAt("soapenv:Body|urn:emitirDocumento|documento|encabezado",1,"xsi:type","urn:encabezado")
success = xml.UpdateAttrAt("soapenv:Body|urn:emitirDocumento|documento|encabezado|tipo_dte",1,"xsi:type","xsd:string")
xml.UpdateChildContent "soapenv:Body|urn:emitirDocumento|documento|encabezado|tipo_dte","39"
success = xml.UpdateAttrAt("soapenv:Body|urn:emitirDocumento|documento|encabezado|fecha_emision",1,"xsi:type","xsd:date")
xml.UpdateChildContent "soapenv:Body|urn:emitirDocumento|documento|encabezado|fecha_emision","2019-08-03"
success = xml.UpdateAttrAt("soapenv:Body|urn:emitirDocumento|documento|encabezado|condiciones_pago",1,"xsi:type","xsd:string")
xml.UpdateChildContent "soapenv:Body|urn:emitirDocumento|documento|encabezado|condiciones_pago","0"
success = xml.UpdateAttrAt("soapenv:Body|urn:emitirDocumento|documento|encabezado|receptor_email",1,"xsi:type","xsd:string")
xml.UpdateChildContent "soapenv:Body|urn:emitirDocumento|documento|encabezado|receptor_email","example@gmail.com"
success = xml.UpdateAttrAt("soapenv:Body|urn:emitirDocumento|documento|detalles",1,"xsi:type","urn:detalles")
success = xml.UpdateAttrAt("soapenv:Body|urn:emitirDocumento|documento|detalles|detalle",1,"xsi:type","urn:detalle")
success = xml.UpdateAttrAt("soapenv:Body|urn:emitirDocumento|documento|detalles|detalle|cantidad",1,"xsi:type","xsd:int")
xml.UpdateChildContent "soapenv:Body|urn:emitirDocumento|documento|detalles|detalle|cantidad","3"
success = xml.UpdateAttrAt("soapenv:Body|urn:emitirDocumento|documento|detalles|detalle|glosa",1,"xsi:type","xsd:string")
xml.UpdateChildContent "soapenv:Body|urn:emitirDocumento|documento|detalles|detalle|glosa","Recarga Agua Purificada"
success = xml.UpdateAttrAt("soapenv:Body|urn:emitirDocumento|documento|detalles|detalle|monto_unitario",1,"xsi:type","xsd:decimal")
xml.UpdateChildContent "soapenv:Body|urn:emitirDocumento|documento|detalles|detalle|monto_unitario","1932.773109"
success = xml.UpdateAttrAt("soapenv:Body|urn:emitirDocumento|documento|detalles|detalle|exento_afecto",1,"xsi:type","xsd:boolean")
xml.UpdateChildContent "soapenv:Body|urn:emitirDocumento|documento|detalles|detalle|exento_afecto","1"
success = xml.UpdateAttrAt("soapenv:Body|urn:emitirDocumento|documento|totales",1,"xsi:type","urn:totales")
success = xml.UpdateAttrAt("soapenv:Body|urn:emitirDocumento|documento|totales|total_exento",1,"xsi:type","xsd:int")
xml.UpdateChildContent "soapenv:Body|urn:emitirDocumento|documento|totales|total_exento","0"
success = xml.UpdateAttrAt("soapenv:Body|urn:emitirDocumento|documento|totales|total_afecto",1,"xsi:type","xsd:int")
xml.UpdateChildContent "soapenv:Body|urn:emitirDocumento|documento|totales|total_afecto","5798"
success = xml.UpdateAttrAt("soapenv:Body|urn:emitirDocumento|documento|totales|total_iva",1,"xsi:type","xsd:int")
xml.UpdateChildContent "soapenv:Body|urn:emitirDocumento|documento|totales|total_iva","1102"
success = xml.UpdateAttrAt("soapenv:Body|urn:emitirDocumento|documento|totales|total_final",1,"xsi:type","xsd:Int")
xml.UpdateChildContent "soapenv:Body|urn:emitirDocumento|documento|totales|total_final","6900"

Dim http As New ChilkatHttp

http.BasicAuth = 1
http.Login = "9.999.999-9/mylogin"
http.Password = "mypassword"

http.SetRequestHeader "Content-Type","text/xml;charset=UTF-8"
http.SetRequestHeader "SoapAction","https://conexion.facto.cl/documento.php/emitirDocumento"

Dim resp As ChilkatHttpResponse
Set resp = http.PostXml("https://conexion.facto.cl/documento.php",xml.GetXml(),"utf-8")
If (http.LastMethodSuccess <> 1) Then
    Debug.Print http.LastErrorText
    Exit Sub
End If

' A status code = 200 indicates success.
Debug.Print "Response status code = " & resp.StatusCode

Dim xmlResp As New ChilkatXml
success = xmlResp.LoadXml(resp.BodyStr)
Debug.Print "Response body text:"
Debug.Print xmlResp.GetXml()

' The response will look like this:

' <?xml version="1.0" encoding="UTF-8"?>
' <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 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>
'         <ns1:emitirDocumentoResponse xmlns:ns1="urn:server">
'             <return xsi:type="xsd:complexType">
'                 <resultado>
'                     <status>0</status>
'                     <mensaje_error/>
'                 </resultado>
'                 <encabezado>
'                     <tipo_dte>39</tipo_dte>
'                     <folio>109999</folio>
'                     <fecha_emision>2019-08-03</fecha_emision>
'                     <condiciones_pago>0</condiciones_pago>
'                     <receptor_email>example@gmail.com</receptor_email>
'                 </encabezado>
'                 <detalles>
'                     <cantidad>3</cantidad>
'                     <glosa>Recarga Agua Purificada</glosa>
'                     <monto_unitario>1932.773109</monto_unitario>
'                     <exento_afecto>1</exento_afecto>
'                 </detalles>
'                 <totales>
'                     <total_exento>0</total_exento>
'                     <total_afecto>5798</total_afecto>
'                     <total_iva>1102</total_iva>
'                     <total_final>6900</total_final>
'                 </totales>
'                 <enlaces>
'                     <dte_xml>https://temporal.facto.cl/2019/08/999993022aa9e0733174e87086ade7d4.xml</dte_xml>
'                     <dte_pdf>https://temporal.facto.cl/2019/08/99999f52cf80c8ffc1fc22338dae022.pdf</dte_pdf>
'                     <dte_timbre>https://temporal.facto.cl/2019/08/999999856c08b3d24a83bf29add5364a.png</dte_timbre>
'                 </enlaces>
'             </return>
'         </ns1:emitirDocumentoResponse>
'     </SOAP-ENV:Body>
' </SOAP-ENV:Envelope>


 

© 2000-2024 Chilkat Software, Inc. All Rights Reserved.