代码之家  ›  专栏  ›  技术社区  ›  rayss

如何在webservice中使用多维数组传递参数

  •  0
  • rayss  · 技术社区  · 14 年前

    如何使用此请求在Web服务中传递参数:

    post/webservice/user.asmx http/1.1发布 内容类型:text/xml;charset=utf-8 内容长度:长度 soapaction:“http://sample.com/updateuserbatch”

    <UpdateUserBatch xmlns="http://sample.com/">
      <auth>
        <Username>string</Username>
        <Password>string</Password>
      </auth>
      <request>
        <CreateIfNotExist>boolean</CreateIfNotExist>
        <UpdateIfExists>boolean</UpdateIfExists>
        <Users>
          <UserProfile>
            <UserID>string</UserID>
            <BusinessID>string</BusinessID>
            <ExternalID>string</ExternalID>
            <Username>string</Username>
            <Password>string</Password>
            <UpdateDate>dateTime</UpdateDate>
          </UserProfile>
          <UserProfile>
            <UserID>string</UserID>
            <BusinessID>string</BusinessID>
            <ExternalID>string</ExternalID>
            <Username>string</Username>
            <Password>string</Password>
            <UpdateDate>dateTime</UpdateDate>
          </UserProfile>
        </Users>
      </request>
    </UpdateUserBatch>
    

    我想使用那个web服务导入数据。

    1 回复  |  直到 14 年前
        1
  •  0
  •   Martin Bean    14 年前

    我不确定 POST 请求,但是 GET 请求通常对多维数组使用方括号表示法。例如:

    http://api.example.com/object/?foo[]=bar&foo[]=baz

    这将在api端进行组装,如下所示:

    'foo' => array(
        0 => 'bar',
        1 => 'baz'
    );
    

    当然,可以使用索引数组和数值数组。