nusoap (php) + java object as an input
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 开发者_JS百科(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
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:
- Programming with NuSOAP Using PHP
精彩评论