[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.2

Base64 Encoded XML

Asked by peterxlane in Active Server Pages (ASP)

Tags: asp, base64

I am beginning the process of integrating with a USPS webservice.  Based on my request XML, I will receive a response that contains the label image which is base64 encoded.  Here is a sample of what I receive back:

<?xml version="1.0"?>
<DeliveryConfirmationV3.0Response>
      <DeliveryConfirmationNumber>420381199101805213907126809651</DeliveryConfirmationNumber>
      <DeliveryConfirmationLabel>SUkqAAgAAAASAP4ABAABAAAAAAAAAAABBAABAAAApAYAAAEBBAABAAAAmAgAAAIB
      AwABAAAAAQAAAAMBAwABAAAABAAAAAYBAwABAAAAAAAAAAoBAwABAAAAAgAAABEB
      [truncated to keep post short]
      DeliveryConfirmationLabel>
      <ToName>Joe Customer</ToName>
      <ToFirm></ToFirm>
      <ToAddress1>STE 201</ToAddress1>
      <ToAddress2>6060 PRIMACY KWY</ToAddress2>
      <ToCity>Memphis</ToCity>
      <ToState>TN</ToState>
      <ToZip5>38119</ToZip5>
      <ToZip4>5718</ToZip4>
      <Postnet>38119571851</Postnet>
</DeliveryConfirmationV3.0Response>


I know how to extract the element from the XML file that I need (<DeliveryConfirmationLabel>), but how can I convert this into something that the user can view in a browser.  It can either be a .tif or a .pdf based on what I request.


I read this article: http://www.perfectxml.com/articles/xml/binary.asp  and it seemed to describe exactly what I am trying to do, but it suggested building a COM object to accomplish it.  This was my best attempt to convert it to straight ASP:

<%
strXML = {RESPONSE FROM WEBSERVICE SHOWN ABOVE}"
Set oXMLDoc = Server.CreateObject("Msxml2.FreeThreadedDOMDocument.4.0")
If IsObject(oXMLDoc) Then
      oXMLDoc.Async = False
    If oXMLDoc.LoadXML(strXML) Then
            'Response.Write "loaded xml"
            Set oSingleNode = oXMLDoc.selectSingleNode("//DeliveryConfirmationLabel")
            If oSingleNode Is Nothing Then
                  Response.Write "can't find the node"
            Else
                  'Response.Write oSingleNode.Text
                  Const adTypeBinary = 1
                  Const adSaveCreateOverWrite = 2
                  Set objStream = Server.CreateObject("ADODB.Stream")
                  objStream.Open
                  objStream.Type = adTypeBinary
                  objStream.Write oSingleNode.nodeTypedValue
                  objStream.SaveToFile Server.MapPath("test.tif"), adSaveCreateOverWrite
                  objStream.Close
                  Set objStream = Nothing
                  
            End If      
    Else
            Response.Write "unable to load xml"
    End If
Else
            Response.Write "<b>Unable To Create Object</b> "
End If
%>


I get the error:  Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. This is the line that produces the error:

objStream.Write oSingleNode.nodeTypedValue


[+][-]10/02/06 05:08 PM, ID: 17648244Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Active Server Pages (ASP)
Tags: asp, base64
Sign Up Now!
Solution Provided By: amit_g
Participating Experts: 3
Solution Grade: A
 
[+][-]10/02/06 04:34 PM, ID: 17648032Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/02/06 04:38 PM, ID: 17648057Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/02/06 04:44 PM, ID: 17648101Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/02/06 04:45 PM, ID: 17648102Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/02/06 04:52 PM, ID: 17648143Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/02/06 04:53 PM, ID: 17648153Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/02/06 04:58 PM, ID: 17648181Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/02/06 05:07 PM, ID: 17648230Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/02/06 09:16 PM, ID: 17649172Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/03/06 07:36 AM, ID: 17651808Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/03/06 07:38 AM, ID: 17651819Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091118-EE-VQP-93