<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Error java.io.StreamCorruptedException: invalid stream header: 2D2D2D2D when uploading a WTDocument in Windchill</title>
    <link>https://community.ptc.com/t5/Windchill/Error-java-io-StreamCorruptedException-invalid-stream-header/m-p/981762#M82813</link>
    <description>&lt;P&gt;&lt;a href="https://community.ptc.com/t5/user/viewprofilepage/user-id/712039"&gt;@VanVelZ&lt;/a&gt;&amp;nbsp;In reference of your&amp;nbsp;&lt;A href="https://community.ptc.com/t5/Windchill/Send-Primary-Content-via-POST-HTTP-request/m-p/896706#M74128" target="_blank" rel="noopener"&gt;topic.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hello, Would you agree to share the whole code of your final solution.&lt;/P&gt;
&lt;P&gt;I'm struggling with something similar, I need to POST an upload of a WTDocument and I'm receiving an error:&amp;nbsp;&lt;SPAN&gt;java.io.StreamCorruptedException: invalid stream header: 2D2D2D2D. I'm trying to do it using Java class combine with REST.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here is the&amp;nbsp; prototype method I'm testing:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;public static void uploadOData2(String serviceUrl, String payload, String username, String password, String certPath, String methode, String csrfNonce) {&lt;BR /&gt;HttpsURLConnection httpsConn = null;&lt;BR /&gt;OutputStream outputStream = null;&lt;BR /&gt;try {&lt;BR /&gt;// Load the server certificate&lt;BR /&gt;CertificateFactory cf = CertificateFactory.getInstance("X.509");&lt;BR /&gt;InputStream caInput = new FileInputStream(certPath);&lt;BR /&gt;X509Certificate ca = (X509Certificate) cf.generateCertificate(caInput);&lt;BR /&gt;caInput.close();&lt;/P&gt;
&lt;P&gt;// Create a KeyStore containing the trusted certificate&lt;BR /&gt;KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());&lt;BR /&gt;keyStore.load(null, null);&lt;BR /&gt;keyStore.setCertificateEntry("ca", ca);&lt;/P&gt;
&lt;P&gt;// Create a TrustManager that trusts the certificate in the KeyStore&lt;BR /&gt;TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());&lt;BR /&gt;tmf.init(keyStore);&lt;/P&gt;
&lt;P&gt;// Create an SSLContext that uses the TrustManager&lt;BR /&gt;SSLContext sslContext = SSLContext.getInstance("TLS");&lt;BR /&gt;sslContext.init(null, tmf.getTrustManagers(), null);&lt;BR /&gt;File file = new File("c:/temp/test.txt");&lt;/P&gt;
&lt;P&gt;if (file.exists()) {&lt;BR /&gt;// Set the default SSLContext&lt;BR /&gt;HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory());&lt;/P&gt;
&lt;P&gt;URL url = new URL(serviceUrl);&lt;BR /&gt;httpsConn = (HttpsURLConnection) url.openConnection();&lt;BR /&gt;httpsConn.setRequestMethod(methode.toUpperCase());&lt;BR /&gt;httpsConn.setRequestProperty("Content-Type", "text/plain");&lt;BR /&gt;httpsConn.setRequestProperty("Accept", "text/plain");&lt;BR /&gt;httpsConn.setRequestProperty("Content-Disposition", "form-data; name=\"file\"; filename=\"test.txt\"");&lt;BR /&gt;httpsConn.setRequestProperty("Content-Length", String.valueOf(file.length()));&lt;BR /&gt;httpsConn.setDoOutput(true);&lt;BR /&gt;httpsConn.setRequestProperty("CSRF_NONCE", csrfNonce);&lt;BR /&gt;DataOutputStream wr = new DataOutputStream(httpsConn.getOutputStream());&lt;BR /&gt;FileInputStream fileInputStream = new FileInputStream(file);&lt;BR /&gt;byte[] fileContent = fileInputStream.readAllBytes();&lt;BR /&gt;fileInputStream.close();&lt;BR /&gt;// Append binary content to payload&lt;BR /&gt;String boundary = "\r\n---------------------------boundary\r\n";&lt;BR /&gt;payload += "\r\n";&lt;BR /&gt;payload += fileContent;&lt;BR /&gt;payload += boundary;&lt;BR /&gt;// Send payload&lt;BR /&gt;wr.write(payload.getBytes());&lt;BR /&gt;wr.flush();&lt;BR /&gt;wr.close();&lt;BR /&gt;httpsConn.connect();&lt;/P&gt;
&lt;P&gt;int responseCode = httpsConn.getResponseCode();&lt;BR /&gt;if (responseCode == HttpsURLConnection.HTTP_OK) {&lt;BR /&gt;// OData POST request successful&lt;BR /&gt;} else {&lt;BR /&gt;// OData POST request failed. Server returned response code&lt;BR /&gt;InputStream errorStream = httpsConn.getErrorStream();&lt;BR /&gt;if (errorStream != null) {&lt;BR /&gt;byte[] errorBytes = errorStream.readAllBytes();&lt;BR /&gt;// Error response&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;httpsConn.disconnect();&lt;BR /&gt;} else {&lt;BR /&gt;// File not found&lt;BR /&gt;}&lt;BR /&gt;} catch (Exception e) {&lt;BR /&gt;e.printStackTrace();&lt;BR /&gt;} finally {&lt;BR /&gt;try {&lt;BR /&gt;if (outputStream != null) outputStream.close();&lt;BR /&gt;if (httpsConn != null) httpsConn.disconnect();&lt;BR /&gt;} catch (Exception e) {&lt;BR /&gt;e.printStackTrace();&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 05 Nov 2024 04:13:01 GMT</pubDate>
    <dc:creator>smartel</dc:creator>
    <dc:date>2024-11-05T04:13:01Z</dc:date>
    <item>
      <title>Error java.io.StreamCorruptedException: invalid stream header: 2D2D2D2D when uploading a WTDocument</title>
      <link>https://community.ptc.com/t5/Windchill/Error-java-io-StreamCorruptedException-invalid-stream-header/m-p/981762#M82813</link>
      <description>&lt;P&gt;&lt;a href="https://community.ptc.com/t5/user/viewprofilepage/user-id/712039"&gt;@VanVelZ&lt;/a&gt;&amp;nbsp;In reference of your&amp;nbsp;&lt;A href="https://community.ptc.com/t5/Windchill/Send-Primary-Content-via-POST-HTTP-request/m-p/896706#M74128" target="_blank" rel="noopener"&gt;topic.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hello, Would you agree to share the whole code of your final solution.&lt;/P&gt;
&lt;P&gt;I'm struggling with something similar, I need to POST an upload of a WTDocument and I'm receiving an error:&amp;nbsp;&lt;SPAN&gt;java.io.StreamCorruptedException: invalid stream header: 2D2D2D2D. I'm trying to do it using Java class combine with REST.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here is the&amp;nbsp; prototype method I'm testing:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;public static void uploadOData2(String serviceUrl, String payload, String username, String password, String certPath, String methode, String csrfNonce) {&lt;BR /&gt;HttpsURLConnection httpsConn = null;&lt;BR /&gt;OutputStream outputStream = null;&lt;BR /&gt;try {&lt;BR /&gt;// Load the server certificate&lt;BR /&gt;CertificateFactory cf = CertificateFactory.getInstance("X.509");&lt;BR /&gt;InputStream caInput = new FileInputStream(certPath);&lt;BR /&gt;X509Certificate ca = (X509Certificate) cf.generateCertificate(caInput);&lt;BR /&gt;caInput.close();&lt;/P&gt;
&lt;P&gt;// Create a KeyStore containing the trusted certificate&lt;BR /&gt;KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());&lt;BR /&gt;keyStore.load(null, null);&lt;BR /&gt;keyStore.setCertificateEntry("ca", ca);&lt;/P&gt;
&lt;P&gt;// Create a TrustManager that trusts the certificate in the KeyStore&lt;BR /&gt;TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());&lt;BR /&gt;tmf.init(keyStore);&lt;/P&gt;
&lt;P&gt;// Create an SSLContext that uses the TrustManager&lt;BR /&gt;SSLContext sslContext = SSLContext.getInstance("TLS");&lt;BR /&gt;sslContext.init(null, tmf.getTrustManagers(), null);&lt;BR /&gt;File file = new File("c:/temp/test.txt");&lt;/P&gt;
&lt;P&gt;if (file.exists()) {&lt;BR /&gt;// Set the default SSLContext&lt;BR /&gt;HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory());&lt;/P&gt;
&lt;P&gt;URL url = new URL(serviceUrl);&lt;BR /&gt;httpsConn = (HttpsURLConnection) url.openConnection();&lt;BR /&gt;httpsConn.setRequestMethod(methode.toUpperCase());&lt;BR /&gt;httpsConn.setRequestProperty("Content-Type", "text/plain");&lt;BR /&gt;httpsConn.setRequestProperty("Accept", "text/plain");&lt;BR /&gt;httpsConn.setRequestProperty("Content-Disposition", "form-data; name=\"file\"; filename=\"test.txt\"");&lt;BR /&gt;httpsConn.setRequestProperty("Content-Length", String.valueOf(file.length()));&lt;BR /&gt;httpsConn.setDoOutput(true);&lt;BR /&gt;httpsConn.setRequestProperty("CSRF_NONCE", csrfNonce);&lt;BR /&gt;DataOutputStream wr = new DataOutputStream(httpsConn.getOutputStream());&lt;BR /&gt;FileInputStream fileInputStream = new FileInputStream(file);&lt;BR /&gt;byte[] fileContent = fileInputStream.readAllBytes();&lt;BR /&gt;fileInputStream.close();&lt;BR /&gt;// Append binary content to payload&lt;BR /&gt;String boundary = "\r\n---------------------------boundary\r\n";&lt;BR /&gt;payload += "\r\n";&lt;BR /&gt;payload += fileContent;&lt;BR /&gt;payload += boundary;&lt;BR /&gt;// Send payload&lt;BR /&gt;wr.write(payload.getBytes());&lt;BR /&gt;wr.flush();&lt;BR /&gt;wr.close();&lt;BR /&gt;httpsConn.connect();&lt;/P&gt;
&lt;P&gt;int responseCode = httpsConn.getResponseCode();&lt;BR /&gt;if (responseCode == HttpsURLConnection.HTTP_OK) {&lt;BR /&gt;// OData POST request successful&lt;BR /&gt;} else {&lt;BR /&gt;// OData POST request failed. Server returned response code&lt;BR /&gt;InputStream errorStream = httpsConn.getErrorStream();&lt;BR /&gt;if (errorStream != null) {&lt;BR /&gt;byte[] errorBytes = errorStream.readAllBytes();&lt;BR /&gt;// Error response&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;httpsConn.disconnect();&lt;BR /&gt;} else {&lt;BR /&gt;// File not found&lt;BR /&gt;}&lt;BR /&gt;} catch (Exception e) {&lt;BR /&gt;e.printStackTrace();&lt;BR /&gt;} finally {&lt;BR /&gt;try {&lt;BR /&gt;if (outputStream != null) outputStream.close();&lt;BR /&gt;if (httpsConn != null) httpsConn.disconnect();&lt;BR /&gt;} catch (Exception e) {&lt;BR /&gt;e.printStackTrace();&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2024 04:13:01 GMT</pubDate>
      <guid>https://community.ptc.com/t5/Windchill/Error-java-io-StreamCorruptedException-invalid-stream-header/m-p/981762#M82813</guid>
      <dc:creator>smartel</dc:creator>
      <dc:date>2024-11-05T04:13:01Z</dc:date>
    </item>
    <item>
      <title>Re: Error java.io.StreamCorruptedException: invalid stream header: 2D2D2D2D when uploading a WTDocum</title>
      <link>https://community.ptc.com/t5/Windchill/Error-java-io-StreamCorruptedException-invalid-stream-header/m-p/981854#M82814</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.ptc.com/t5/user/viewprofilepage/user-id/167346"&gt;@smartel&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is not case by Windchill or any windchill api methods.&lt;/P&gt;
&lt;P&gt;It is general mistake&lt;/P&gt;
&lt;P&gt;Check google how to solve the&amp;nbsp;&lt;SPAN&gt;invalid stream header exception&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/23262160/java-io-streamcorruptedexception-invalid-stream-header-54657374" target="_blank" rel="noopener"&gt;invalid stream header&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://medium.com/@becomesoil.1966/java-io-streamcorruptedexception-invalid-stream-header-45a729f08e5e" target="_blank" rel="noopener"&gt;java.io.StreamCorruptedException: invalid stream header&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PetrH&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2024 06:37:47 GMT</pubDate>
      <guid>https://community.ptc.com/t5/Windchill/Error-java-io-StreamCorruptedException-invalid-stream-header/m-p/981854#M82814</guid>
      <dc:creator>HelesicPetr</dc:creator>
      <dc:date>2024-11-05T06:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: Error java.io.StreamCorruptedException: invalid stream header: 2D2D2D2D when uploading a WTDocum</title>
      <link>https://community.ptc.com/t5/Windchill/Error-java-io-StreamCorruptedException-invalid-stream-header/m-p/984001#M82994</link>
      <description>&lt;P&gt;Probably my question unclear.&lt;/P&gt;&lt;P&gt;The used case we have, is a file is generated by a test bench, we want the operator to upload the file into Windchill.&lt;/P&gt;&lt;P&gt;So we created an interface, when he user click it request his username and password then send the file into Windchill and attach it to a wtpart. We wanted to do it using REST api through a java class.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that an empty wtdocument is already created before through a Workflow process.&lt;/P&gt;&lt;P&gt;So I refer to&amp;nbsp;&lt;A href="https://www.ptc.com/en/support/article/CS305415?source=search" target="_blank"&gt;Article - CS305415 - How to update the Primary content of an existing WTDocuments via External Storage method using OData REST Services in Windchill PDMLink&lt;/A&gt;&lt;/P&gt;&lt;P&gt;So, here is my solution for this problem in case it can help someone else:&lt;/P&gt;&lt;DIV&gt;/**&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;* Executes a PUT request to the specified OData service URL to upload a file.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;* @param serviceUrl the OData service URL ex.: serverUrl + "/servlet/odata/DocMgmt/Documents('OR:wt.doc.WTDocument:" + idA2A2 + "')/PrimaryContent";&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;* @param username&amp;nbsp; &amp;nbsp;the username for basic authentication&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;* @param password&amp;nbsp; &amp;nbsp;the password for basic authentication&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;* @param certPath&amp;nbsp; &amp;nbsp;the path to the SSL certificate&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;* @param csrfNonce&amp;nbsp; the CSRF nonce token&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;* @param filePath&amp;nbsp; &amp;nbsp;the path to the file to be uploaded ex.: "C:\TEMP\Test123.xls"&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;* @return the response from the OData service&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;*/&lt;/DIV&gt;&lt;DIV&gt;public static String putOData(String serviceUrl, String username, String password, String certPath, String csrfNonce, String filePath) {&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;HttpsURLConnection httpsConn = null;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;OutputStream outputStream = null;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;String response = "";&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;try {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;//Method to get the SSL context&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SSLContext sslContext = getSSLContext(certPath);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;File file = new File(filePath);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// Set the default SSLContext&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;HttpClient httpClient = HttpClientBuilder.create().setSSLContext(sslContext).build();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;HttpPut request = new HttpPut(serviceUrl);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;if (file != null &amp;amp;&amp;amp; file.exists()) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// Add Basic Authentication header&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;String auth = username + ":" + password;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;String encodedAuth = Base64.getEncoder().encodeToString(auth.getBytes());&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;request.addHeader("CSRF_NONCE", csrfNonce);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;request.addHeader("Accept", "application/json");&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;request.addHeader("Authorization", "Basic " + encodedAuth);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;MultipartEntityBuilder builder = MultipartEntityBuilder.create();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;builder.addBinaryBody("File", file, ContentType.DEFAULT_BINARY, file.getName());&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;builder.addTextBody("key", file.getName(), ContentType.TEXT_PLAIN);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;HttpEntity entity = builder.build();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;request.setEntity(entity);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;log.info("FileSize: {}" + (file.length() / 1024.0));&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;HttpResponse httpResponse = httpClient.execute(request);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;response = EntityUtils.toString(httpResponse.getEntity(), StandardCharsets.UTF_8);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;} else {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// File not found&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;} catch (Exception e) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;e.printStackTrace();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;} finally {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;try {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;if (outputStream != null)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;outputStream.close();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;if (httpsConn != null)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;httpsConn.disconnect();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;} catch (Exception e) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;e.printStackTrace();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;return response;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;}&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 16:38:08 GMT</pubDate>
      <guid>https://community.ptc.com/t5/Windchill/Error-java-io-StreamCorruptedException-invalid-stream-header/m-p/984001#M82994</guid>
      <dc:creator>smartel</dc:creator>
      <dc:date>2024-11-15T16:38:08Z</dc:date>
    </item>
    <item>
      <title>Re: Error java.io.StreamCorruptedException: invalid stream header: 2D2D2D2D when uploading a WTDocum</title>
      <link>https://community.ptc.com/t5/Windchill/Error-java-io-StreamCorruptedException-invalid-stream-header/m-p/984909#M83061</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.ptc.com/t5/user/viewprofilepage/user-id/167346"&gt;@smartel&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am just curious. Where was the issue with the&amp;nbsp;&lt;SPAN&gt;invalid stream header ?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you for your answer.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;PetrH&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2024 08:36:21 GMT</pubDate>
      <guid>https://community.ptc.com/t5/Windchill/Error-java-io-StreamCorruptedException-invalid-stream-header/m-p/984909#M83061</guid>
      <dc:creator>HelesicPetr</dc:creator>
      <dc:date>2024-11-21T08:36:21Z</dc:date>
    </item>
    <item>
      <title>Re: Error java.io.StreamCorruptedException: invalid stream header: 2D2D2D2D when uploading a WTDocum</title>
      <link>https://community.ptc.com/t5/Windchill/Error-java-io-StreamCorruptedException-invalid-stream-header/m-p/984965#M83066</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.ptc.com/t5/user/viewprofilepage/user-id/241117"&gt;@HelesicPetr&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Honestly, using the PUT method as described in CS305415 is a workaround.&lt;BR /&gt;With my previous code, I attempted to use the REST UploadStage 1, 2, and 3 actions.&lt;/P&gt;&lt;P&gt;I successfully completed stages 1 and 2, and the file was uploaded to Windchill's default upload vault.&lt;/P&gt;&lt;P&gt;However, I was never able to execute UploadStage3Action due to a persistent header error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So as 2nd trial. I decided to try to load it using&amp;nbsp;ApplicationData.newApplicationData and update the WTDoc primary. This was working since the file was uploaded.&lt;/P&gt;&lt;P&gt;But this was creating a new file in the vault.&lt;/P&gt;&lt;P&gt;And then when I ran removed unref the 1st uploaded file was not removed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I had to manually delete it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I end up with&amp;nbsp;CS305415. which was simpler.&lt;/P&gt;&lt;P&gt;If you have any ideas or an example, it could be great for knowledge.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks for asking,&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2024 12:42:04 GMT</pubDate>
      <guid>https://community.ptc.com/t5/Windchill/Error-java-io-StreamCorruptedException-invalid-stream-header/m-p/984965#M83066</guid>
      <dc:creator>smartel</dc:creator>
      <dc:date>2024-11-21T12:42:04Z</dc:date>
    </item>
  </channel>
</rss>

