1

次の SOAP 封筒を bash スクリプト経由で投稿するにはどうすればよいですか。

PHP では cURL を使用して投稿しますが、bash に変換する方法がわかりませんか?

<?xml version="1.0" encoding="utf-8" ?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
  <env:Header>
    <n:Request xmlns:n="http://www.****.com/iprs/soap" env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver" env:mustUnderstand="true">UserMod</n:Request>
  </env:Header>
  <env:Body>
    <n:RequestUserMod xmlns:n="http://www.****.com/iprs/soap">
      <n:UserID>****</n:UserID>
      <n:UserData >
        <n:SystemName>****</n:SystemName>
        <n:AdminState>enabled</n:AdminState>
        <n:CategoryTypeID>****</n:CategoryTypeID>
        <n:Permissions>****</n:Permissions>
        <n:BillingProgID>****</n:BillingProgID>
        <n:DefaultGroupID>****</n:DefaultGroupID>
        <n:PrimarySiteID>****</n:PrimarySiteID>
        <n:SecondarySiteID>****</n:SecondarySiteID>
        <n:ContactInfo></n:ContactInfo>
        <n:Password>****</n:Password>
      </n:UserData>
    </n:RequestUserMod>
  </env:Body>
</env:Envelope>

可能であれば、次のような応答も検出したいと思います。

HTTP/1.1 200 OK
Content-Type:application/soap+xml; charset="utf-8"
Content-Length:509

<?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Header>
<n:Response xmlns:n="http://www.*****.com/iprs/soap" env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver" env:mustUnderstand="true">UserMod</n:Response>
</env:Header>
<env:Body>
<n:ResponseUserMod xmlns:n="http://www.*****.com/iprs/soap">
<n:StatusReport>
<n:Code>ok</n:Code>
<n:SubCode>0</n:SubCode>
</n:StatusReport>
</n:ResponseUserMod>
</env:Body>
</env:Envelope>
4

2 に答える 2

2

もしかして、こんな感じ?

curl --data - --request "POST" "http://www.somesite.com" <<EOF

<?xml version="1.0" encoding="utf-8" ?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
  <env:Header>
    <n:Request xmlns:n="http://www.****.com/iprs/soap" env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver" env:mustUnderstand="true">UserMod</n:Request>
  </env:Header>
  <env:Body>
    <n:RequestUserMod xmlns:n="http://www.****.com/iprs/soap">
      <n:UserID>****</n:UserID>
      <n:UserData >
        <n:SystemName>****</n:SystemName>
        <n:AdminState>enabled</n:AdminState>
        <n:CategoryTypeID>****</n:CategoryTypeID>
        <n:Permissions>****</n:Permissions>
        <n:BillingProgID>****</n:BillingProgID>
        <n:DefaultGroupID>****</n:DefaultGroupID>
        <n:PrimarySiteID>****</n:PrimarySiteID>
        <n:SecondarySiteID>****</n:SecondarySiteID>
        <n:ContactInfo></n:ContactInfo>
        <n:Password>****</n:Password>
      </n:UserData>
    </n:RequestUserMod>
  </env:Body>
</env:Envelope>

EOF
于 2013-01-07T16:15:08.667 に答える
0

投稿します:

cat file | curl ...

ただし、結果を取得してそれに従って動作するには、すべてをexpectスクリプトに埋め込みます。

于 2013-01-07T17:32:01.053 に答える