简体   繁体   中英

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 (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:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM