| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218 |
- <?xml version="1.0" encoding="UTF-8"?>
- <project xmlns:ogc="http://www.opengis.net/ogc"
- basedir="../../." name="example wfs" default="http_first_input">
- <description>
- Based on ant-url-action module to ordinary retrieve feature from WMF
- To be called from CRM_PROCES_Tree etc
- </description>
- <!-- file:/SE/schema/ant-url_action/default_db.in7_dziennik_koresp/test-get-wfs-xml/build.xml -->
- <!-- sample URL which call this exact variables in this ANT build -->
- <!-- przykladowy URL ktory przekazuje parametry do tego ANT -->
- <!--https://biuro.biall-net.pl/SE/version-git/index.php?_route=UrlAction_Ant&_task=ant&
- path=${default_db.in7_dziennik_koresp/test-get-wfs-xml} - this is the place to keep ant build (directory name with build.xml)
- &namespace=p5_default_db:Rozdzielcza_test_bzyk_PE&featureID=123 - this is setting the <property name="url" value="${url}"/> - to point what is record/table to download
- <property name="uuid" value="${uuid}"/> it is automatically also set to enable uinque transaction and to allow to save data with user
- <property name="passwordBase64Basic" value="${passwordBase64Basic}"/> - this is also set - to enable communicate with API -
- <property name="DwebRootUrl" value="${$webRootUrl}"/> - this is the place where script is localized to easyli to target user GUI by href to generated output
- />
- -->
- <!-- modules WPS_Functions - to be copied to any module needed -->
- <property name="WPS_Functions" location="${basedir}/WPS_Functions"/>
- <property name="build_WPS_Functions.xml" location="${WPS_Functions}/build_WPS_Functions.xml"/> <!-- call it to get properties -->
- <property name="build_WPS_Functions.xml.properties" location="${build_WPS_Functions.xml}.properties"/>
- <!-- eof modules WPS_Functions -->
-
- <!-- module local properties -->
- <property name="get_wfs_basedir" location="${basedir}/WPS_Functions/get_wfs"/><!-- to ordinary retrieve wfs data -->
- <property name="get_wfs_basedir.temp" location="${get_wfs_basedir}/temp"/>
- <property name="get_wfs" location="${get_wfs_basedir}/build_get_wfs.xml"/><!-- to ordinary retrieve wfs data -->
- <property name="uuid" value="${uuid}"/>
-
- <property name="wfs_output.xml" location="${get_wfs_basedir.temp}/${uuid}.wfs_output.xml"/>
- <property name="wfs_result.xml" location="${get_wfs_basedir.temp}/${uuid}.wfs_result.xml"/>
- <property name="wfs_error.xml" location="${get_wfs_basedir.temp}/${uuid}.wfs_error.xml"/>
- <property name="wfs_timestamp.xml" location="${get_wfs_basedir.temp}/${uuid}.wfs_timestamp.xml"/>
-
- <!-- eof module local properties -->
-
- <property name="passwordBase64Basic" value="${passwordBase64Basic}"/>
- <!--<property name="url" value="${url}"/>-->
- <!--<property name="api_url" value="${api_url}"/>-->
- <property name="typeName" value="${typeName}" />
- <property name="xpath" value="${xpath}"/>
- <property name="xpath_value" value="${xpath_value}" />
- <property name="php_session_id" value="${php_session_id}"/>
- <property name="webRootUrl" value="${webRootUrl}"/>
- <target name="read_build_properties" >
- <ant antfile="${build_WPS_Functions.xml}" target="save_build_properties"/>
- <loadproperties srcfile="${build_WPS_Functions.xml.properties}"/>
- <echo level="debug">$api_url to ${api_url} $namespace_prefix ${namespace_prefix}
- passwordBase64Basic=${passwordBase64Basic}
- </echo>
- </target>
- <target name="http_first_input">
- <echo message="FETCHING '${url}' ..."/>
- <exec executable="curl" outputproperty="wfs_output" errorproperty="wfs_error" resultproperty="wfs_result">
- <arg line="--cookie 'PHPSESSID=${php_session_id}' '${url}&REQUEST=GetFeature'"/>
- </exec>
- <echo message="OUTPUT__TYPE__XML"/>
- <echo message="OUTPUT__START"/>
- <echo message="${wfs_output}"/>
- <echo message="webRootUrl"></echo>
- <echo message="${webRootUrl}"></echo>
- <echo message="OUTPUT__END"/>
- <echo message="RESULT__START"/>
- <echo message="${wfs_result}"/>
- <echo message="RESULT__END"/>
- <echo message="ERROR__START"/>
- <echo message="${wfs_error}"/>
- <echo message="ERROR__END"/>
- </target>
- <target name="DescribeFeatureType" description="URL_TASK Target DescribeFeatureType">
- <echo message="FETCHING '${url}' ..." level="debug"/>
- <exec executable="curl" outputproperty="wfs_output" errorproperty="wfs_error" resultproperty="wfs_result">
- <arg line="-H 'Authorization: Basic ${passwordBase64Basic}' "${url}&REQUEST=DescribeFeatureType""/>
- </exec>
- <echo message="OUTPUT__TYPE__XML"/>
- <echo message="OUTPUT__START"/>
- <echo message="${wfs_output}"/>
- <echo message="webRootUrl"></echo>
- <echo message="${webRootUrl}"></echo>
- <echo message="OUTPUT__END"/>
- <echo message="RESULT__START"/>
- <echo message="${wfs_result}"/>
- <echo message="RESULT__END"/>
- <echo message="ERROR__START"/>
- <echo message="${wfs_error}"/>
- <echo message="ERROR__END"/>
- </target>
- <target name="Filter_cond">
- <condition property="Filter_cond" taskname="Filter_check">
- <or>
- <equals arg1="${xpath}" arg2=""/>
- <equals arg1="${xpath}" arg2="$${uuid}"/>
- </or>
- </condition>
- </target>
-
- <target name="Filter_check" depends="Filter_cond,Filter_fail,Filter_ok"/>
-
- <target name="Filter_ok" unless="${Filter_cond}">
- <!--<mkdir dir="${get_wfs_basedir.temp}"/>
- <tempfile destdir="${get_wfs_basedir.temp}" suffix=".xml" prefix="Filter_ok" property="Filter.xml"/>
- <echoxml file="${Filter.xml}"></echoxml>
- <loadfile property="Filter.xml_file" srcfile="${Filter.xml}"/>-->
- <property name="Filter" value="&Filter=<ogc:Filter><ogc:PropertyIsEqualTo><ogc:PropertyName>${xpath}</ogc:PropertyName><ogc:Literal>${xpath_value}</ogc:Literal></ogc:PropertyIsEqualTo></ogc:Filter>"/>
- </target>
-
- <target name="Filter_fail" if="${Filter_cond}">
- <echo level="debug">#94 filter not set</echo>
- </target>
- <target name="GetFeature" description="URL_TASK Target GetFeature" depends="read_build_properties,Filter_check">
- <property name="get_url" value="${api_url}/${namespace_prefix}?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&typeName=${typeName}&${Filter}"/>
- <echo message="FETCHING '${get_url}'" /> <!-- level="debug" -->
- <tstamp>
- <format property="wfs.timestamp" pattern="yyyy-MM-dd HH:mm:ss"/>
- </tstamp>
- <exec executable="curl" outputproperty="wfs_output" errorproperty="wfs_error" resultproperty="wfs_result">
- <arg line="-H 'Authorization: Basic ${passwordBase64Basic}' '${get_url}'"/><!-- ${Filter} -->
- </exec>
- <!--<echo message="${wfs_output}" />-->
- <echo file="${wfs_output.xml}" message="${wfs_output}"/>
- <echo file="${wfs_result.xml}" message="${wfs_result}"/>
- <echo file="${wfs_error.xml}" message="${wfs_error}"/>
- <echoxml file="${wfs_timestamp.xml}"><wfs_timestamp>${wfs.timestamp}</wfs_timestamp></echoxml>
- </target>
-
- <target name="GetFeatureByLastMod" description="URL_TASK Target GetFeatureByLastMod - should do incremental retrievement" depends="read_build_properties,Filter_check"/>
-
-
-
-
- <target name="GetXmlByUrlVerifyRetry" description="To use from recruse ant and be verified">
- <!--<echo>GetXmlByUrlVerifyRetry #154 we used </echo>-->
- <exec executable="curl" output="${output}" errorproperty="wfs_error">
- <arg line="${cookie_curl_option} "${url}""/>
- <arg line="--connect-timeout 5"/>
- <arg line="--max-time 240"/>
- <arg line="--retry 5"/>
- <arg line="--retry-max-time 1200"/>
- </exec>
- <!--<echo message="ERROR__START"/>-->
- <!--<echo>${wfs_error}</echo>-->
- <!--<echo message="ERROR__END"/>-->
- <antcall target="GetXmlByUrlVerifyRetry.validate_length"/>
- <!--<antcall target="GetXmlByUrlVerifyRetry_verify"/>
- <echo> Validate $GetXmlByUrlVerifyRetry_verify: ${GetXmlByUrlVerifyRetry_verify}</echo>
- <echo> Validate $warn: ${warn}</echo>-->
- </target>
-
- <target name="GetXmlByUrlVerifyRetry.validate_length.condition" description="To verify if downloaded file is correct" >
- <length file="${output}" property="output.length"/>
- <!--<echo> $output.length = ${output.length}</echo>-->
- <condition property="output.length.failed" taskname="GetXmlByUrlVerifyRetry.validate_length">
- <equals arg1="${output.length}" arg2="128"/>
- </condition>
- <condition property="output.length.failed.0" taskname="GetXmlByUrlVerifyRetry.validate_length.0">
- <equals arg1="${output.length}" arg2="0"/>
- </condition>
- </target>
-
- <target name="GetXmlByUrlVerifyRetry.validate_length" depends="GetXmlByUrlVerifyRetry.validate_length.condition">
- <antcall target="GetXmlByUrlVerifyRetry.validate_length.failed"/>
- <antcall target="GetXmlByUrlVerifyRetry.validate_length.failed.0"/>
- </target>
-
- <target name="GetXmlByUrlVerifyRetry.validate_length.failed" if="${output.length.failed}">
- <echo>GetXmlByUrlVerifyRetry.validate_length.failed #182 - first retry ! </echo>
- <delete file="${output}"/>
- <exec executable="curl" output="${output}" errorproperty="wfs_error">
- <arg line="${cookie_curl_option} "${url}""/>
- <arg line="--connect-timeout 5"/>
- <arg line="--max-time 240"/>
- <arg line="--retry 5"/>
- <arg line="--retry-max-time 1200"/>
- </exec>
- <length file="${output}" property="output.length.try1"/>
- <echo> $output.length.try1 = ${output.length.try1}</echo>
- </target>
- <target name="GetXmlByUrlVerifyRetry.validate_length.failed.0" if="${output.length.failed.0}">
- <echo>GetXmlByUrlVerifyRetry.validate_length.failed #198 - first retry - zero length ! </echo>
- <delete file="${output}"/>
- <exec executable="curl" output="${output}" errorproperty="wfs_error">
- <arg line="${cookie_curl_option} "${url}""/>
- <arg line="--connect-timeout 5"/>
- <arg line="--max-time 240"/>
- <arg line="--retry 5"/>
- <arg line="--retry-max-time 1200"/>
- </exec>
- <length file="${output}" property="output.length.try.0"/>
- <echo> $output.length.try.0 = ${output.length.try.0}</echo>
- </target>
-
- <target name="GetXmlByUrlVerifyRetry_verify" description="To verify if downloaded file is correct" >
- <xmlvalidate file="${output}" lenient="yes" failonerror="false" warn="warn" />
- <echo>#169 after validated ? not set any?</echo>
- </target>
-
-
- </project>
|