skip to Main Content

I am using classic ASP to parse SOAP XML notifications sent from the eBay api. I am POSTing myself a test example SOAP message from the api documentation. I am able to receive the string of XML data. When I convert the data to string and output xmlString into a text file, the received XML is in there.

When I loadXML(xmlString) into the DOMDocument object and try to output it, all I get is 3 blank lines. Im trying to loop through the elements and parse them, but it appears to be blank inside the DOM object, as I am getting Object Required errors on the lines looking for nodes.

Here is my code, along with the XML message I am POSTing (using Postmaster app) A little guidance would be appreciated!

<%
Function BytesToStr(bytes)
    Dim Stream
    Set Stream = Server.CreateObject("Adodb.Stream")
        Stream.Type = 1 'adTypeBinary
        Stream.Open
        Stream.Write bytes
        Stream.Position = 0
        Stream.Type = 2 'adTypeText
        Stream.Charset = "iso-8859-1"
        BytesToStr = Stream.ReadText
        Stream.Close
    Set Stream = Nothing
End Function


Dim isPost: isPost = (UCase(Request.ServerVariables("REQUEST_METHOD") & "") = "POST")

'Is it a HTTP POST?
If isPost Then

    If Request.TotalBytes > 0 Then
        Dim lngBytesCount, xmlString
        lngBytesCount = Request.TotalBytes
        xmlString = BytesToStr(Request.BinaryRead(lngBytesCount))


        Dim xdoc
        set xdoc = CreateObject("Msxml2.DOMDocument.6.0")
        xdoc.async = false
        xdoc.loadXML(xmlString)

        call xdoc.setProperty("SelectionNamespaces", "xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns='urn:ebay:apis:eBLBaseComponents'")

        '**I commented this next part out because I was getting Error:Object Requred
        '**I couldnt get any XML from xdoc to print at all  
        '**see below: WriteLine(xdoc.xml)    
        'Dim node
        'For Each node in xdoc.selectSingleNode("/soapenv:Body/GetItemResponse").ChildNodes
        '   sResult = sResult & node.xml        
        'Next


        dim fs, tfile
        set fs=Server.CreateObject("Scripting.FileSystemObject")
        set tfile=fs.OpenTextFile("C:inetpubwwwrootASPtest_notification3.txt", 8, True)
        tfile.WriteLine(xdoc.xml)
        tfile.WriteLine("")

        tfile.Close
        set tfile=nothing
        set fs=nothing
    End If
  'Let sender know we have received and processing the message.
  Response.Status = "200 OK"
Else
  'Return method not allowed
  Response.Status = "405 Method Not Allowed"
End If
Response.End
%>

