4

As far as I know, one needs Apache Tomcat or App server like JBoss to deploy and run a web service implemented in java.

My manager asked me, isn't there any alternative to deploy a Web service without configuring or setting up Apache Tomcat/JBoss.

I am basically a QA engineer and have some minimal Java programming experience.

We are trying to develop/implement a Java based Web Service for load generation of SMTP messages which can be invoked by test scripts developed using different technologies (QTP, Perl etc.)

Thanks for your time.

dkarthik
  • 41
  • 1
  • 2

3 Answers3

2

Yes, you can run a Webservice simply off the JDK using the @WebService annotation. It even supports SOAP.

Simple example (taken from here, in german):

Service:

@WebService
@SOAPBinding(style=Style.RPC)
public class Calculator {
  public long addValues(int val1, int val2) {
    return val1 + val2;
  }
}

Initialization code:

public class CalculatorServer {
  public static void main (String args[]) {
    Calculator server = new Calculator();
    Endpoint endpoint =
        Endpoint.publish("http://localhost:8080/calculator", server);
  }
}
nfechner
  • 17,295
  • 7
  • 45
  • 64
  • The article you reference does not address container-less execution at all. Not even close to what this question is about. – pap Jun 26 '12 at 10:03
  • @pap You are right, I have removed the reference. Unfortunately I was unable to find a useful article in english on this subject... Still, this is the way to do it. – nfechner Jun 26 '12 at 10:12
  • @nfechner - Thanks for the input. Wrote a sample program using javax.ws based on article in IBM DeveloperWorks Portal. – dkarthik Jun 26 '12 at 11:06
1

Web services built in java is basically a Java Application with a different data presentation behavior. you can, just then you have to make them up running when the consumer calls a service. This is how we test them in white box manner.

manurajhada
  • 5,284
  • 3
  • 24
  • 43
0

I hope we can, if we use a BINDING protocol as SMTP or CORBA rather than HTTP.

Link : Protocol stack for Web-services.

Ahamed Mustafa M
  • 3,069
  • 1
  • 24
  • 34