From: <php...@li...> - 2011-02-23 21:26:27
|
Hello, I'm new at php-java-bridge (and in java). I made a class in Java CXF to invoke a webservice with ws-security (something that is difficult in PHP). The class is the following in short: package be.icthealth.ehealth; import org.apache.log4j.BasicConfigurator; import org.apache.log4j.Logger; import org.apache.log4j.Level; import org.apache.ws.security.handler.WSHandlerConstants; import org.apache.cxf.endpoint.dynamic.DynamicClientFactory; import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor; import org.apache.cxf.endpoint.Client; import java.util.HashMap; import java.util.Map; import java.io.File; import java.net.URL; //import java.lang.reflect.Method; /** * * @author Koen Thomeer, MD, http://koen.thomeer.be */ public class Codage { /** * @param request the class EncodeRequest * @return response the class Response * @throws Exception */ public Object[] encode(Object request) throws Exception { //throw new Exception("test"); // configure logging BasicConfigurator.configure(); Logger.getLogger("org").setLevel(Level.WARN); java.util.logging.Logger.getLogger("").setLevel(java.util.logging.Level.WARNING); //code that I did leave out// // call the Codage Object[] response = client.invoke("encode", request); return response; } } The PHP code to call is the following (in short, it is nested in a function; $input is a PHP Instance): define("JAVA_PREFER_VALUES", false); require_once("http://localhost:8080/JavaBridgeWS/java/Java.inc"); try { $Codage = java("be.icthealth.ehealth.Codage"); $java_input = java_closure($input); $java_output = $Codage->encode($java_input); $output = java_values($java_output); print_r($output); } catch (JavaException $e) { // in case of an error, process the fault echo $e; } The error in the HTTPD log is the following: [Wed Feb 23 22:17:37 2011] [error] [client 84.196.244.172] PHP Fatal error: Couldn't execute method java_InternalException::__set in Unknown on line 0 [Wed Feb 23 22:17:37 2011] [error] [client 84.196.244.172] PHP Stack trace: [Wed Feb 23 22:17:37 2011] [error] [client 84.196.244.172] PHP 1. {main}() /project/wmailer-test/www/secure/test/codage_test.php:0 [Wed Feb 23 22:17:37 2011] [error] [client 84.196.244.172] PHP 2. EH_encode() /project/wmailer-test/www/secure/test/codage_test.php:5 [Wed Feb 23 22:17:37 2011] [error] [client 84.196.244.172] PHP 3. JavaClass->encode() /project/wmailer-test/www/secure/test/codage5.php:219 [Wed Feb 23 22:17:37 2011] [error] [client 84.196.244.172] PHP 4. Java->__call() http://localhost:8080/JavaBridgeWS/java/Java.inc:0 [Wed Feb 23 22:17:37 2011] [error] [client 84.196.244.172] PHP 5. java_AbstractJava->__call() http://localhost:8080/JavaBridgeWS/java/Java.inc:1999 [Wed Feb 23 22:17:37 2011] [error] [client 84.196.244.172] PHP 6. java_JavaProxy->__call() http://localhost:8080/JavaBridgeWS/java/Java.inc:1851 [Wed Feb 23 22:17:37 2011] [error] [client 84.196.244.172] PHP 7. java_Client->invokeMethod() http://localhost:8080/JavaBridgeWS/java/Java.inc:1752 [Wed Feb 23 22:17:37 2011] [error] [client 84.196.244.172] PHP 8. java_Client->getResult() http://localhost:8080/JavaBridgeWS/java/Java.inc:560 [Wed Feb 23 22:17:37 2011] [error] [client 84.196.244.172] PHP 9. java_Client->getWrappedResult() http://localhost:8080/JavaBridgeWS/java/Java.inc:366 [Wed Feb 23 22:17:37 2011] [error] [client 84.196.244.172] PHP 10. java_Arg->getResult() http://localhost:8080/JavaBridgeWS/java/Java.inc:360 [Wed Feb 23 22:17:37 2011] [error] [client 84.196.244.172] PHP 11. java_ThrowExceptionProxyFactory->checkResult() http://localhost:8080/JavaBridgeWS/java/Java.inc:235 Questions: 1. What I'm doing wrong? I don't understand the log. 2. Where I've to put the keystore, properties file, etc? Thx, Koen -- *Koen Thomeer*, MD, MSc http://koen.thomeer.be |