Re: [External] : Re: Question about XML-FO Convertor related to Proxy settings for External Images

Ashish Singhal <[email protected]> Wed, 6 Sep 2023 23:03:44 +0000
Newsgroups gmane.text.xml.xfc.general
Message-ID <BYAPR10MB2950FCB07807DF30C638E151F3EFA@BYAPR10MB2950.namprd10.prod.outlook.com>
--===============8779627285311450464==
Content-Language: en-US
Content-Type: multipart/alternative;
	boundary="_000_BYAPR10MB2950FCB07807DF30C638E151F3EFABYAPR10MB2950namp_"

--_000_BYAPR10MB2950FCB07807DF30C638E151F3EFABYAPR10MB2950namp_
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

Hi Hussein,

Thanks a lot for your guidance. Based on this info, we were able to pinpoin=
t the issue on our side. We were setting the proxy values incorrectly.

Much appreciated.

From: Hussein Shafie <[email protected]>
Date: Wednesday, September 6, 2023 at 5:49 AM
To: Ashish Singhal <[email protected]>
Cc: Jeff Haynes <[email protected]>, Surendra Kumar <surendra.kumar@or=
acle.com>, [email protected] <[email protected]>
Subject: [External] : Re: [XFC] Question about XML-FO Convertor related to =
Proxy settings for External Images
On 9/5/23 19:12, Ashish Singhal wrote:
>
> I am in the Oracle CPQ Cloud team. We license XmlMind=92s XML-FO Converto=
r
> to output Docx documents.

Yes. Purchased in 2015. Hence a very old version not supported by us
anymore.



