I have created and deploy a very simple test webservice on my server.
public class HelloWorld {
@WebMethod()
public String sayHello(String name) {
System.out.println("Hello: " + name);
return "Hello " + name + "!";
}
}
next, i created a test client via File > New > Other > Web Services > Web Service Client. Fill the wsdl address, and eclipse do generate several classes automatically:
- HelloWorld.java
- HelloWorldProxy.java
- HelloWorldService.java
- HelloWorldServiceLocator.java
- HelloWorldServiceSoapBindingStub.java
then code the test client:
HelloWorldProxy wsHelloProxy = new HelloWorldProxy();
String greeting = wsHelloProxy.sayHello('Jack');
System.out.println(greeting)
it is running succesfully.
My Question is, how can i add additional headers in my client code, because i want to always send some information to my webservice. May i get the example ?
Can anyone help?
thx