views:

322

answers:

1

Hi!

If I have understood Axis2 correct i can construct a WebService and then access it with any SOAP compatible client.

I have a java class with a couple of methods that I have written in Eclipse, and then automatically constructed a service with the Axis2 plugin from WTP.

This is the methods of my class.

public int test(int i){
 return i+2;
}

public Car CarTest(int speed){

 return new Car("Biltest", speed);
}

public CarFactoryAdapter getCarFactory(){
 carFact.getCars().add(new Car("Bmw", 250));
 carFact.getCars().add(new Car("seat", 350));
 carFact.getCars().add(new Car("saab", 150));
 carFact.getCars().add(new Car("volv", 50));

 return new CarFactoryAdapter(carFact);
}

The code seems to work when I try it with soapUI and the Axis2-web interface has recognized the methods of my service. But when Iam trying the methods that receives parameters with PHP´s built in soapClient i get a Unknown exception. The getCarFactory methods works at least as expected, but it seems kind of crippled if I can´t send parameters.

Example of non working method invocation.

ini_set('soap.wsdl_cache_ttl',0);
$client = new SoapClient("http://192.168.128.162:8080/ComplexWebService/services/CarService?wsdl", array('soap_version' => SOAP_1_2, 'trace' => 1));
$ar['i'] = (int)100;
print_r($client->__soapCall("test",$ar));

I need to make sure that the SOA framework i choose will be able to comunicate with many platforms, there will be clients in at least PHP and Java, but it would be good if it will work in for example .NET to.

A: 

It seems that the __soapCall method takes a array with arrays.

So i think that

print_r($client->__soapCall("test",array($ar)));

Works, at least it workes with JAX-WS..

Peter Hagström