I am using SabreAMF to call on a Java webservice.
This is the Java function:
@RemotingInclude
public Boolean testAMF(List<Integer> ints)
{
for (Integer element : ints)
{
//do something
}
return true;
}
Note that this function accepts a List of Integers.
This is the PHP code:
<?php
require 'SabreAMF/Client.php';
function make_request($service, $method, $params)
{
$client = new SabreAMF_Client('https://xxx');
return $client->sendRequest($service.'.'.$method,$params);
}
$ints = array(1,2);
$parameters = array($ints);
$result = make_request('chartManager','testAMF',$parameters);
var_dump($result);
?>
I pass along an array containing 2 integers.
In Java, this array comes in as a list, but one containing Doubles, not ints.
I then get the following error:
java.lang.ClassCastException : java.lang.Double cannot be cast to java.lang.Integer
Why does it change my integer to a double ?
There are only Doubles in AMF0. So you need to change the type to
Double.You can get integer support if you use AMF3: