ce4aa408daa91f154ef091b635bc17d503a9311f
[anna.git] / example / diameter / launcher / deployments / advanced / answerXml.sh
1 #!/bin/bash
2 > curl_log.txt
3 TRACE="--trace-ascii curl_log.txt"
4 SERVER=`cat .httpServer`
5
6 echo
7 echo
8 echo "Use: $0 [xml_file] [2e]"
9 echo
10 echo "Programm 'xml_file' answer to the diameter client or to the server (entity) when"
11 echo "'2e' parameter is provided. If missing xml file, current programmed answers will"
12 echo "be shown: '$0' (answers to client), '$0 2e' (answers to server)."
13 echo
14 if test "$1" != ""
15 then
16    if test "$1" = "2e"
17    then
18      operation="answerxml2e"
19    else 
20      [[ ! -f "$1" ]] && { echo "ERROR: file '$1' not found" ; echo; echo; exit ; }
21      operation="answerxml|$1"
22      [[ "$2" = "2e" ]] && operation="answerxml2e|$1"
23    fi
24 else
25    operation="answerxml"
26 fi
27 echo
28 curl -m 1 --data "$operation" $TRACE ${SERVER}
29