Most Basic Php SOAP Request from EJB

Aj

New Member
Basic PHP function:\[code\]//SOAP CALLfunction sayHello(){ $client = new SoapClient('http://Server:8080/MyClassService/MyClass?WSDL'); $response = $client->glassfishHello(); return $response; }\[/code\](later I call sayHello() as a String and that is where the error is)Basic EJB provided JAX-WS:\[code\]@WebService@Statelesspublic class MyClass{ @WebMethod(operationName="glassfishHello") public String glassfishHello(){ return "Hello from GlassFish"; }}\[/code\]I must be missing something very simple but after exhausting google and other options I cannot find as simple an example as I need to understand this.My Php has the error: recoverable fatal error: Object of class stdClass could not be converted to string in.. etc.So there must be something in PHP that I must do to parse the response from the WSDL.Thank you! (I can post the WSDL or any other resources)Yes I do have SOAP enabled and working.Yes my problem is what type of object is being returned. I want my sayHello() function to return a String. If i cast $response = (string).. then I have the error there.ANSWER:I knew it was simple, just a dumb PHP mistake, it has been too long since I used PHP last:\[code\]//SOAP CALLfunction sayHello(){ $client = new SoapClient('http://Server:8080/MyClassService/MyClass?WSDL'); $response = (array) $client->glassfishHello(); return $response['return'];}\[/code\]
 
Back
Top