Re[2]: Problem using deployed Axis web services
Thanks a lot, Dies, for your detailed explanation! I understand the principles behind the workings of WSDL2Java much better now. This whole thing has cost me the better part of an entire week. Then again, it's my own fault for not having checked the actual method implementation. I'm off defining my interfaces now... All the best, Martin > Hello Martin, > WSDL2Java creates a template for the impl file for your convenience. All > methods with a return value are generated with "return null;" or some > primitive value so that they compile. WSDL2Java will not copy the method > body from your original class. > Note that actually the idea when you start with a Java class is that you > start with an interface (no method bodies), use Java2WSDL to generate a > WSDL, then use WSDL2Java to generate the server-side interface and a > template in which you fill the method bodies. > Although Java2WSDL allows you to specify a concrete class (not > interface) as input interface, it treats it as an interface (i.e. does > not look at the methods' bodies, decompile them and copy the source into > the generated impl file's method bodies). > The WSDL defines the interface of your web service. Therefore, it is not > strange to lose your method implementations in the Java->WSDL->Java > conversions. > Regards, > Dies
RE: Re[2]: Problem using deployed Axis web services
http://ws.apache.org/axis/java/reference.html -t builds testClient good luck, -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Martin Wunderlich Sent: Wednesday, April 05, 2006 3:57 PM To: Jinyuan Zhou Subject: Re[2]: Problem using deployed Axis web services Thanks a lot for the quick replies, Jinyuan. I checked WSDL2Java for the JUnit option you mentioned, but couldn't find it. As for the URL I call the web service with, it's a bit different from the one you provided. I tried the following: http://localhost/WSTest/services/SayHello2?method=hello&in0=Bla and http://localhost/WSTest/services/SayHello2?method=hello&in=Bla Neither of this works. I have also pasted the client code below. This only returns a null value. Cheers, Martin > The generated code won't get Endpoint address right. Yours is > http://localhost/WSTest/services/SayHello2. > See if the following code or something simailar can help: > call.setTargetEndpointAddress( new > java.net.URL("http://localhost/WSTest/services/SayHello2";) import javax.xml.rpc.ParameterMode; import org.apache.axis.Constants; import org.apache.axis.client.Call; import org.apache.axis.client.Service; public class TestClient { public static void main(String [] args) { try { String endpoint = "http://localhost/WSTest/services/SayHello2";; Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress( new java.net.URL(endpoint) ); call.setOperationName("hello"); call.addParameter( "in", Constants.XSD_STRING, ParameterMode.IN ); call.setReturnType( Constants.XSD_STRING ); String ret = (String) call.invoke( new Object[] { "bla" } ); System.out.println("return: " + ret); } catch (Exception e) { System.err.println(e.toString()); } } }
Re[2]: Problem using deployed Axis web services
Thanks a lot for the quick replies, Jinyuan. I checked WSDL2Java for the JUnit option you mentioned, but couldn't find it. As for the URL I call the web service with, it's a bit different from the one you provided. I tried the following: http://localhost/WSTest/services/SayHello2?method=hello&in0=Bla and http://localhost/WSTest/services/SayHello2?method=hello&in=Bla Neither of this works. I have also pasted the client code below. This only returns a null value. Cheers, Martin > The generated code won't get Endpoint address right. Yours is > http://localhost/WSTest/services/SayHello2. > See if the following code or something simailar can help: > call.setTargetEndpointAddress( new > java.net.URL("http://localhost/WSTest/services/SayHello2";) import javax.xml.rpc.ParameterMode; import org.apache.axis.Constants; import org.apache.axis.client.Call; import org.apache.axis.client.Service; public class TestClient { public static void main(String [] args) { try { String endpoint = "http://localhost/WSTest/services/SayHello2";; Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress( new java.net.URL(endpoint) ); call.setOperationName("hello"); call.addParameter( "in", Constants.XSD_STRING, ParameterMode.IN ); call.setReturnType( Constants.XSD_STRING ); String ret = (String) call.invoke( new Object[] { "bla" } ); System.out.println("return: " + ret); } catch (Exception e) { System.err.println(e.toString()); } } }