views:

67

answers:

1

Hi all, I want to build simple SOAP web service. So far I've only worked with existing SOAP/Rest services. And now I'd like to create my own, simple one for starters.

For example create simple hello + string web service where I provide the string in request from SOAP ui or similar tool.

I have Jboss server installed already, what is the "simplest" possible way to achieve this? I realize I need interface, interfaceImpl, and a wsdl file(generated possibly).

Does anyone have some useful advice for me ? thank you

+2  A: 

If you want something extremely straight forward, use JAX-WS and a Java first approach. Here is what a Hello world web service looks like:

@WebService
public class HelloWebService {
    public String sayHello(String name) {
        return "Hi" + name;
    }

    public static void main(String ... args) {
        HelloWebService hello = new HelloWebService();
        Endpoint endpoint = Endpoint.publish("http://localhost:8081/hello", hello);
    }
}

Java 6 includes JAX-WS RI, an implementation of JAX-WS, so you can run this code as is and test it with SAOP-UI (the generated WSDL is available at http://localhost:8081/hello?WSDL).

JBoss supports JAX-WS through a native stack - but you can also use Apache CXF or Metro (Metro = JAX-WS RI + WSIT). Check JBossWS for more details. I suggest to start with their native stack.

See also

Pascal Thivent
@Pascal Thivent I will accept this it is working, one more thing, I'd like to use this with spring(I think I know how), and build war with maven/deploy it to jboss, do I need to have some kind of generated wsdl somewhere inside src/main/resources so it will be packed inside .war? or is it too much for now?I should go first trough these and some more tutorials?
London
@London Both JAX-WS RI and CXF provide Spring integration. Regarding the WSDL and packaging, the WSDL can be *generated* on the fly by the runtime environment, you don't have to provide a static version. And yes, I suggest to go ahead with tutorials.
Pascal Thivent