Last active
September 21, 2017 11:47
-
-
Save ibaaj/4dfa41a8c173d13a98f2ea6dce1b3687 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
read -d '' query << EOF | |
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" | |
xmlns="http://wsiv.ratp.fr" xmlns:xsd="http://wsiv.ratp.fr/xsd"> | |
<soap:Header/> | |
<soap:Body> | |
<getMissionsNext> | |
<station> | |
<xsd:id>181</xsd:id> | |
<xsd:line> | |
<xsd:id>M7</xsd:id> | |
</xsd:line> | |
</station> | |
<direction> | |
<xsd:sens>A</xsd:sens> | |
</direction> | |
</getMissionsNext> | |
</soap:Body> | |
</soap:Envelope> | |
EOF | |
xmlArgsParsingParts=( | |
'//*[local-name()="Envelope"]/*[local-name()="Body"]' | |
'/*[local-name()="getMissionsNextResponse"]' | |
'/*[local-name()="return"]' | |
'/*[local-name()="missions"]/*[local-name()="stationsMessages"]' | |
) | |
xmlArgsParsing=$(IFS=; echo "${xmlArgsParsingParts[*]}") | |
A=$(curl --silent -X POST \ | |
-H 'Content-Type: application/soap+xml;charset=UTF-8' \ | |
-d $query \ | |
'http://opendata-tr.ratp.fr/wsiv/services/Wsiv?wsdl=' | \ | |
xmllint --xpath $xmlArgsParsing - | \ | |
sed -e "s/<\//,<\\//g" | \ | |
sed 's/<[^>]*>//g' | \ | |
sed 's/.$//'); | |
echo $A; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment