tags:

views:

20

answers:

1

I try to call a servise using nusoap. Service originally is written in Java and requires a java object as an input. How should I construct the input to make php accept it? At the moment service doesn't understand following approaches (thinks input is null):

$obj = (object) array('param1_name' => 'value1', 'param2_name' => 'value2', ..);

$obj = (object) array('value1', value2,...);

$obj = (object) array('String_1' => 'value1', 'Long_1' => value2, ...);

I've tried the following approach as well:

http://www.php.net/manual/en/book.soap.php#83409

Thanks in advance

A: 

If the remote service uses SOAP and you have a wsdl, then it should work. But you say, the service requires a Java object. That sounds like RMI (remote method invocation) and in that case, you won't be able to use it with nusoap and not with PHP at all. In that case, the service would require serialized Java objects (not XML) and (usually) only Java can create and read them.


The SOAP protocol usually exchanges xml documents. So it doesn't matter if the server is implemented in Java. The data format is defined in an xml schema which is included or referenced by the wsdl.

A very good tool to 'play' with SOAP webservices is soapUI. With soapUI you can write requests with a text editor and see the raw responses. You should install it and use it with the service.


Further Reading:

Andreas_D
it uses soap and has wsdl. By 'requiring wsdl' I mean that service was originally made in Java and method that we use, has as an input some java object. I'm not sure if it plays any role calling a service or not. Anyway, constracting the input as I showed before doesn't work, input is still empty.Can you give some advice, how the structure of the object should look like? just array(values), array(object_param_names => values), array(object_param_types => values), php object with the same structure or ...?
Anastassia