Sample SOAP message posted (from postman app):

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://
www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Header>
    <ebl:RequesterCredentials soapenv:mustUnderstand="0" xmlns:ns="urn:ebay:apis:eBLBaseComponents"
        xmlns:ebl="urn:ebay:apis:eBLBaseComponents">
      <ebl:NotificationSignature xmlns:ebl="urn:ebay:apis:eBLBaseComponents">Z2yhKdKmS0Ga5VPmLDOAlg==</
          ebl:NotificationSignature>
    </ebl:RequesterCredentials>
  </soapenv:Header>
  <soapenv:Body>
    <GetItemResponse xmlns="urn:ebay:apis:eBLBaseComponents">
      <Timestamp>2008-02-13T03:47:28.106Z</Timestamp>
      <Ack>Success</Ack>
      <CorrelationID>137541140</CorrelationID>
      <Version>553</Version>
      <Build>e553_core_Bundled_6057805_R1</Build>
      <NotificationEventName>ItemSold</NotificationEventName>
      <RecipientUserID>Seller1</RecipientUserID>
      <Item>
        <AutoPay>false</AutoPay>
        <BuyerProtection>ItemEligible</BuyerProtection>
        <BuyItNowPrice currencyID="USD">10.0</BuyItNowPrice>
        <Country>US</Country>
        <Currency>USD</Currency>
        <GiftIcon>0</GiftIcon>
        <HitCounter>NoHitCounter</HitCounter>
        <ItemID>250000627102</ItemID>
        <ListingDetails>
          <Adult>false</Adult>
          <BindingAuction>false</BindingAuction>
          <CheckoutEnabled>true</CheckoutEnabled>
          <ConvertedBuyItNowPrice currencyID="USD">10.0</ConvertedBuyItNowPrice>
          <ConvertedStartPrice currencyID="USD">1.0</ConvertedStartPrice>
          <ConvertedReservePrice currencyID="USD">0.0</ConvertedReservePrice>
          <HasReservePrice>false</HasReservePrice>
          <StartTime>2008-02-13T03:42:45.000Z</StartTime>
          <EndTime>2008-02-13T03:43:32.000Z</EndTime>
          <ViewItemURL>http://cgi.qa-api012.qa.ebay.com/ws/eBayISAPI.dll?ViewItem&amp;item=250000627102&amp;category=1463</ViewItemURL>
          <HasUnansweredQuestions>false</HasUnansweredQuestions>
          <HasPublicMessages>false</HasPublicMessages>
          <ExpressListing>false</ExpressListing>
          <ViewItemURLForNaturalSearch>http://cgi.qa-api012.qa.ebay.com/Test-Item-Won-Sold-notify_W0QQitemZ250000627102QQcategoryZ1463QQcmdZViewItem</ViewItemURLForNaturalSearch>
        </ListingDetails>
        <ListingDuration>Days_5</ListingDuration>
        <ListingType>Chinese</ListingType>
        <Location>San Jose, CA</Location>
        <PaymentMethods>PaymentSeeDescription</PaymentMethods>
        <PaymentMethods>PayPal</PaymentMethods>
        <PayPalEmailAddress>[email protected]</PayPalEmailAddress>
        <PrimaryCategory>
          <CategoryID>1463</CategoryID>
          <CategoryName>Collectibles:Trading Cards:Phone Cards</CategoryName>
        </PrimaryCategory>
        <PrivateListing>false</PrivateListing>
        <Quantity>1</Quantity>
        <ReservePrice currencyID="USD">0.0</ReservePrice>
        <ReviseStatus>
          <ItemRevised>false</ItemRevised>
        </ReviseStatus>
        <Seller>
          <AboutMePage>false</AboutMePage>
          <Email>[email protected]</Email>
          <FeedbackScore>100</FeedbackScore>
          <PositiveFeedbackPercent>98.1</PositiveFeedbackPercent>
          <FeedbackPrivate>false</FeedbackPrivate>
          <FeedbackRatingStar>Turquoise</FeedbackRatingStar>
          <IDVerified>false</IDVerified>
          <eBayGoodStanding>true</eBayGoodStanding>
          <NewUser>false</NewUser>
          <RegistrationDate>2004-02-23T23:50:13.000Z</RegistrationDate>
          <Site>US</Site>
          <Status>Confirmed</Status>
          <UserID>Seller1</UserID>
          <UserIDChanged>false</UserIDChanged>
          <UserIDLastChanged>2004-02-23T23:48:54.000Z</UserIDLastChanged>
          <VATStatus>NoVATTax</VATStatus>
          <SellerInfo>
            <AllowPaymentEdit>true</AllowPaymentEdit>
            <CheckoutEnabled>true</CheckoutEnabled>
            <CIPBankAccountStored>false</CIPBankAccountStored>
            <GoodStanding>true</GoodStanding>
            <MerchandizingPref>OptIn</MerchandizingPref>
            <QualifiesForB2BVAT>false</QualifiesForB2BVAT>
            <SellerLevel>None</SellerLevel>
            <StoreOwner>false</StoreOwner>
            <ExpressEligible>false</ExpressEligible>
            <ExpressWallet>false</ExpressWallet>
            <SafePaymentExempt>true</SafePaymentExempt>
          </SellerInfo>
          <MotorsDealer>false</MotorsDealer>
        </Seller>
        <SellingStatus>
          <BidCount>2</BidCount>
          <BidIncrement currencyID="USD">0.25</BidIncrement>
          <ConvertedCurrentPrice currencyID="USD">1.25</ConvertedCurrentPrice>
          <CurrentPrice currencyID="USD">1.25</CurrentPrice>
          <HighBidder>
            <AboutMePage>false</AboutMePage>
            <EIASToken>nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6wJkoWoCJaGoAmdj6x9nY+seQ==</EIASToken>
            <Email>[email protected]</Email>
            <FeedbackScore>5</FeedbackScore>
            <PositiveFeedbackPercent>100.0</PositiveFeedbackPercent>
            <FeedbackPrivate>false</FeedbackPrivate>
            <FeedbackRatingStar>None</FeedbackRatingStar>
            <IDVerified>false</IDVerified>
            <eBayGoodStanding>true</eBayGoodStanding>
            <NewUser>false</NewUser>
            <RegistrationDate>2004-02-24T07:00:00.000Z</RegistrationDate>
            <Site>US</Site>
            <Status>Confirmed</Status>
            <UserID>Buyer1</UserID>
            <UserIDChanged>false</UserIDChanged>
            <UserIDLastChanged>2004-02-24T07:00:00.000Z</UserIDLastChanged>
            <VATStatus>NoVATTax</VATStatus>
            <BuyerInfo>
              <ShippingAddress>
                <Country>US</Country>
                <PostalCode>95125</PostalCode>
              </ShippingAddress>
            </BuyerInfo>
            <UserAnonymized>false</UserAnonymized>
          </HighBidder>
          <LeadCount>0</LeadCount>
          <MinimumToBid currencyID="USD">1.5</MinimumToBid>
          <QuantitySold>1</QuantitySold>
          <ReserveMet>true</ReserveMet>
          <SecondChanceEligible>true</SecondChanceEligible>
          <ListingStatus>Completed</ListingStatus>
        </SellingStatus>
        <ShippingDetails>
          <AllowPaymentEdit>true</AllowPaymentEdit>
          <ApplyShippingDiscount>false</ApplyShippingDiscount>
          <InsuranceOption>NotOffered</InsuranceOption>
          <SalesTax>
            <SalesTaxPercent>0.0</SalesTaxPercent>
            <ShippingIncludedInTax>false</ShippingIncludedInTax>
          </SalesTax>
          <ThirdPartyCheckout>false</ThirdPartyCheckout>
          <TaxTable/>
        </ShippingDetails>
        <ShipToLocations>US</ShipToLocations>
        <Site>US</Site>
        <StartPrice currencyID="USD">1.0</StartPrice>
        <TimeLeft>PT0S</TimeLeft>
        <Title>Test Item{Won/Sold} notify</Title>
        <HitCount>0</HitCount>
        <GetItFast>false</GetItFast>
        <PostalCode>
        </PostalCode>
        <PictureDetails>
          <PhotoDisplay>None</PhotoDisplay>
        </PictureDetails>
        <ProxyItem>false</ProxyItem>
      </Item>
    </GetItemResponse>
  </soapenv:Body>
