01: package demo.hwDispatch.server;
02:
03: import java.io.InputStream;
04:
05: import javax.xml.soap.MessageFactory;
06: import javax.xml.soap.SOAPMessage;
07: import javax.xml.ws.Provider;
08: import javax.xml.ws.Service;
09: import javax.xml.ws.ServiceMode;
10: import javax.xml.ws.WebServiceProvider;
11:
12: @WebServiceProvider(portName="SoapPort1",serviceName="SOAPService1",targetNamespace="http://objectweb.org/hello_world_soap_http",wsdlLocation="file:./wsdl/hello_world.wsdl")
13: @ServiceMode(value=Service.Mode.MESSAGE)
14: public class GreeterSoapMessageProvider implements
15: Provider<SOAPMessage> {
16:
17: public GreeterSoapMessageProvider() {
18: //Complete
19: }
20:
21: public SOAPMessage invoke(SOAPMessage request) {
22: SOAPMessage response = null;
23: try {
24: MessageFactory factory = MessageFactory.newInstance();
25: InputStream is = getClass().getResourceAsStream(
26: "GreetMeDocLiteralResp1.xml");
27: response = factory.createMessage(null, is);
28: is.close();
29: } catch (Exception ex) {
30: ex.printStackTrace();
31: }
32: return response;
33: }
34: }
|