Skip to main content

JAX to PHP - parameters problem

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
1 reply [Last post]
rakashu
Offline
Joined: 2011-02-07

Hi guys!
This is my first post here, and I really need some help. I have created a simple SAX-WS in Eclipse which has one method that takes in a string and returns a "hello + string", it looks like this:
package hello;
import javax.jws.WebService;
@WebService(endpointInterface = "hello.Greeting")
public class GreetingImp implements Greeting {
@Override
public String sayHello(String name) {
return "Hello" + name;
}
}
I use then Endpoint.publish("http://localhost:8080/WS/Greeting",new GreetingImp()); to publish WS. I downloaded soapUI to test if WS is working and it did. So next step was to try out a PHP client. I did it like this:
<?php
$client = new SoapClient('http://localhost:8080/WS/Greeting?wsdl');
var_dump($client->sayHello("ME"));
?>
When I try this out I get result from function but parameter is set to null ("Hello null"). I have played a bit with the code and soapUI and it seams like parameters are not sent to JAX. Does anyone know what might be the problem? Is it JAX?
Regards
Raka

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
rakashu
Offline
Joined: 2011-02-07

Nevermind, figured out myself :)
Problem was that my parameter had a strange name, arg0. I found out this when I did
var_dump($client->__getTypes());
I got output:
array(2) { [0]=> string(33) "struct sayHello { string arg0; }" [1]=> string(43) "struct sayHelloResponse { string return; }" }
so I have changed my function call to:
var_dump($client->sayHello(array("arg0"=>"name")));
and it worked :)
Cheers
Raka