将关联数组从Java传递给PHP

时间:2013-08-10 13:28:15

标签: php android arrays soap

我正在尝试将关联数组从Java传递给PHP。我收到“无法序列化异常。”

后端php代码(soap调用)是这样的:

function getTrips($data)
{ 
     foreach($data as $key => $value)
    {
      ...
    }  
}

我正在进行这样的java客户端调用:

HashMap<String, String> Data = new HashMap<String, String>();

        Data.put("start_date", dateFormat.format(date));
        Data.put("end_date", dateFormat.format(date));
        Data.put("loc", "1");

        request.addProperty("data",Data );

        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

        envelope.setOutputSoapObject(request);
        HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
        androidHttpTransport.call(SOAP_ACTION, envelope);

我尝试使用NameValuePair代码是这样的:

    List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(6);

            nameValuePairs.add(new BasicNameValuePair("start_date", dateFormat.format(date)));

            nameValuePairs.add(new BasicNameValuePair("end_date", dateFormat.format(date)));
request.addProperty("data",nameValuePairs );

0 个答案:

没有答案