|
|
|
|
|
|
|
Page Views :
|
4905
|
|
Downloads :
|
0
|
|
Rating :
|
Rate it
|
|
Level :
|
Intermediate
|
|
Description:
SOAP (Simple Object Access Protocol) is message based protocol. SOAP messages are nothing but XML document. SOAP messages consist of Envelop Header and Body .XML document data elements are self describing. In this article I am going to show how to attach binary data into SOAP message.
XML
eXtensible Markup Language, XML is text based data storage, XML data are self describing and this data easily move to any platforms (because XML document is ASCII text). XML is not a replacement for HTML. XML and HTML were designed with different goals, XML was designed to describe data and HTML was designed to display data and to focus on how data looks. HTML is about displaying information, XML is about describing information.
Nowadays email clients uses MIME format for attachments, MIME means Multipurpose Internet Mail Extensions. SOAP messages also uses same MIME format for Binary data attachments.
DIME:
Recently Microsoft announced new format called DIME: Sending Binary Data with Your SOAP Messages. Direct Internet Message Encapsulation (DIME) specification defines a mechanism for packaging binary data with SOAP messages, so that when sending data not in XML format, applications need not be constrained by the SOAP specification
When we attach binary data into XML document we will be using base64 encoding format. This base64 encoding uses A-Z, a-z, 0-9 and / characters for encoding.
COM Interoperability:
I developed this application in VB 6.0, using COM Interoperability I imported this application to .NET. Here MSXML and ADO are called using RCW (Runtime COM callable wrapper). RCW helps .NET client can able to call unmanaged codes.
Here I am creating a record set with image filed and then Creating XML document based on the record set fields.
Dim objCon As New ADODB.Connection Dim sql As String = "SELECT * from pub_info where pub_id='0736'" Dim rst As New ADODB.Recordset Dim http As New MSXML2.DOMDocument Dim onode As MSXML.IXMLDOMNode Dim oroot, oele As MSXML2.IXMLDOMElement Dim sCon1 As String = "Provider=SQLOLEDB;User ID=sa; password=sa;Initial" Catalog=pubs;Data Source=(local)" objCon.Open(sCon1) rst = objCon.Execute(sql) Console.Write("{0}", rst(1)) Console.Read() http.loadXML("<?xml version=""1.0""?>"")") oroot = http.createElement("FamilyImages") http.documentElement = oroot oele = http.createElement("Ragavan") oroot.appendChild(oele) 'These following Two lines are very important 'Here we are setting Record set Image fields to base64 data type oele.dataType = "bin.base64" oele.nodeTypedValue = rst.Fields(1).Value
Once you create the XML document you post this XML to Server as a SOAP message.
|
|
Comment Request!
Thank you for reading this post. Please post your feedback, question, or comments about this post
Here.
|
|
|
|
|
Login
to add your contents and source code to this article
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
C# Consulting is founded in 2002 by the founders of C# Corner. Unlike a traditional
consulting company, our consultants are well-known experts in .NET and many of them
are MVPs, authors, and trainers. We specialize in Microsoft .NET development and
utilize Agile Development and Extreme Programming practices to provide fast pace
quick turnaround results. Our software development model is a mix of Agile Development,
traditional SDLC, and Waterfall models.
|
|
Click here to learn more about C# Consulting. |
|
|
|
|
|
|
|
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon.
Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees.
As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
|
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
|
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
|
ASP.NET 4 Hosting
Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites – Click Here!
|
|
|
|
|
|
|
|
|
|
|
|
|