</soapenv:Envelope>

2

Answers


  1. Well after testing your code it isn’t the Charset property causing the problem (but I would make sure it is set to UTF-8 anyway).

    The issue is the XML failing to parse and when checking the parseError found this;

    -1072896749 – Whitespace is not allowed at this location.

    Then I took a look at the XML you posted and it does have some hard wrapping in there which I removed and tested again, this time it succeeded.

    Modified XML (removed hard wrapping)

    <?xml version="1.0" encoding="utf-8"?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Header>
        <ebl:RequesterCredentials soapenv:mustUnderstand="0" xmlns:ns="urn:ebay:apis:eBLBaseComponents"  xmlns:ebl="urn:ebay:apis:eBLBaseComponents">
          <ebl:NotificationSignature xmlns:ebl="urn:ebay:apis:eBLBaseComponents">Z2yhKdKmS0Ga5VPmLDOAlg==</ebl:NotificationSignature>
        </ebl:RequesterCredentials>
      </soapenv:Header>
      <soapenv:Body>
        <GetItemResponse xmlns="urn:ebay:apis:eBLBaseComponents">
          <Timestamp>2008-02-13T03:47:28.106Z</Timestamp>
          <Ack>Success</Ack>
          <CorrelationID>137541140</CorrelationID>
          <Version>553</Version>
          <Build>e553_core_Bundled_6057805_R1</Build>
          <NotificationEventName>ItemSold</NotificationEventName>
          <RecipientUserID>Seller1</RecipientUserID>
          <Item>
            <AutoPay>false</AutoPay>
            <BuyerProtection>ItemEligible</BuyerProtection>
            <BuyItNowPrice currencyID="USD">10.0</BuyItNowPrice>
            <Country>US</Country>
            <Currency>USD</Currency>
            <GiftIcon>0</GiftIcon>
            <HitCounter>NoHitCounter</HitCounter>
            <ItemID>250000627102</ItemID>
            <ListingDetails>
              <Adult>false</Adult>
              <BindingAuction>false</BindingAuction>
              <CheckoutEnabled>true</CheckoutEnabled>
              <ConvertedBuyItNowPrice currencyID="USD">10.0</ConvertedBuyItNowPrice>
              <ConvertedStartPrice currencyID="USD">1.0</ConvertedStartPrice>
              <ConvertedReservePrice currencyID="USD">0.0</ConvertedReservePrice>
              <HasReservePrice>false</HasReservePrice>
              <StartTime>2008-02-13T03:42:45.000Z</StartTime>
              <EndTime>2008-02-13T03:43:32.000Z</EndTime>
              <ViewItemURL>http://cgi.qa-api012.qa.ebay.com/ws/eBayISAPI.dll?ViewItem&amp;item=250000627102&amp;category=1463</ViewItemURL>
              <HasUnansweredQuestions>false</HasUnansweredQuestions>
              <HasPublicMessages>false</HasPublicMessages>
              <ExpressListing>false</ExpressListing>
              <ViewItemURLForNaturalSearch>http://cgi.qa-api012.qa.ebay.com/Test-Item-Won-Sold-notify_W0QQitemZ250000627102QQcategoryZ1463QQcmdZViewItem</ViewItemURLForNaturalSearch>
            </ListingDetails>
            <ListingDuration>Days_5</ListingDuration>
            <ListingType>Chinese</ListingType>
            <Location>San Jose, CA</Location>
            <PaymentMethods>PaymentSeeDescription</PaymentMethods>
            <PaymentMethods>PayPal</PaymentMethods>
            <PayPalEmailAddress>[email protected]</PayPalEmailAddress>
            <PrimaryCategory>
              <CategoryID>1463</CategoryID>
              <CategoryName>Collectibles:Trading Cards:Phone Cards</CategoryName>
            </PrimaryCategory>
            <PrivateListing>false</PrivateListing>
            <Quantity>1</Quantity>
            <ReservePrice currencyID="USD">0.0</ReservePrice>
            <ReviseStatus>
              <ItemRevised>false</ItemRevised>
            </ReviseStatus>
            <Seller>
              <AboutMePage>false</AboutMePage>
              <Email>[email protected]</Email>
              <FeedbackScore>100</FeedbackScore>
              <PositiveFeedbackPercent>98.1</PositiveFeedbackPercent>
              <FeedbackPrivate>false</FeedbackPrivate>
              <FeedbackRatingStar>Turquoise</FeedbackRatingStar>
              <IDVerified>false</IDVerified>
              <eBayGoodStanding>true</eBayGoodStanding>
              <NewUser>false</NewUser>
              <RegistrationDate>2004-02-23T23:50:13.000Z</RegistrationDate>
              <Site>US</Site>
              <Status>Confirmed</Status>
              <UserID>Seller1</UserID>
              <UserIDChanged>false</UserIDChanged>
              <UserIDLastChanged>2004-02-23T23:48:54.000Z</UserIDLastChanged>
              <VATStatus>NoVATTax</VATStatus>
              <SellerInfo>
                <AllowPaymentEdit>true</AllowPaymentEdit>
                <CheckoutEnabled>true</CheckoutEnabled>
                <CIPBankAccountStored>false</CIPBankAccountStored>
                <GoodStanding>true</GoodStanding>
                <MerchandizingPref>OptIn</MerchandizingPref>
                <QualifiesForB2BVAT>false</QualifiesForB2BVAT>
                <SellerLevel>None</SellerLevel>
                <StoreOwner>false</StoreOwner>
                <ExpressEligible>false</ExpressEligible>
                <ExpressWallet>false</ExpressWallet>
                <SafePaymentExempt>true</SafePaymentExempt>
              </SellerInfo>
              <MotorsDealer>false</MotorsDealer>
            </Seller>
            <SellingStatus>
              <BidCount>2</BidCount>
              <BidIncrement currencyID="USD">0.25</BidIncrement>
              <ConvertedCurrentPrice currencyID="USD">1.25</ConvertedCurrentPrice>
              <CurrentPrice currencyID="USD">1.25</CurrentPrice>
              <HighBidder>
                <AboutMePage>false</AboutMePage>
                <EIASToken>nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6wJkoWoCJaGoAmdj6x9nY+seQ==</EIASToken>
                <Email>[email protected]</Email>
                <FeedbackScore>5</FeedbackScore>
                <PositiveFeedbackPercent>100.0</PositiveFeedbackPercent>
                <FeedbackPrivate>false</FeedbackPrivate>
                <FeedbackRatingStar>None</FeedbackRatingStar>
                <IDVerified>false</IDVerified>
                <eBayGoodStanding>true</eBayGoodStanding>
                <NewUser>false</NewUser>
                <RegistrationDate>2004-02-24T07:00:00.000Z</RegistrationDate>
                <Site>US</Site>
                <Status>Confirmed</Status>
                <UserID>Buyer1</UserID>
                <UserIDChanged>false</UserIDChanged>
                <UserIDLastChanged>2004-02-24T07:00:00.000Z</UserIDLastChanged>
                <VATStatus>NoVATTax</VATStatus>
                <BuyerInfo>
                  <ShippingAddress>
                    <Country>US</Country>
                    <PostalCode>95125</PostalCode>
                  </ShippingAddress>
                </BuyerInfo>
                <UserAnonymized>false</UserAnonymized>
              </HighBidder>
              <LeadCount>0</LeadCount>
              <MinimumToBid currencyID="USD">1.5</MinimumToBid>
              <QuantitySold>1</QuantitySold>
              <ReserveMet>true</ReserveMet>
              <SecondChanceEligible>true</SecondChanceEligible>
              <ListingStatus>Completed</ListingStatus>
            </SellingStatus>
            <ShippingDetails>
              <AllowPaymentEdit>true</AllowPaymentEdit>
              <ApplyShippingDiscount>false</ApplyShippingDiscount>
              <InsuranceOption>NotOffered</InsuranceOption>
              <SalesTax>
                <SalesTaxPercent>0.0</SalesTaxPercent>
                <ShippingIncludedInTax>false</ShippingIncludedInTax>
              </SalesTax>
              <ThirdPartyCheckout>false</ThirdPartyCheckout>
              <TaxTable/>
            </ShippingDetails>
            <ShipToLocations>US</ShipToLocations>
            <Site>US</Site>
            <StartPrice currencyID="USD">1.0</StartPrice>
            <TimeLeft>PT0S</TimeLeft>
            <Title>Test Item{Won/Sold} notify</Title>
            <HitCount>0</HitCount>
            <GetItFast>false</GetItFast>
            <PostalCode>
            </PostalCode>
            <PictureDetails>
              <PhotoDisplay>None</PhotoDisplay>
            </PictureDetails>
            <ProxyItem>false</ProxyItem>
          </Item>
        </GetItemResponse>
      </soapenv:Body>
    </soapenv:Envelope>
    

    Here is the modified code to help debug

    <%
    Option Explicit
    
    Function BytesToStr(bytes)
        Dim Stream
        Set Stream = Server.CreateObject("Adodb.Stream")
        With Stream
            .Type = 1 'adTypeBinary
            .Open
            .Write bytes
            .Position = 0
            .Type = 2 'adTypeText
            .Charset = "UTF-8"
            BytesToStr = .ReadText
            Stream.Close
        End With
        Set Stream = Nothing
    End Function
    
    
    Dim isPost: isPost = (UCase(Request.ServerVariables("REQUEST_METHOD") & "") = "POST")
    Dim lngBytesCount, xmlString
    Dim xdoc, fs, tfile
    Dim loaded
    
    'Is it a HTTP POST?
    If isPost Then
    
        If Request.TotalBytes > 0 Then
            lngBytesCount = Request.TotalBytes
            xmlString = BytesToStr(Request.BinaryRead(lngBytesCount))
    
            Set xdoc = CreateObject("Msxml2.DOMDocument.6.0")
            xdoc.async = False
            loaded = xdoc.loadXML(xmlString)
            If loaded Then
                Call xdoc.setProperty("SelectionNamespaces", "xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns='urn:ebay:apis:eBLBaseComponents'")
    
                '**I commented this next part out because I was getting Error:Object Requred
                '**I couldnt get any XML from xdoc to print at all  
                '**see below: WriteLine(xdoc.xml)    
                'Dim node
                'For Each node in xdoc.selectSingleNode("/soapenv:Body/GetItemResponse").ChildNodes
                '   sResult = sResult & node.xml        
                'Next
    
                Set fs=Server.CreateObject("Scripting.FileSystemObject")
                Set tfile=fs.OpenTextFile(Server.MapPath("/files") & "_notification3.txt", 8, True)
                Call tfile.WriteLine(xdoc.xml)
                Call tfile.WriteLine("")
    
                Call tfile.Close()
                Set tfile = Nothing
                Set fs = Nothing
    
                'Let sender know we have received and processing the message.
                Response.Status = "200 OK"
                Response.Write "Message processed"
            Else
                Response.Status = "400 Bad Request"
                Response.Write xdoc.parseError.errorCode & " - " & xdoc.parseError.Reason
            End If
        Else
          Response.Status = "400 Bad Request"
          Response.Write "No message was sent"
        End If
    Else
      'Return method not allowed
      Response.Status = "405 Method Not Allowed"
      Response.Write "Requested method is not supported."
    End If
    Response.End
    %>
    

    Should point out that to test the file creation I modified the path but your hard coded path on your system should work just fine. I modified it so that I could use Server.MapPath() to map the physical location of a folder I called files outside of the website and give the anonymous account the required permission to write to it. You don’t have to do any of this, I was just explaining why the code looks different.

    Parsing XML

    Couple of things to point out.

    The loadXML() method returns a Boolean to tell you whether the XML successfully loaded or not. If the return value is False use parseError object to retrieve the last error the parser encountered while validating the XML.

    In the example above I pass it back as a HTTP 400 Bad Request response with the errorCode and Reason properties as the body of the message.


    Related

    Login or Signup to reply.
  2. Accepted solution is definitely the answer to the question.

    But I want to show other methods related with little known capabilities of the MSXML.

    This, processing XML request body also can be done in more reliable binary-safe ways without string conversions, possible charset / encoding headaches etc.

    load method can handle ASP’s Request object, a Stream object (or an object implements IStream) or SAFEARRAY of unsigned bytes.

    from load Method (C/C++ Syntax)

    Parameters

    xmlSource[in]

    An indicator of the source XML to parse. This may be an URL (String/BSTR), a Request object (in an ASP page) [1], an IStream [3],
    SAFEARRAY of bytes (VT_ARRAY|VT_UI1) [2], a DOMDocument object, or any
    object that supports IStream, ISequentialStream, or IPersistStream.
    See Remarks for more information. isSuccessful[out, retval]

    Based on Lankymart’s solution (thanks for the credit BTW), from simple to complex:

    Method #1 – The Request object

    '[...]
    Set xdoc = Server.CreateObject("MSXML2.DOMDocument.6.0")
    xdoc.async = False
    loaded = xdoc.load(Request)
    '[...]
    

    Method #2 – SAFEARRAY

    '[...]
    Set xdoc = Server.CreateObject("MSXML2.DOMDocument.6.0")
    xdoc.async = False
    loaded = xdoc.Load(Request.BinaryRead(lngBytesCount))
    '[...]
    

    Method #3Adodb.Stream object (binary type)

    '[...]
    Set xdoc = Server.CreateObject("MSXML2.DOMDocument.6.0")
        xdoc.async = False
    
    Dim binaryStream
    Set binaryStream = Server.CreateObject("Adodb.Stream")
        binaryStream.Type = 1 'adTypeBinary
        binaryStream.Open
        binaryStream.Write Request.BinaryRead(lngBytesCount)
        binaryStream.Position = 0
    
    loaded = xdoc.Load(binaryStream)
    '[...]
    

    Hope it helps.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search