THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
The Spring jars (optional - for XML Configuration support):
Code Block | ||
---|---|---|
java | java | aopalliance-1.0.jar spring-core-2.0.4.jar spring-beans-2.0.4.jar spring-context-2.0.4.jar spring-web-2.0.4.jar |
...
To make sure your parameter is named correctly in the xml you should use:
Code Block | java | java
---|
@WebService public interface HelloWorld { String sayHi(@WebParam(name="text") String text); } |
...
Alternatively you can use the follwing code. This gives you more control over the behaviour. For example you can add a logging interceptor:
Code Block | java | java
---|
HelloWorldImpl implementor = new HelloWorldImpl(); JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean(); svrFactory.setServiceClass(HelloWorld.class); svrFactory.setAddress("http://localhost:9000/helloWorld"); svrFactory.setServiceBean(implementor); svrFactory.getInInterceptors().add(new LoggingInInterceptor()); svrFactory.getOutInterceptors().add(new LoggingOutInterceptor()); svrFactory.create(); |
...
For the client there is also the alternative approach that gives you more flexibility. Of course like above the logging interceptors are optional but they help a lot when starting:
Code Block | java | java
---|
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.getInInterceptors().add(new LoggingInInterceptor()); factory.getOutInterceptors().add(new LoggingOutInterceptor()); factory.setServiceClass(HelloWorld.class); factory.setAddress("http://localhost:9000/helloWorld"); HelloWorld client = (HelloWorld) factory.create(); String reply = client.sayHi("HI"); System.out.println("Server said: " + reply); System.exit(0); |