cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

PTC Integrity Java API: How to enable HTTP compression?

AndreyVi
4-Participant

PTC Integrity Java API: How to enable HTTP compression?

PROBLEM:

 

The PTC Integrity server responds with uncompressed XML to the calls issued though the Java API client library (mksapi-jar-4.16.1413.jar). The returned XML is even pretty-printed and thus additionally increased in size. For certain calls, for example retrieval of the history for an item using "im issue --showHistory" command, this leads to significant performance and traffic penalties. For items with large history, these penalties become unacceptable.

 

CLUES:

 

The HTTP logging on the client side can be enabled by setting these system properties:

 

System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http.wire", "debug");
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http", "debug");

 

It is clear, that the client does advertise compression options using the "Accept-Encoding" header:

 

POST /icapi;jsessionid=...?mksCommandRunner=1616424354326-1374970 HTTP/1.1
Protocol-version: 1.4
CodePage: UTF-8
TimeZone: Europe/Berlin
Authorization: Basic ...==
APIVersion: 4.16 000-00 0
enableAdvancedFeatures: false
Transfer-Encoding: chunked
Host: HOST:7001
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.4.1 (Java/11.0.3)
Accept-Encoding: gzip,deflate

 

The server seems to ignore the "Accept-Encoding" header completely. Even a test with a request that explicitly prohibits the uncompressed output using "Accept-Encoding: gzip, identity;q=0" made no difference. The server response contains no "Content-Encoding" header. The "Transfer-Encoding" header is repeated twice and set to "chunked":

 

HTTP/1.1 200 OK
Transfer-Encoding: chunked
Transfer-Encoding: chunked
Date: Mon, 22 Mar 2021 14:45:53 GMT
Server: PTC Integrity Server

 

According to the documentation here http://support.ptc.com/help/integrity_hc/integrity111_hc/en/index.html#page/IntegrityHelp/client_inst_install_client.mif-9.html, for a desktop client installation the compression can be enabled by setting this configuration property:

 

IntegrityClient.default.compressionEnabled

 

So, it seems to be generally possible to instruct the server to use compression.

 

QUESTION:

 

How can HTTP compression be enabled for requested issued through the Java API client library?

 

Any feedback would be greatly appreciated. Thank you!

 

1 REPLY 1
AndreyVi
4-Participant
(To:AndreyVi)

See also:

 

Java API: Traffic, Performance and Memory issues while getting item history https://community.ptc.com/t5/Windchill-Systems-Software/Java-API-Traffic-Performance-and-Memory-issues-while-getting/m-p/717588 

Top Tags