【问题标题】:Return the SOAP Complex Types defined in the WSDL返回 WSDL 中定义的 SOAP 复杂类型
【发布时间】:2013-10-10 18:47:11
【问题描述】:

我创建了一个包含一些复杂数据类型的 WSDL,摘录如下。

SOAP 服务器使用 PHP,而我的客户端是 C#。我可以用 C# 很好地连接到肥皂服务器并查看所有类型,我可以创建 API 请求标头并调用方法等。

我遇到的问题是,例如,我如何从 PHP SOAP 服务器返回像 GetAccountFundsResp 这样的对象。无论我尝试什么,我都只是在 C# 中得到一个空对象

<xsd:complexType abstract="true" name="APIResponse">
    <xsd:sequence>
        <xsd:element name="header" nillable="true" type="types:APIResponseHeader"/>
    </xsd:sequence>
</xsd:complexType>

<xsd:complexType name="APIResponseHeader">
    <xsd:sequence>
        <xsd:element name="errorCode" type="types:APIErrorEnum"/>
        <xsd:element name="minorErrorCode" nillable="true" type="xsd:string"/>
        <xsd:element name="sessionToken" nillable="true" type="xsd:string"/>
    </xsd:sequence>
</xsd:complexType>

<xsd:simpleType name="APIErrorEnum">
    <xsd:restriction base="xsd:string">
        <xsd:enumeration value="OK"/>
        <xsd:enumeration value="INTERNAL_ERROR"/>
    </xsd:restriction>
</xsd:simpleType>

<xsd:complexType abstract="true" name="APIRequest">
    <xsd:sequence>
        <xsd:element name="header" nillable="true" type="types:APIRequestHeader"/>
    </xsd:sequence>
</xsd:complexType>

<xsd:complexType name="APIRequestHeader">
    <xsd:sequence>
        <xsd:element name="clientStamp" type="xsd:long"/>
        <xsd:element name="sessionToken" nillable="true" type="xsd:string"/>
    </xsd:sequence>
</xsd:complexType>

<xsd:complexType name="GetAccountFundsResp">
    <xsd:complexContent>
        <xsd:extension base="types:APIResponse">
            <xsd:sequence>
                <xsd:element name="availBalance" nillable="false" type="xsd:double"/>
                <xsd:element name="balance" nillable="false" type="xsd:double"/>
                <xsd:element name="errorCode" type="types:GetAccountFundsErrorEnum"/>
                </xsd:sequence>
        </xsd:extension>
    </xsd:complexContent>
</xsd:complexType>

<xsd:simpleType name="GetAccountFundsErrorEnum">
    <xsd:restriction base="xsd:string">
        <xsd:enumeration value="OK"/>
        <xsd:enumeration value="API_ERROR"/>
    </xsd:restriction>
</xsd:simpleType>

<xsd:complexType name="GetAccountFundsReq">
    <xsd:complexContent>
        <xsd:extension base="types:APIRequest"/>
    </xsd:complexContent>
</xsd:complexType>

【问题讨论】:

  • 返回对象和数组。
  • 你是怎么做到的?
  • 我创建了一个与 wsdl 中定义的格式相同的对象,实例化并返回它。

标签: php web-services soap wsdl


【解决方案1】:

没关系。我刚刚找到了 nusoap,它解决了我所有的问题 :)

【讨论】:

  • 如果您没有在回答中分享 解决方案,那么仅回答 没关系,我找到了解决方案 并没有多大帮助,以及你是如何做到的。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-11-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-10-02
  • 2014-06-27
相关资源
最近更新 更多