我尝试使用Curl
命令从我的脚本调用Web服务。我从HERE.
我的剧本:
#! /bin/sh
ENDPOINT="http://mathertel.de/AJAXEngine/S01_AsyncSamples/CalcService.asmx"
VALUE=1234567890
if [ -n "${1}" ]; then
VALUE=${1}
fi
curl --silent \\
--data \\
@- \\
--header 'Content-Type: application/soap+xml; charset=utf-8' \\
--user-agent "" \\
${ENDPOINT} <<EOF | xmllint --format -
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<CalcPrimeFactors xmlns="http://www.mathertel.de/S01_AsyncSamples/">
<inputText>${VALUE}</inputText>
</CalcPrimeFactors>
</soap12:Body>
</soap12:Envelope>
EOF
我得到了这些错误:
./CalcService.sh: 10: ./CalcService.sh: --data: not found
./CalcService.sh: 11: ./CalcService.sh: @-: not found
./CalcService.sh: 12: ./CalcService.sh: --header: not found
./CalcService.sh: 13: ./CalcService.sh: --user-agent: not found
./CalcService.sh: 14: ./CalcService.sh: ./CalcService.sh: 14: ./CalcService.sh: http://mathertel.de/AJAXEngine/S01_AsyncSamples/CalcService.asmx: not found
xmllint: not found
现在我已经安装了curl,并尝试安装xmllint
,但它没有安装,说这是一个破损的包。
任何人都对这里发生的事情以及我可以做些什么来缓解这个问题有任何建议?这让我发疯了......