| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488 |
- <?xml version="1.0" encoding="UTF-8"?>
- <project xmlns:ogc="http://www.opengis.net/ogc"
- xmlns:get_wfs="http://biuro.biall-net.pl/WPS_Functions/get_wfs/get_wfs.xsd"
- basedir="../../." name="get_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
- />
- -->
- <include file="build.get_wfs.PRODUCT.xml" as="PRODUCT"/>
- <include file="build.get_wfs.SYSTEM.xml" as="SYSTEM"/>
- <include file="build.get_wfs.OBSOLETE-FIXME.xml" as="OBSOLETE-FIXME"/>
-
-
- <include file="../username_and_pass_from_passwordBase64Basic/build.build_username_and_pass_from_passwordBase64Basic.PRODUCT.xml"/>
- <!-- 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="${WPS_Functions.build}.properties"/>-->
- <!-- eof modules WPS_Functions -->
-
- <!-- module local properties -->
-
- <condition property="uuid" value="${uuid}">
- <isset property="uuid"/>
-
- </condition>
- <!--<property name="uuid" value="${uuid}"/>-->
-
- <tempfile property="wfs_error.xml.temp" destdir="${get_wfs.temp}" prefix="wfs_error" suffix=".xml" deleteonexit="yes"/>
- <tempfile property="wfs_result.xml.temp" destdir="${get_wfs.temp}" prefix="wfs_result" suffix=".xml" deleteonexit="yes"/>
- <tempfile property="wfs_error.xml.temp" destdir="${get_wfs.temp}" prefix="wfs_error" suffix=".xml" deleteonexit="yes"/>
- <tempfile property="wfs_timestamp.temp" destdir="${get_wfs.temp}" prefix="wfs_timestamp" suffix=".xml" deleteonexit="yes"/>
- <tempfile property="wfs_input.xml.temp" destdir="${get_wfs.temp}" prefix="wfs_input" suffix=".xml" deleteonexit="yes"/>
-
- <condition property="wfs_error.xml" value="${wfs_error.xml.temp}">
- <isset property="uuid"/>
- </condition>
-
- <condition property="wfs_result.xml" value="${wfs_result.xml.temp}">
- <isset property="uuid"/>
- </condition>
-
- <condition property="wfs_error.xml" value="${wfs_error.xml.temp}">
- <isset property="uuid"/>
- </condition>
-
- <condition property="wfs_timestamp.xml" value="${wfs_timestamp.temp}">
- <isset property="uuid"/>
- </condition>
-
- <condition property="wfs_input.xml" value="${wfs_input.xml.temp}">
- <isset property="uuid"/>
- </condition>
-
- <property name="wfs_output.xml" location="${get_wfs.temp}/${uuid}.wfs_output.xml"/>
- <property name="wfs_result.xml" location="${get_wfs.temp}/${uuid}.wfs_result.xml"/>
- <property name="wfs_error.xml" location="${get_wfs.temp}/${uuid}.wfs_error.xml"/>
- <property name="wfs_timestamp.xml" location="${get_wfs.temp}/${uuid}.wfs_timestamp.xml"/>
-
- <!-- for sending xml - param inputs -->
- <property name="wfs_input.xml" location="${get_wfs.temp}/${uuid}.wfs_input.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="write_child_props_to_config_dir" > <!-- R depends="read_build_properties" -->
- <echoproperties destfile="${build_get_wfs.childproperties}"/>
- </target>
- <!--<target name="read_build_properties" >
- <ant antfile="${WPS_Functions.build}" target="save_build_properties"/>
- <loadproperties srcfile="${WPS_Functions.properties}"/>
- <echo level="debug">$api_url to ${api_url} $namespace_prefix ${namespace_prefix}
- passwordBase64Basic=${passwordBase64Basic}
- </echo>
- </target>-->
-
- <target name="clean" description="Clean all output and temp files">
- <delete dir="${get_wfs.temp}" failonerror="false"/>
- </target>
- <target name="create_tempdir">
- <mkdir dir="${get_wfs.temp}"/>
- </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.temp}"/>
- <tempfile destdir="${get_wfs.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="Filter_check"> <!-- R read_build_properties, -->
- <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="GetFeature.local" description="To get local data from WFS easyli like POSTMAN" depends="php_session_id_check">
- <!--<input addproperty="typeName.local" message="Type object typeName.local"/>-->
- <input addproperty="Query.xml.local" />
- <!--<input addproperty="Filter.local" />-->
- <input addproperty="typeName.object.local"/>
- <input addproperty="wfs_output.xml.local" message="wfs_output.xml.local"/>
- <input addproperty="wfs_result.xml.local" message="wfs_result.xml.local"/>
- <input addproperty="wfs_error.xml.local" message="wfs_error.xml.local"/>
-
- <input addproperty="wfs_timestamp.xml.local"/>
-
- <local name="get_url.local"/>
- <property name="get_url.local" value="${api_url}/${namespace_prefix}?SERVICE=WFS&REQUEST=GetFeature&VERSION=1.0.0&TYPENAME=${typeName.object.local}&MaxFeatures=3"/>
- <echo message="FETCHING '${get_url.local}'"/> <!-- level="debug" -->
- <tstamp>
- <format property="wfs.timestamp" pattern="yyyy-MM-dd HH:mm:ss"/>
- </tstamp>
- <local name="wfs_error.local"/>
- <local name="wfs_result.local"/>
- <local name="wfs_output.local"/>
- <local name="wfs_timestamp.xml.local"/>
- <echo> command:
- ${curl} ${php_session_id_tested} -XPOST -H "Content-type: text/xml" -d @${Query.xml.local} '${get_url.local}'
- </echo>
- <!--<echo> command:
- ${curl} ${php_session_id_tested} '${get_url.local}'
- </echo>-->
- <exec executable="curl" outputproperty="wfs_output.local" errorproperty="wfs_error.local" resultproperty="wfs_result.local">
- <!--<arg line="-H 'Authorization: Basic ${passwordBase64Basic}' -\-data@${Filter.xml.local} '${get_url.local}'"/>--><!-- ${Filter} -->
- <!--<arg line="${php_session_id_tested} '${get_url.local}'"/>-->
- <arg line="${php_session_id_tested} -XPOST -H 'Content-type: text/xml' --data @${Query.xml.local} '${get_url.local}'"/>
- <!--<arg line="${php_session_id_tested} '${get_url.local}'"/>-->
- </exec>
- <!--<echo message="${wfs_output}" />-->
- <echo file="${wfs_output.xml.local}" message="${wfs_output.local}"/>
- <echo file="${wfs_result.xml.local}" message="${wfs_result.local}"/>
- <echo file="${wfs_error.xml.local}" message="${wfs_error.local}"/>
- <echoxml file="${wfs_timestamp.xml.local}"><wfs_timestamp>${wfs.timestamp}</wfs_timestamp></echoxml>
- </target>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/> <!-- metoda post wymaga ant contrib -->
-
- <target name="GetPropertyValue" description="To parse WFS output to Ant Property">
- <input addproperty="wfs_output.xml.local"/>
- <input addproperty="PropertyName.local"/>
- <input addproperty="setPropertyName.local"/>
- <input addproperty="GetPropertyValue.properties.local"/>
- <GetPropertyValue GetPropertyValue.properties.local="${GetPropertyValue.properties.local}" wfsoutputxml="${wfs_output.xml.local}" PropertyName="${PropertyName.local}" setPropertyName="${setPropertyName.local}" />
- </target>
-
- <macrodef name="GetPropertyValue">
- <attribute name="wfsoutputxml"/>
- <attribute name="PropertyName"/>
- <attribute name="setPropertyName"/>
- <attribute name="GetPropertyValue.properties.local"/>
- <element name="GetPropertyValue"/>
- <sequential>
- <xslt style="${get_wfs.propertyName.xsl}" in="@{wfsoutputxml}" destdir="./" out="@{GetPropertyValue.properties.local}" >
- <factory name="net.sf.saxon.TransformerFactoryImpl">
- <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
- <!--<attribute name="http://saxon.sf.net/feature/initialMode" value="{http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/typespecial_to_ref/typespecial_to_ref.xsd}typespecial_refererences"/>-->
- </factory>
- <param name="propertyName" expression="@{PropertyName}"/>
- <param name="set.propertyName" expression="@{setPropertyName}"/>
- <classpath location="/opt/local/share/java/saxon9he.jar"/>
- </xslt>
- <!--<exec executable="open">
- <arg value="${@{localremote}.sync.obj.@{obj}.lastid.properties}"/>
- </exec>-->
- <loadproperties srcfile="@{wfsoutputxml}" />
- <!--<echo> loaded {@{localremote}.sync.obj.@{obj}.lastid} = ${@{localremote}.sync.obj.@{obj}.lastid} </echo>-->
- <echo>#240 TODO load poperties @{GetPropertyValue.properties.local}</echo>
- </sequential>
- </macrodef>
-
-
- <target name="PostXmlTransaction" description="TODO to post transaction based on build__for_post_to_wfs and curl_post_wfst">
- <local name="wfs_input.xml.local"/>
- <local name="api_url.local"/>
- <input addproperty="wfs_input.xml.local" defaultvalue="${wfs_input.xml}"/>
- <input addproperty="api_url.local" defaultvalue="${api_url}"/>
- <exec executable="curl" outputproperty="wfs_output" errorproperty="wfs_error" resultproperty="wfs_result" failonerror="true">
- <arg value="-H 'Authorization: Basic ${passwordBase64Basic_tested}'"/>
- <arg value="-X"/>
- <arg value="POST"/>
- <arg value="-d"/>
- <arg value="${wfs_input.xml.local}"/>
- <arg value="'${api_url}'"/>
- <!--<arg value="-\-user {$Types__x3A__wfs:username}:{$Types__x3A__wfs:username-pass} "/>-->
- <arg value="-v"/>
- <arg value="--insecure"/>
- <!--<arg value="-O"/>
- <arg value="{@Target_file}"/>-->
- </exec>
- <echo file="${wfs_output.xml}" message="${wfs_output}"/>
- <echo file="${wfs_result.xml}" message="${wfs_result}"/>
- <echo file="${wfs_error.xml}" message="${wfs_error}"/>
- </target>
-
-
- <target name="PostHttpForm" description="TODO to post just by using default ant engine - to post properties" depends="php_session_id_check">
- <!--<local name="get_wfs.PostHttpForm.local"/>-->
- <!--<local name="api_url.local"/>-->
- <input addproperty="get_wfs.PostHttpForm.local" message="podaj get_wfs.PostHttpForm.local"/>
- <input addproperty="api_url.local" defaultvalue="${api_url}" message="podaj api_url.local"/>
- <input addproperty="wfs_output.xml.local"/>
-
- <echo > Posting TO $api_url.local = ${api_url.local} level="verbose"
- $passwordBase64Basic_tested = ${passwordBase64Basic_tested}
- $php_session_id_tested = ${php_session_id_tested}
- $get_wfs.PostHttpForm.local = ${get_wfs.PostHttpForm.local}
- $cookie_curl_option = ${cookie_curl_option}
- $wfs_output.xml.local = ${wfs_output.xml.local}
- ${curl} ${php_session_id_tested} -d "${get_wfs.PostHttpForm.local}" '${api_url.local}'
- </echo>
- <exec executable="${curl}" outputproperty="wfs_output" errorproperty="wfs_error" resultproperty="wfs_result" failonerror="true">
- <arg line="${php_session_id_tested} -d '${get_wfs.PostHttpForm.local}' '${api_url.local}'"/>
-
- <!--<arg value="-H 'Authorization: Basic ${passwordBase64Basic_tested}'"/>
- <arg value="-\-data"/> <!-\- -F -\->
- <arg value="'${get_wfs.PostHttpForm.local}'"/>
- <arg value="${api_url.local}"/>
- <!-\-<arg value="-\\-user {$Types__x3A__wfs:username}:{$Types__x3A__wfs:username-pass} "/>-\->
- <arg value="-v"/>
- <arg value="-\-insecure"/>-->
- <!--<arg value="-O"/>
- <arg value="{@Target_file}"/>-->
- </exec>
- <!--<echo>#result $wfs_error = ${wfs_error} $outputproperty = ${outputproperty} </echo>-->
-
- <echo file="${wfs_output.xml.local}" message="${wfs_output}"/>
- <echo file="${wfs_result.xml}" message="${wfs_result}"/>
- <echo file="${wfs_error.xml}" message="${wfs_error}"/>
- <echo>#304 exec done!</echo>
- </target>
-
-
- <target name="GetFeatureByLastMod" description="URL_TASK Target GetFeatureByLastMod - should do incremental retrievement" depends="Filter_check"/><!-- R read_build_properties, -->
-
-
-
-
- <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}" quiet="true"/>
- <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}" quiet="true"/>
- <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>
-
- <target name="GetFeature.WithVerifyUnauthorized" depends="GetFeature"> <!-- GetFeature.VerifyUnauthorized.failed -->
- <loadfile property="GetFeature.WithVerifyUnauthorized.srcfile" srcfile="${wfs_output.xml}" />
- <condition property="GetFeature.VerifyUnauthorized.condition" taskname="GetFeature.VerifyUnauthorized.failed">
- <contains string="${GetFeature.WithVerifyUnauthorized.srcfile}" substring="Unauthorized" />
- </condition>
- </target>
-
- <target name="GetFeature.VerifyUnauthorized.failed" if="${GetFeature.VerifyUnauthorized.condition}">
- <fail>
- #258 Cannot properly download ${get_url}
- Propably unset -DpasswordBase64Basic parameter!
- generate it with :
- echo "username:password" |base64
- </fail>
- </target>
-
-
-
- <!-- @2017-12-14 copied from recurse_ant to be there only! -->
- <target name="php_session_id_cond">
- <condition property="php_session_id_fail" taskname="php_session_id_check">
- <or>
- <equals arg1="${php_session_id}" arg2=""/>
- <equals arg1="${php_session_id}" arg2="$${php_session_id}"/>
- </or>
- </condition>
- </target>
- <target name="php_session_id_check" depends="php_session_id_cond,php_session_id_ok,php_session_id_fail" description="To create property php_session_id_tested for use in api calls"/>
- <target name="php_session_id_ok" unless="php_session_id_fail" description="use php_session_id from parameter ">
- <property name="php_session_id_tested" value="--cookie 'PHPSESSID=${php_session_id}'"/>
- </target>
- <target name="php_session_id_fail" if="php_session_id_fail" unless="php_session_id_tested" description="retrieve php_session_id from API to use it after for fasten api requests" depends="create_tempdir"><!-- R read_build_properties, -->
- <tempfile destdir="${get_wfs.temp}" prefix="usernameandpass" deleteonexit="yes" property="username_and_pass_from_passwordBase64Basic.properties" />
- <ant antfile="${username_and_pass_from_passwordBase64Basic.build}" target="username_and_pass_from_passwordBase64Basic.properties"/>
-
- <loadproperties srcfile="${username_and_pass_from_passwordBase64Basic.properties}"/>
-
- <echo> retrieved $username=${username}
- php_session_id_check.properties=${php_session_id_check.properties}
- $api_url = ${api_url}
- </echo>
- <!-- retrieve new properties -username , username.pass -->
- <property name="cookie_file" value="${get_wfs.temp}/${username}.cookie"/>
- <!--<property name="cookie_file" value="${get_wfs.temp}/${username}.cookie"/>-->
- <delete file="${cookie_file}" failonerror="no"/>
- <exec executable="curl"> <!-- errorproperty="wfs_error" resultproperty="wfs_result" -->
- <arg line=" -c ${cookie_file} -H 'Authorization: Basic ${passwordBase64Basic_tested}' "${api_url}""/> <!-- /default_db/?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetCapabilities" -->
- </exec>
- <echo> runned: curl -c ${cookie_file} -H 'Authorization: Basic ${passwordBase64Basic_tested}' "${api_url}"</echo>
- <property name="php_session_id_tested" value=" -b ${cookie_file}"/>
-
-
- <!-- detecting from cookie file just phpsesssid string
- # Netscape HTTP Cookie File
- # https://curl.haxx.se/docs/http-cookies.html
- # This file was generated by libcurl! Edit at your own risk.
-
- biuro.biall-net.pl FALSE / FALSE 0 PHPSESSID ndosk8faaskrfvdcbge8ki571l0oukdqtg7bmjht43b0cslohpbua2g5ouoi3b2vm6l14avvgna8bq6j6ufranhu77mtjplc1dthat2
- -->
- <loadfile property="php_session_id_tested.loadfile" srcfile="${cookie_file}" />
- <exec executable="bash" outputproperty="php_session_id_ok.string" >
- <arg value="-c" />
- <arg value="echo '${php_session_id_tested.loadfile}'|grep PHPSESSID |sed 's/.*PHPSESSID[ |\t]*//'"/>
- </exec>
-
- <property name="php_session_id_ok.string.test" value="test"/>
-
- <echo> #289 we set php_session_id_tested=(${php_session_id_tested})
- $php_session_id_ok.string = ${php_session_id_ok.string};
- $cookie_file = ${cookie_file}
- $username = ${username}
- </echo>
-
- </target>
-
- <target name="php_session_id_check.properties" depends="php_session_id_check">
- <echo>#329 saving properties to ${php_session_id_check.properties}</echo>
- <echoproperties destfile="${php_session_id_check.properties}" regex="(php_session_id_ok*)|(username*)"/>
- <echoproperties destfile="${get_wfs.php_session_id_check.properties}" regex="(php_session_id_ok*)|(username*)|(php_session_id_tested)"/>
- </target>
-
-
- </project>
|