Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

XMLValidate DTD behind httpProxy

Guest
Sep 29, 2013 Sep 29, 2013

I have seen a problem with CF10 and XMLValidate when running CF behind a http proxy. My code is evaulating an XML document against its DTD

In CF8 and CF9 you added this to the args in JVM config e.g

-Dhttp.ProxyHost=192.168.1.1 -Dhtp.proxyPort=8080

then all the http trafic went via the proxy.

However in CF10, this doesn't appear to work. Has anyone seen this ?

I did some tests and CFHTTP will work if you explicity pass the proxy, but it dosen't work and XMLValidate doesn't work even if the proxy is set in the JVM.config

see sample code below im using to test.

My Cf10 box is running Solaris 10 on ultrasparc

<h1>Proxy Host - verify jvm.config works</h1>

<cfset sys = createObject("java","java.lang.System") >

<cfoutput>#sys.getProperty("http.proxyHost")#</cfoutput>

<h1>with proxy -works</h1>

<cfhttp timeout="5" url="http://www.adobe.com" result="stResult" method="get" proxyServer="192.168.1.1" proxyPort="80080">

<cfdump var="#stResult#">

<h1>System Proxy - fails</h1>

<cfhttp timeout="5" url="http://www.mysite.com/myschema.dtd" result="stResult" method="get">

<cfdump var="#stResult#">

<h1>XML Validate - times out</h1>

<cfset myXML = XMLParse("mydoc.xml")>

<cftry>

<cfset isValid = XMLValidate(myXML) >

<cfoutput>Is Valid: <cfdump var="#isValid#"></cfoutput>

<cfcatch type="any"><cfdump var="#cfcatch#"></cfcatch>

</cftry>

909
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 07, 2013 Oct 07, 2013
LATEST

This is how you work around it if anyone is interested. Our team figued it out themselves.

<cfset var parsedXML= XMLParse(arguments.strInput)>

<cfset var sys = createObject("java","java.lang.System") >

<cfhttp timeout="5" url="#parsedXML.getDoctype().getSystemId()#" result="stResult" method="get" proxyServer="#sys.getProperty("http.proxyHost")#" proxyPort="#sys.getProperty("http.proxyPort")#">

<cfset stcValidation = XMLValidate(arguments.strInput,stResult.fileContent) >

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources