【问题标题】:Powershell SOAP request with parameter带参数的 Powershell SOAP 请求
【发布时间】:2012-09-13 18:02:27
【问题描述】:

我需要一个powershell脚本来调用soap服务,我目前遇到的问题是soap服务方法有一个参数,我确定我可以让powershell脚本在方法没有参数但作为一旦它们是参数,我就会收到错误。

+ $res = $req.GetResponse <<<< ()
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

有效的肥皂请求(powershell,所以我在适当的地方使用了双引号):

<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">
        <soap:Body>
          <CheckStockLevels/>
       </soap:Body>
</soap:Envelope>"

Soap 请求不起作用(powershell,所以我在适当的地方使用了双引号):

<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">
        <soap:Body>
          <CheckStockLevels>
             <configurationName>123</configurationName>
          </CheckStockLevels>
       </soap:Body>
    </soap:Envelope>"

有谁知道我应该如何为不起作用的soap请求格式化XML?

【问题讨论】:

    标签: soap powershell msdn


    【解决方案1】:

    这行得通吗?

    $soap = [xml]@'
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
     <soap:Body>
      <CheckStockLevels>
        <configurationName>123</configurationName>
      </CheckStockLevels>
     </soap:Body>
    </soap:Envelope>" 
    '@
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-24
      相关资源
      最近更新 更多