<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Posting large xml documents from VB6 to a Java servlet.</title>
	<atom:link href="http://www.dbws.net/blog/2007/05/18/posting-large-xml-documents-from-vb6-to-a-java-servlet/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dbws.net/blog/2007/05/18/posting-large-xml-documents-from-vb6-to-a-java-servlet/</link>
	<description>Software development mutterings and maybe a little something about myself.</description>
	<lastBuildDate>Thu, 13 May 2010 20:27:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Bolo</title>
		<link>http://www.dbws.net/blog/2007/05/18/posting-large-xml-documents-from-vb6-to-a-java-servlet/#comment-51974</link>
		<dc:creator>Bolo</dc:creator>
		<pubDate>Thu, 13 May 2010 20:27:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.dbws.net/blog/?p=10#comment-51974</guid>
		<description>On the vb side, I have two functions which I used, a sendFileToURL(filename,url) which performs the actual and a function which reads the entire file into a string. These are below,  these should help you send the data to your servlet, which then you should able to access using a BufferedReader and request.getReader(). Please let me know if you still have further issues.
[code]
Private Function FileText(filename$) As String
    Dim handle As Integer
    handle = FreeFile
    Open filename$ For Input As #handle
    FileText = Input$(LOF(handle), handle)
    Close #handle
End Function

Public Sub sendFileToUrl(filename As String, url As String)
    On Local Error GoTo errors
    
    Dim xml As New MSXML2.XMLHTTP
    
    &#039;.ServerXMLHTTP
    Dim dataToSend As String
    &#039;Set xml = CreateObject(&quot;MSXML2.ServerXMLHTTP&quot;)
    
    Dim doc As New MSXML2.DOMDocument
    doc.preserveWhiteSpace = True
    doc.async = False
    
    If Dir(filename) &lt;&gt; &quot;&quot; Then
        doc.Load filename
        dataToSend = FileText(filename)
                
        xml.open &quot;POST&quot;, url, False, Empty, Empty
        xml.setRequestHeader &quot;Content-Type&quot;, &quot;text/xml&quot;
        xml.send doc.xml &#039;dataToSend
                
        statusCode = xml.Status
        If statusCode = 200 And Not IsNull(xml.responseXML) Then
            responseText = xml.responseXML.xml
        Else
            responseText = xml.responseText
        End If
        Debug.Print statusCode
        Debug.Print responseText
    End If

errors:
    If Err.Number &gt; 0 Then
        If showErrorMessage Then MsgBox (&quot;Error &quot; + Str(Err) + &quot; : &quot; + Error$(Err))
    End If

    Set xml = Nothing
End Sub
[/code]</description>
		<content:encoded><![CDATA[<p>On the vb side, I have two functions which I used, a sendFileToURL(filename,url) which performs the actual and a function which reads the entire file into a string. These are below,  these should help you send the data to your servlet, which then you should able to access using a BufferedReader and request.getReader(). Please let me know if you still have further issues.</p>
<pre class="brush: plain;">
Private Function FileText(filename$) As String
    Dim handle As Integer
    handle = FreeFile
    Open filename$ For Input As #handle
    FileText = Input$(LOF(handle), handle)
    Close #handle
End Function

Public Sub sendFileToUrl(filename As String, url As String)
    On Local Error GoTo errors

    Dim xml As New MSXML2.XMLHTTP

    '.ServerXMLHTTP
    Dim dataToSend As String
    'Set xml = CreateObject(&quot;MSXML2.ServerXMLHTTP&quot;)

    Dim doc As New MSXML2.DOMDocument
    doc.preserveWhiteSpace = True
    doc.async = False

    If Dir(filename) &lt;&gt; &quot;&quot; Then
        doc.Load filename
        dataToSend = FileText(filename)

        xml.open &quot;POST&quot;, url, False, Empty, Empty
        xml.setRequestHeader &quot;Content-Type&quot;, &quot;text/xml&quot;
        xml.send doc.xml 'dataToSend

        statusCode = xml.Status
        If statusCode = 200 And Not IsNull(xml.responseXML) Then
            responseText = xml.responseXML.xml
        Else
            responseText = xml.responseText
        End If
        Debug.Print statusCode
        Debug.Print responseText
    End If

errors:
    If Err.Number &gt; 0 Then
        If showErrorMessage Then MsgBox (&quot;Error &quot; + Str(Err) + &quot; : &quot; + Error$(Err))
    End If

    Set xml = Nothing
End Sub
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeroen</title>
		<link>http://www.dbws.net/blog/2007/05/18/posting-large-xml-documents-from-vb6-to-a-java-servlet/#comment-51972</link>
		<dc:creator>Jeroen</dc:creator>
		<pubDate>Thu, 13 May 2010 18:07:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.dbws.net/blog/?p=10#comment-51972</guid>
		<description>Can you please send me your sources. I have difficulty with encoding base64 in vb6 and decoding in java:

java.io.StreamCorruptedException: invalid stream header: 50532831
        at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:783)
        at java.io.ObjectInputStream.(ObjectInputStream.java:280)
        at com.bbt.convert.Base64.decodeToObject(Base64.java:883)
        at com.bbt.convert.BBTConvertDATA.main(BBTConvertDATA.java:218)
error: Parse error occurred - null
java.lang.NullPointerException
        at com.bbt.convert.BBTConvertDATA.main(BBTConvertDATA.java:218)</description>
		<content:encoded><![CDATA[<p>Can you please send me your sources. I have difficulty with encoding base64 in vb6 and decoding in java:</p>
<p>java.io.StreamCorruptedException: invalid stream header: 50532831<br />
        at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:783)<br />
        at java.io.ObjectInputStream.(ObjectInputStream.java:280)<br />
        at com.bbt.convert.Base64.decodeToObject(Base64.java:883)<br />
        at com.bbt.convert.BBTConvertDATA.main(BBTConvertDATA.java:218)<br />
error: Parse error occurred &#8211; null<br />
java.lang.NullPointerException<br />
        at com.bbt.convert.BBTConvertDATA.main(BBTConvertDATA.java:218)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Srinath</title>
		<link>http://www.dbws.net/blog/2007/05/18/posting-large-xml-documents-from-vb6-to-a-java-servlet/#comment-7320</link>
		<dc:creator>Srinath</dc:creator>
		<pubDate>Wed, 26 Mar 2008 18:55:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.dbws.net/blog/?p=10#comment-7320</guid>
		<description>Hey!

Can you please send some source code examples doing the stuff you are describing here?

Thanks.
-Srinath.</description>
		<content:encoded><![CDATA[<p>Hey!</p>
<p>Can you please send some source code examples doing the stuff you are describing here?</p>
<p>Thanks.<br />
-Srinath.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