> We have a requirement to support proxies for
> External images referenced in fo tags. The issue we are facing is that
> it doesn=92t resolve the external image when there a proxy server on the
> envns where the FO conversion is happening.
>
> Sample:
>
> <fo:external-graphic src=3D"url(https://urldefense.com/v3/__http://nginx.=
org/nginx.png__;!!ACWV5N9M2RV99hQ!KNwjUH9-Ki8Wzusd-eAjF9Y9SPvGGddDR3YoWA7e4=
ocjsbirlc5-WCtPx7nQ_nPRVoViRLUywDqNnfwtigka$ )" width=3D"auto"
> height=3D"auto" content-width=3D"auto" content-height=3D"auto"/>
>
> Here is what we have tried
>
>   * Download the latest XML-FO Convertor
>   * Install the samples and binaries onto an envn that requires the use
>     of proxy
>   * Before setting proxy envn vars
>       o Curl hangs/blocks
>       o Converting sample=92s userguide.fo with above fo tag also hangs/b=
locks
>   * After setting proxy envn vars
>       o Curl succeeds
>       o Converting sample=92s userguide.fo with above fo tag doesn=92t
>         blocks but outputs the message
>   * warning: failed to load image "https://urldefense.com/v3/__http://ngi=
nx.org/nginx.png__;!!ACWV5N9M2RV99hQ!KNwjUH9-Ki8Wzusd-eAjF9Y9SPvGGddDR3YoWA=
7e4ocjsbirlc5-WCtPx7nQ_nPRVoViRLUywDqNnfwtigka$ ":
>     http://www-proxy.us.oracle.com
>     (file:/Users/ASSINGHA/Downloads/xfc_eval_java-6_4_1/samples/userguide=
2.fo, line #428, column #1993)
>       o It output an empty image file
>
> What is the solution? Is there a workaround?
>
> Setting of proxy vars
>
>   * We are tried various options but nothing works for XML-FO Convertor
>   * Setting of envn vars
>   * Setting java vars while running the convertor script
>   * exec java -Dhttp.proxyHost=3Dhttp://www-proxy.us.oracle.com
>     -Dhttp.proxyPort=3D80 -Djava.awt.headless=3Dtrue
>     com.xmlmind.fo.converter.Driver
>


Sorry but we cannot help you. This is a Java question, not a question
related to our product.

XMLmind XML-FO Converter downloads the image files using stock Java
classes, that is, it simply does:
---
(new URL(location)).openStream();
---
You have the full source code of our product. You can check this by
yourself (src/com/xmlmind/fo/util/URLUtil.java,
src/com/xmlmind/fo/graphic/GraphicFactoryImpl.java).

In other words, any Java program which would attempt to download
https://urldefense.com/v3/__http://nginx.org/nginx.png__;!!ACWV5N9M2RV99hQ!=
KNwjUH9-Ki8Wzusd-eAjF9Y9SPvGGddDR3YoWA7e4ocjsbirlc5-WCtPx7nQ_nPRVoViRLUywDq=
Nnfwtigka$<https://urldefense.com/v3/__http:/nginx.org/nginx.png__;!!ACWV5N=
9M2RV99hQ!KNwjUH9-Ki8Wzusd-eAjF9Y9SPvGGddDR3YoWA7e4ocjsbirlc5-WCtPx7nQ_nPRV=
oViRLUywDqNnfwtigka$>  in the same working environment would report
exactly the same error as XMLmind XML-FO Converter.

exec java -Dhttp.proxyHost=3Dhttp://www-proxy.us.oracle.com
-Dhttp.proxyPort=3D80 ... may be the good approach to solve your problem.

However, make sure to get ALL the system properties (-Dvar=3Dvalue) RIGHT
given the version of Java you use. See for example, for Java 8,:
https://docs.oracle.com/javase/8/docs/api/java/net/doc-files/net-properties=
.html#Proxies

Not tested at all, but just to give you a general idea, may be (a)
removing all -Dx=3Dy, (b) setting the environment variables and (c)
-Djava.net.useSystemProxies=3Dtrue would work for you. Depends on the
operating system and the version of Java you use.




---
PS: Well known Java caveat: Java does not follow HTTP to HTTPS
redirection. Therefore if https://urldefense.com/v3/__http://nginx.org/ngin=
x.png__;!!ACWV5N9M2RV99hQ!KNwjUH9-Ki8Wzusd-eAjF9Y9SPvGGddDR3YoWA7e4ocjsbirl=
c5-WCtPx7nQ_nPRVoViRLUywDqNnfwtigka$<https://urldefense.com/v3/__http:/ngin=
x.org/nginx.png__;!!ACWV5N9M2RV99hQ!KNwjUH9-Ki8Wzusd-eAjF9Y9SPvGGddDR3YoWA7=
e4ocjsbirlc5-WCtPx7nQ_nPRVoViRLUywDqNnfwtigka$>  redirects to
https://urldefense.com/v3/__https://nginx.org/nginx.png__;!!ACWV5N9M2RV99hQ=
!KNwjUH9-Ki8Wzusd-eAjF9Y9SPvGGddDR3YoWA7e4ocjsbirlc5-WCtPx7nQ_nPRVoViRLUywD=
qNnaAgVp4d$<https://urldefense.com/v3/__https:/nginx.org/nginx.png__;!!ACWV=
5N9M2RV99hQ!KNwjUH9-Ki8Wzusd-eAjF9Y9SPvGGddDR3YoWA7e4ocjsbirlc5-WCtPx7nQ_nP=
RVoViRLUywDqNnaAgVp4d$>  or http://www-proxy.us.oracle.com redirects
to https://www-proxy.us.oracle.com, it's unlikely to work.


--_000_BYAPR10MB2950FCB07807DF30C638E151F3EFABYAPR10MB2950namp_
Content-Type: text/html; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" xmlns:w=3D"urn:sc=
hemas-microsoft-com:office:word" xmlns:m=3D"http://schemas.microsoft.com/of=
fice/2004/12/omml" xmlns=3D"http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DWindows-1=
252">
<meta name=3D"Generator" content=3D"Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	font-size:10.0pt;
	font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:10.0pt;
	mso-ligatures:none;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
--></style>
</head>
<body lang=3D"EN-US" link=3D"blue" vlink=3D"purple" style=3D"word-wrap:brea=
k-word">
<div class=3D"WordSection1">
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt">Hi Hussein,<o:p></o=
:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"><o:p>&nbsp;</o:p></=
span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt">Thanks a lot for yo=
ur guidance. Based on this info, we were able to pinpoint the issue on our =
side. We were setting the proxy values incorrectly.<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"><o:p>&nbsp;</o:p></=
span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt">Much appreciated.<o=
:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"><o:p>&nbsp;</o:p></=
span></p>
<div id=3D"mail-editor-reference-message-container">
<div>
<div style=3D"border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in =
0in 0in">
<p class=3D"MsoNormal" style=3D"margin-bottom:12.0pt"><b><span style=3D"fon=
t-size:12.0pt;color:black">From:
</span></b><span style=3D"font-size:12.0pt;color:black">Hussein Shafie &lt;=
[email protected]&gt;<br>
<b>Date: </b>Wednesday, September 6, 2023 at 5:49 AM<br>
<b>To: </b>Ashish Singhal &lt;[email protected]&gt;<br>
<b>Cc: </b>Jeff Haynes &lt;[email protected]&gt;, Surendra Kumar &lt;s=
[email protected]&gt;, [email protected] &lt;xfc-support@xmlmi=
nd.com&gt;<br>
<b>Subject: </b>[External] : Re: [XFC] Question about XML-FO Convertor rela=
ted to Proxy settings for External Images<o:p></o:p></span></p>
</div>
<div>
<p class=3D"MsoNormal" style=3D"margin-bottom:12.0pt"><span style=3D"font-s=
ize:11.0pt">On 9/5/23 19:12, Ashish Singhal wrote:<br>
&gt; <br>
&gt; I am in the Oracle CPQ Cloud team. We license XmlMind=92s XML-FO Conve=
rtor <br>
&gt; to output Docx documents. <br>
<br>
Yes. Purchased in 2015. Hence a very old version not supported by us <br>
anymore.<br>
<br>
<br>
<br>
&gt; We have a requirement to support proxies for <br>
&gt; External images referenced in fo tags. The issue we are facing is that=
 <br>
&gt; it doesn=92t resolve the external image when there a proxy server on t=
he <br>
&gt; envns where the FO conversion is happening.<br>
&gt; <br>
&gt; Sample:<br>
&gt; <br>
&gt; &lt;fo:external-graphic src=3D&quot;url(https://urldefense.com/v3/__ht=
tp://nginx.org/nginx.png__;!!ACWV5N9M2RV99hQ!KNwjUH9-Ki8Wzusd-eAjF9Y9SPvGGd=
dDR3YoWA7e4ocjsbirlc5-WCtPx7nQ_nPRVoViRLUywDqNnfwtigka$ )&quot; width=3D&qu=
ot;auto&quot;
<br>
&gt; height=3D&quot;auto&quot; content-width=3D&quot;auto&quot; content-hei=
ght=3D&quot;auto&quot;/&gt;<br>
&gt; <br>
&gt; Here is what we have tried<br>
&gt; <br>
&gt;&nbsp;&nbsp; * Download the latest XML-FO Convertor<br>
&gt;&nbsp;&nbsp; * Install the samples and binaries onto an envn that requi=
res the use<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; of proxy<br>
&gt;&nbsp;&nbsp; * Before setting proxy envn vars<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o Curl hangs/blocks<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o Converting sample=92s userguide.=
fo with above fo tag also hangs/blocks<br>
&gt;&nbsp;&nbsp; * After setting proxy envn vars<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o Curl succeeds<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o Converting sample=92s userguide.=
fo with above fo tag doesn=92t<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; blocks but outputs the=
 message <br>
&gt;&nbsp;&nbsp; * warning: failed to load image &quot;https://urldefense.c=
om/v3/__http://nginx.org/nginx.png__;!!ACWV5N9M2RV99hQ!KNwjUH9-Ki8Wzusd-eAj=
F9Y9SPvGGddDR3YoWA7e4ocjsbirlc5-WCtPx7nQ_nPRVoViRLUywDqNnfwtigka$ &quot;:<b=
r>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; </span><a href=3D"http://www-proxy.us.oracle.c=
om"><span style=3D"font-size:11.0pt">http://www-proxy.us.oracle.com</span><=
/a><span style=3D"font-size:11.0pt"><br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; (file:/Users/ASSINGHA/Downloads/xfc_eval_java-=
6_4_1/samples/userguide2.fo, line #428, column #1993)<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o It output an empty image file<br=
>
&gt; <br>
&gt; What is the solution? Is there a workaround?<br>
&gt; <br>
&gt; Setting of proxy vars<br>
&gt; <br>
&gt;&nbsp;&nbsp; * We are tried various options but nothing works for XML-F=
O Convertor<br>
&gt;&nbsp;&nbsp; * Setting of envn vars<br>
&gt;&nbsp;&nbsp; * Setting java vars while running the convertor script<br>
&gt;&nbsp;&nbsp; * exec java -Dhttp.proxyHost=3Dhttp://www-proxy.us.oracle.=
com<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; -Dhttp.proxyPort=3D80 -Djava.awt.headless=3Dtr=
ue<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; com.xmlmind.fo.converter.Driver<br>
&gt; <br>
<br>
<br>
Sorry but we cannot help you. This is a Java question, not a question <br>
related to our product.<br>
<br>
XMLmind XML-FO Converter downloads the image files using stock Java <br>
classes, that is, it simply does:<br>
---<br>
(new URL(location)).openStream();<br>
---<br>
You have the full source code of our product. You can check this by <br>
yourself (src/com/xmlmind/fo/util/URLUtil.java, <br>
src/com/xmlmind/fo/graphic/GraphicFactoryImpl.java).<br>
<br>
In other words, any Java program which would attempt to download <br>
</span><a href=3D"https://urldefense.com/v3/__http:/nginx.org/nginx.png__;!=
!ACWV5N9M2RV99hQ!KNwjUH9-Ki8Wzusd-eAjF9Y9SPvGGddDR3YoWA7e4ocjsbirlc5-WCtPx7=
nQ_nPRVoViRLUywDqNnfwtigka$"><span style=3D"font-size:11.0pt">https://urlde=
fense.com/v3/__http://nginx.org/nginx.png__;!!ACWV5N9M2RV99hQ!KNwjUH9-Ki8Wz=
usd-eAjF9Y9SPvGGddDR3YoWA7e4ocjsbirlc5-WCtPx7nQ_nPRVoViRLUywDqNnfwtigka$</s=
pan></a><span style=3D"font-size:11.0pt">&nbsp;
 in the same working environment would report <br>
exactly the same error as XMLmind XML-FO Converter.<br>
<br>
exec java -Dhttp.proxyHost=3Dhttp://www-proxy.us.oracle.com<br>
-Dhttp.proxyPort=3D80 ... may be the good approach to solve your problem.<b=
r>
<br>
However, make sure to get ALL the system properties (-Dvar=3Dvalue) RIGHT <=
br>
given the version of Java you use. See for example, for Java 8,: <br>
</span><a href=3D"https://docs.oracle.com/javase/8/docs/api/java/net/doc-fi=
les/net-properties.html#Proxies"><span style=3D"font-size:11.0pt">https://d=
ocs.oracle.com/javase/8/docs/api/java/net/doc-files/net-properties.html#Pro=
xies</span></a><span style=3D"font-size:11.0pt"><br>
<br>
Not tested at all, but just to give you a general idea, may be (a) <br>
removing all -Dx=3Dy, (b) setting the environment variables and (c) <br>
-Djava.net.useSystemProxies=3Dtrue would work for you. Depends on the <br>
operating system and the version of Java you use.<br>
<br>
<br>
<br>
<br>
---<br>
PS: Well known Java caveat: Java does not follow HTTP to HTTPS <br>
redirection. Therefore if </span><a href=3D"https://urldefense.com/v3/__htt=
p:/nginx.org/nginx.png__;!!ACWV5N9M2RV99hQ!KNwjUH9-Ki8Wzusd-eAjF9Y9SPvGGddD=
R3YoWA7e4ocjsbirlc5-WCtPx7nQ_nPRVoViRLUywDqNnfwtigka$"><span style=3D"font-=
size:11.0pt">https://urldefense.com/v3/__http://nginx.org/nginx.png__;!!ACW=
V5N9M2RV99hQ!KNwjUH9-Ki8Wzusd-eAjF9Y9SPvGGddDR3YoWA7e4ocjsbirlc5-WCtPx7nQ_n=
PRVoViRLUywDqNnfwtigka$</span></a><span style=3D"font-size:11.0pt">&nbsp;
 redirects to <br>
</span><a href=3D"https://urldefense.com/v3/__https:/nginx.org/nginx.png__;=
!!ACWV5N9M2RV99hQ!KNwjUH9-Ki8Wzusd-eAjF9Y9SPvGGddDR3YoWA7e4ocjsbirlc5-WCtPx=
7nQ_nPRVoViRLUywDqNnaAgVp4d$"><span style=3D"font-size:11.0pt">https://urld=
efense.com/v3/__https://nginx.org/nginx.png__;!!ACWV5N9M2RV99hQ!KNwjUH9-Ki8=
Wzusd-eAjF9Y9SPvGGddDR3YoWA7e4ocjsbirlc5-WCtPx7nQ_nPRVoViRLUywDqNnaAgVp4d$<=
/span></a><span style=3D"font-size:11.0pt">&nbsp;
 or </span><a href=3D"http://www-proxy.us.oracle.com"><span style=3D"font-s=
ize:11.0pt">http://www-proxy.us.oracle.com</span></a><span style=3D"font-si=
ze:11.0pt"> redirects
<br>
to </span><a href=3D"https://www-proxy.us.oracle.com"><span style=3D"font-s=
ize:11.0pt">https://www-proxy.us.oracle.com</span></a><span style=3D"font-s=
ize:11.0pt">, it's unlikely to work.<br>
<br>
<o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</body>
</html>

--_000_BYAPR10MB2950FCB07807DF30C638E151F3EFABYAPR10MB2950namp_--

--===============8779627285311450464==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--
XMLmind FO Converter Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xfc-support

--===============8779627285311450464==--