使用php的SOAP请求中的属性

时间:2016-10-20 10:30:22

标签: php attributes soap-client

我试图在SOAP调用中创建这个XML

<ns1:NameID type="INTERNAL">831392</ns1:NameID>
             <ns1:NameMembership primary="true" displaySequence="1">
                 <ns2:membershipType>PFS</ns2:membershipType>
                 <ns2:membershipNumber>222222E</ns2:membershipNumber>
                 <ns2:membershipLevel>SILVER</ns2:membershipLevel>
                 <ns2:memberName>Luis Fernandez </ns2:memberName>
             </ns1:NameMembership>

我不知道如何添加primarykey和displaySequence`属性。我试图创造这样的东西:

$parameters = array("NameID" => array("_" => "831392", "type" => "INTERNAL"),
            "NameMembership" => array("_" => array(
              "membershipLevel" => "SILVER",
              "memberName" => "Luis Fernandez",
              "membershipType" => "PFS",
              "membershipNumber" => "222222E"), "primary" => true, "displaySequence" => 1
        ));

但它不起作用。它返回以下代码:

<ns1:InsertGuestCardRequest>
        <ns1:NameID type="INTERNAL">831392</ns1:NameID>
        <ns1:NameMembership primary="true" displaySequence="1"/>
    </ns1:InsertGuestCardRequest>

任何人都可以帮我找到我做错的事吗?

1 个答案:

答案 0 :(得分:0)

我明白了!谢谢!

$parameters = array("NameID" => array("_" => "831392", "type" => "INTERNAL"),
        "NameMembership" => array(
          "membershipLevel" => "SILVER",
          "memberName" => "Luis Fernandez",
          "membershipType" => "PFS",
          "membershipNumber" => "222222E", 
           "primary" => true, 
           "displaySequence" => 1
    ));