Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3/4TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

VB.NET UWP/WinRT Examples

Web API Categories

ASN.1
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Azure Cloud Storage
Azure Service Bus
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Compression
DKIM / DomainKey
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
ECC
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
Geolocation
Google APIs
Google Calendar
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
Microsoft Graph
NTLM
OAuth1
OAuth2
OneDrive
OpenSSL
Outlook
PEM
PFX/P12
POP3
PRNG
REST
REST Misc
RSA
SCP
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
SharePoint
Socket/SSL/TLS
Spider
Stream
Tar Archive
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl

 

 

 

(VB.NET UWP/WinRT) Yet Another SOAP MTOM POST Example

Demonstrates how to sending a SOAP request with an MTOM/XOP attachment...

Chilkat Universal Windows Platform (UWP) / WinRT Downloads

Chilkat for the Universal Windows Platform (UWP)

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

Dim http As New Chilkat.Http
Dim success As Boolean

' First build the following XML:

' 	<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
' 	    xmlns:imp="http://www.yourdomain.it/ImportMultiploWorkflowPAWS/">
' 	   <soapenv:Header/>
' 	   <soapenv:Body>
' 	      <imp:InputImportMultiploWorkflowPA>
' 	         <usernameEis>MyUsername</usernameEis>
' 	         <passwordEis>MyPassword</passwordEis>
' 	         <postazioneEis>COSO00</postazioneEis>
' 	         <istitutoEis>COSO</istitutoEis>
' 	         <codiceAzienda>COSO0000</codiceAzienda>
' 	         <fileZip><inc:Include href="cid:780931946797" xmlns:inc="http://www.w3.org/2004/08/xop/include"/></fileZip>
' 	         <fileZipName>IT04769180151_00044.zip</fileZipName>
' 	         <workflow>carica</workflow>
' 	      </imp:InputImportMultiploWorkflowPA>
' 	   </soapenv:Body>
' 	</soapenv:Envelope>

Dim xml As New Chilkat.Xml
xml.Tag = "soapenv:Envelope"
xml.AddAttribute("xmlns:soapenv","http://schemas.xmlsoap.org/soap/envelope/")
xml.AddAttribute("xmlns:imp","http://www.yourdomain.it/ImportMultiploWorkflowPAWS/")
xml.UpdateChildContent("soapenv:Header","")
xml.UpdateChildContent("soapenv:Body|imp:InputImportMultiploWorkflowPA|usernameEis","MyUsername")
xml.UpdateChildContent("soapenv:Body|imp:InputImportMultiploWorkflowPA|passwordEis","MyPassword")
xml.UpdateChildContent("soapenv:Body|imp:InputImportMultiploWorkflowPA|postazioneEis","COSO00")
xml.UpdateChildContent("soapenv:Body|imp:InputImportMultiploWorkflowPA|istitutoEis","COSO")
xml.UpdateChildContent("soapenv:Body|imp:InputImportMultiploWorkflowPA|codiceAzienda","COSO0000")
xml.UpdateAttrAt("soapenv:Body|imp:InputImportMultiploWorkflowPA|fileZip|inc:Include",True,"href","cid:780931946797")
xml.UpdateAttrAt("soapenv:Body|imp:InputImportMultiploWorkflowPA|fileZip|inc:Include",True,"xmlns:inc","http://www.w3.org/2004/08/xop/include")
xml.UpdateChildContent("soapenv:Body|imp:InputImportMultiploWorkflowPA|fileZipName","IT04769180151_00044.zip")
xml.UpdateChildContent("soapenv:Body|imp:InputImportMultiploWorkflowPA|workflow","carica")

' We want our top-level HTTP request header to look like this:

' POST /http-router-softwarehubsystem/webservices/importMultiploWorkflowPA HTTP/1.1
' Accept-Encoding: gzip,deflate
' Content-Type: multipart/related; type="application/xop+xml"; start="<rootpart@soapui.org>"; start-info="text/xml"; boundary="----=_Part_0_1353857996.1546013984933"
' SOAPAction: "http://www.yourdomain.it/ImportMultiploWorkflowPAWS/importMultiploWorkflowPA"
' MIME-Version: 1.0
' Content-Length: <chilkat will add this header>
' Host: <chilkat will add this header>
' Connection: Keep-Alive
' User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

Dim req As New Chilkat.HttpRequest
req.HttpVerb = "POST"
req.Path = "/http-router-softwarehubsystem/webservices/importMultiploWorkflowPA"
req.ContentType = "multipart/related; type=""application/xop+xml""; start=""<rootpart@soapui.org>""; start-info=""text/xml"""
req.AddHeader("SOAPAction","""http://www.yourdomain.it/ImportMultiploWorkflowPAWS/importMultiploWorkflowPA""")
req.AddHeader("Accept-Encoding","gzip,deflate")
req.AddHeader("Mime-Version","1.0")
req.AddHeader("Connection","Keep-Alive")
req.AddHeader("User-Agent","Apache-HttpClient/4.1.1 (java 1.5)")

' Add the XML content for the 1st MIME sub-part.
xml.EmitXmlDecl = False
xml.EmitCompact = False
success = req.AddStringForUpload2("","",xml.GetXml(),"utf-8","application/xop+xml; charset=UTF-8; type=""text/xml""")

' We want the 1st sub-header (the sub-part containing the XML) to look like this:

' Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
' Content-Transfer-Encoding: 8bit
' Content-ID: <rootpart@soapui.org>

' Make sure we set sub-headers *after* calling AddStringForUpload2, otherwise AddStringForUpload2 might change these explicitly set headers.
success = req.AddSubHeader(0,"Content-Transfer-Encoding","8bit")
success = req.AddSubHeader(0,"Content-ID","<rootpart@soapui.org>")

' Add a reference to the local file for the file data for the 2nd MIME sub-part.
success = req.AddFileForUpload2("","qa_data/zips/helloWorld.zip","application/zip; name=IT04769180151_00044.zip")

' We want the 2nd sub-header (for the MIME sub-part containing a .zip file) to look like this:
' Content-Type: application/zip; name=IT04769180151_00044.zip
' Content-Transfer-Encoding: binary
' Content-ID: <IT04769180151_00044.zip>
' Content-Disposition: attachment; name="IT04769180151_00044.zip"; filename="IT04769180151_00044.zip"

' Make sure we set sub-headers *after* calling AddFileForUpload2, otherwise AddFileForUpload2 might change these explicitly set headers.
success = req.AddSubHeader(1,"Content-Transfer-Encoding","binar")
success = req.AddSubHeader(1,"Content-ID","<IT04769180151_00044.zip>")
success = req.AddSubHeader(1,"Content-Disposition","attachment; name=""IT04769180151_00044.zip""; filename=""IT04769180151_00044.zip""")


' Keep a session log so we can examine the exact request/response.
' Remove this line when finished with debugging.
http.SessionLogFilename = "qa_output/mtom_sessionLog.txt"

Dim useTls As Boolean = False
' Note: Please don't run this example without changing the domain to your own domain...
Dim resp As Chilkat.HttpResponse = Await http.SynchronousRequestAsync("www.yourdomain.it",80,useTls,req)
If (http.LastMethodSuccess <> True) Then
    Debug.WriteLine(http.LastErrorText)
    Exit Sub
End If


Dim xmlResponse As New Chilkat.Xml
success = xmlResponse.LoadXml(resp.BodyStr)
' println xmlResponse.GetXml();


Debug.WriteLine("OK.")

 

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