【问题标题】:php SOAP request gives internal server error with specific methodphp SOAP 请求使用特定方法给出内部服务器错误
【发布时间】:2018-01-05 05:29:17
【问题描述】:

我正在尝试为以下 wsdl method="GetData" 构建一个肥皂请求

请注意,并非所有值都是必需的,我已经为此苦苦挣扎了一个星期,非常感谢任何帮助

Host: xxxxxxxxxxxxxxxx
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "xxxxxxxxxxx"

<?xml version="1.0" encoding="utf-8"?>
<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>
    <GetData xmlns="xxxxxx">
      <key>string</key>
      <transferDef>
        <Where />
        <OrderBy>
          <OrderByItems>
            <BinaryArithmetic xsi:nil="true" />
            <Categorization xsi:nil="true" />
            <Function xsi:nil="true" />
            <QueryField xsi:nil="true" />
            <QueryForm xsi:nil="true" />
          </OrderByItems>
        </OrderBy>
        <ProjectId>string</ProjectId>
        <DbType>Production or Test</DbType>
      </transferDef>
      <token>
        <Id>guid</Id>
        <LastResponseIdReturned>long</LastResponseIdReturned>
        <FirstResponseIdReturned>long</FirstResponseIdReturned>
        <NumberOfResponsesReturned>long</NumberOfResponsesReturned>
        <DatasetsReturned>long</DatasetsReturned>
        <LastDataSet>boolean</LastDataSet>
        <ProjectId>string</ProjectId>
        <ChangeTrackingVersion>long</ChangeTrackingVersion>
      </token>
    </GetData>
  </soap:Body>
</soap:Envelope>

【问题讨论】:

  • SoapUI 等工具可以自动从 WSDL 文件生成消息。这是了解您的请求应该是什么样子的好方法。
  • 如果你能提供 wsdl 端点,就能解决这个问题。

标签: php web-services curl soap wsdl


【解决方案1】:

现在,在 PHP 中使用 SOAP WS 的最佳方式是使用 PHP 的 WSDL,例如 PackageGenerator 项目,该项目将生成类来构造请求,然后发送请求,然后处理响应所有这些使用 PHP 对象。生成的类足够直观以构造请求。此外,它使用composer作为自动加载器。

【讨论】:

    【解决方案2】:

    问题解决了,问题出在&lt;token&gt;&lt;/token&gt; 部分。

    由于它需要一个类型为:guid &lt;Id&gt;guid&lt;/Id&gt; 的值,如 wsdl 和 xml 请求中所述,它是由 .Net 库创建的数据集,用于迭代样本,这是一个相当复杂的请求,因为它需要完成前面的步骤,所以我做了这个请求,省略了&lt;token&gt; 部分

    【讨论】:

      猜你喜欢
      • 2015-09-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-04
      • 2017-04-02
      相关资源
      最近更新 更多