Monday, November 19, 2012

Annotations with WebServices and Soap



Let's apply annotations for basic class for Web Services with SOAP. This could look like the following:


package pl.kdabrowski;

import javax.annotation.Resource;
import javax.ejb.Stateless;
import javax.xml.transform.sax.SAXSource;
import javax.xml.ws.ServiceMode;
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.BindingType;
import javax.xml.ws.Provider;
import javax.xml.ws.WebServiceProvider;
import javax.xml.ws.handler.MessageContext;
import javax.xml.ws.Service.Mode;
import org.jboss.ws.api.annotation.WebContext;

@Stateless
@WebServiceProvider(targetNamespace = "http://kdabrowski.pl/test/testuj", portName="TestujSOAP", serviceName="TestujService",
        wsdlLocation = "META-INF/wsdl/Testuj.wsdl")
@ServiceMode(Mode.MESSAGE)
@WebContext(contextRoot="/test/testuj", urlPattern="/testuj/"+WERURL) 
@BindingType(value="http://www.w3.org/2003/05/soap/bindings/HTTP/")

public class TestujService implements Provider{

    @Resource
    WebServiceContext context;
   
    public SAXSource invoke(SAXSource arg0) {


(...)

No comments: