@WebServiceProvider(portName = "SoapPort", serviceName = "SOAPService", targetNamespace = "http://apache.org/hello_world_soap_http", wsdlLocation = "resources/wsdl/hello_world.wsdl") public class HWSourcePayloadProvider implements Provider<DOMSource> { //private static final Logger LOG = // Logger.getLogger(AnnotatedGreeterImpl.class.getName()); private int invokeCount; public HWSourcePayloadProvider() { //Complete } public DOMSource invoke(DOMSource source) { invokeCount++; return source; } public int getInvokeCount() { return invokeCount; } }
@WebServiceProvider(portName = "SoapPort", serviceName = "SOAPService", targetNamespace = "http://objectweb.org/hello_world_soap_http", wsdlLocation = "resources/wsdl/hello_world.wsdl") public class HWSourcePayloadProvider implements Provider<DOMSource> { //private static final Logger LOG = // Logger.getLogger(AnnotatedGreeterImpl.class.getName()); private int invokeCount; public HWSourcePayloadProvider() { //Complete } public DOMSource invoke(DOMSource source) { invokeCount++; return source; } public int getInvokeCount() { return invokeCount; } }
@WebServiceProvider(targetNamespace = "http://camel.apache.org/cxf/jaxws/provider") @ServiceMode (value = javax.xml.ws.Service.Mode.PAYLOAD) public interface DefaultPayloadProviderSEI extends Provider<Source> { Source invoke(Source request); }
/** * */ @ServiceMode(value = Service.Mode.MESSAGE) @WebServiceProvider() public class F3Provider implements Provider<SOAPMessage> { public SOAPMessage invoke(SOAPMessage request) { throw new UnsupportedOperationException(); } }
/** * */ @ServiceMode(value = Service.Mode.MESSAGE) @WebServiceProvider() public class F3Provider implements Provider<SOAPMessage> { public SOAPMessage invoke(SOAPMessage request) { throw new UnsupportedOperationException(); } }
@WebServiceProvider() @ServiceMode(Mode.MESSAGE) // END SNIPPET: e1 /** * This class is used by Camel just for getting the endpoint configuration * parameters. All the requests aimed at this class are intercepted and routed * to the camel route specified. The route has to set the appropriate response * message for the service to work. */ // START SNIPPET: e2 public class GreeterProvider implements Provider<SOAPMessage> { public SOAPMessage invoke(SOAPMessage message) { // Requests should not come here as the Camel route will // intercept the call before this is invoked. throw new UnsupportedOperationException("Placeholder method"); } } // END SNIPPET: e2
@WebServiceProvider(portName = "SoapPort", serviceName = "SOAPService", targetNamespace = "http://apache.org/hello_world_soap_http", wsdlLocation = "wsdl/hello_world.wsdl") @ServiceMode(value = Service.Mode.MESSAGE) public class HWSoapMessageProvider implements Provider<SOAPMessage> { //private static final Logger LOG = // Logger.getLogger(AnnotatedGreeterImpl.class.getName()); private int invokeCount; public HWSoapMessageProvider() { //Complete } public SOAPMessage invoke(SOAPMessage source) { invokeCount++; return source; } public int getInvokeCount() { return invokeCount; } }
@WebServiceProvider(portName = "SoapPort", serviceName = "SOAPService", targetNamespace = "http://objectweb.org/hello_world_soap_http", wsdlLocation = "resources/wsdl/hello_world.wsdl") @ServiceMode(value = Service.Mode.MESSAGE) public class HelloWorldServiceProvider implements Provider<DOMSource> { //private static final Logger LOG = // Logger.getLogger(AnnotatedGreeterImpl.class.getName()); private int invokeCount; public HelloWorldServiceProvider() { //Complete } public DOMSource invoke(DOMSource source) { invokeCount++; return source; } public int getInvokeCount() { return invokeCount; } }
@WebServiceProvider(portName = "SoapPort", serviceName = "SOAPService", targetNamespace = "http://objectweb.org/hello_world_soap_http", wsdlLocation = "resources/wsdl/hello_world.wsdl") @ServiceMode(value = Service.Mode.MESSAGE) public class HWSoapMessageProvider implements Provider<SOAPMessage> { //private static final Logger LOG = // Logger.getLogger(AnnotatedGreeterImpl.class.getName()); private int invokeCount; public HWSoapMessageProvider() { //Complete } public SOAPMessage invoke(SOAPMessage source) { invokeCount++; return source; } public int getInvokeCount() { return invokeCount; } }
@WebServiceProvider(portName = "SoapPort", serviceName = "SOAPService", targetNamespace = "http://apache.org/hello_world_soap_http", wsdlLocation = "resources/wsdl/hello_world.wsdl") @ServiceMode(value = Service.Mode.MESSAGE) public class HelloWorldServiceProvider implements Provider<DOMSource> { //private static final Logger LOG = // Logger.getLogger(AnnotatedGreeterImpl.class.getName()); private int invokeCount; public HelloWorldServiceProvider() { //Complete } public DOMSource invoke(DOMSource source) { invokeCount++; return source; } public int getInvokeCount() { return invokeCount; } }
@javax.xml.ws.WebServiceProvider(serviceName = "NullService", portName = "NullPort") @javax.xml.ws.ServiceMode(value = javax.xml.ws.Service.Mode.PAYLOAD) public static class NullProviderService implements Provider<Source> { public Source invoke(Source request) { return null; } }
@WebServiceProvider(targetNamespace = "http://www.example.org/contract/DoubleIt", portName = "DoubleItFaultPortSignThenEncrypt", serviceName = "DoubleItService", wsdlLocation = "classpath:/org/apache/cxf/systest/ws/security/DoubleIt.wsdl") @ServiceMode(value = Mode.MESSAGE) public static class DoubleItFaultProvider implements Provider<SOAPMessage> { public SOAPMessage invoke(SOAPMessage request) { try { MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage msg = messageFactory.createMessage(); msg.getSOAPBody().addFault(new QName("http://schemas.xmlsoap.org/soap/envelope/", "Server"), "Foo"); return msg; } catch (Exception e) { e.printStackTrace(); } return null; } }
@WebServiceProvider @ServiceMode(value = Service.Mode.PAYLOAD) public class AsyncEchoProvider implements Provider<StreamSource> { @Override @UseAsyncMethod public StreamSource invoke(StreamSource request) { throw new RuntimeException("Should be async"); } public Future<?> invokeAsync(final StreamSource s, final AsyncHandler<Source> asyncHandler) { final ServerAsyncResponse<Source> r = new ServerAsyncResponse<>(); new Thread() { public void run() { try { Thread.sleep(500); } catch (InterruptedException e) { // ignore } r.set(s); asyncHandler.handleResponse(r); } } .start(); return r; } }
@WebServiceProvider(serviceName = "AddNumbersService", portName = "AddNumbersOnlyAnonPort", targetNamespace = "http://apache.org/cxf/systest/ws/addr_feature/", wsdlLocation = "/wsdl_systest_wsspec/add_numbers.wsdl") @ServiceMode(Mode.PAYLOAD) public static class AddNumberProvider implements Provider<Source> { public Source invoke(Source obj) { //CHECK the incoming Element el; try { el = StaxUtils.read(obj).getDocumentElement(); } catch (Exception e) { throw new RuntimeException(e); } Map<String, String> ns = new HashMap<>(); ns.put("ns", "http://apache.org/cxf/systest/ws/addr_feature/"); XPathUtils xp = new XPathUtils(ns); String o = (String)xp.getValue("/ns:addNumbers/ns:number1", el, XPathConstants.STRING); String o2 = (String)xp.getValue("/ns:addNumbers/ns:number2", el, XPathConstants.STRING); int i = Integer.parseInt(o); int i2 = Integer.parseInt(o2); String resp = "<addNumbersResponse xmlns=\"http://apache.org/cxf/systest/ws/addr_feature/\">" + "<return>" + (i + i2) + "</return></addNumbersResponse>"; return new StreamSource(new StringReader(resp)); } }
@WebServiceProvider(targetNamespace = "http://www.example.org/contract/DoubleIt", portName = "DoubleItPortSignThenEncrypt", serviceName = "DoubleItService", wsdlLocation = "classpath:/org/apache/cxf/systest/ws/security/DoubleIt.wsdl") @ServiceMode(value = Mode.PAYLOAD) public static class DoubleItProvider implements Provider<Source> { public Source invoke(Source obj) { //CHECK the incoming Node el; try { el = StaxUtils.read(obj); } catch (Exception e) { throw new RuntimeException(e); } if (el instanceof Document) { el = ((Document)el).getDocumentElement(); } Map<String, String> ns = new HashMap<>(); ns.put("ns2", "http://www.example.org/schema/DoubleIt"); XPathUtils xp = new XPathUtils(ns); String o = (String)xp.getValue("//ns2:DoubleIt/numberToDouble", el, XPathConstants.STRING); int i = Integer.parseInt(o); String req = "<ns2:DoubleItResponse xmlns:ns2=\"http://www.example.org/schema/DoubleIt\">" + "<doubledNumber>" + Integer.toString(i * 2) + "</doubledNumber></ns2:DoubleItResponse>"; return new StreamSource(new StringReader(req)); } }
@WebServiceProvider(portName = "SoapProviderPort", serviceName = "SOAPProviderService", targetNamespace = "http://apache.org/hello_world_soap_http") @ServiceMode(value = Service.Mode.MESSAGE)
@WebServiceProvider( targetNamespace = "http://messaging/", serviceName = "AsyncMessagingService",
@WebServiceProvider(serviceName = "HelloProviderService", portName = "HelloProviderPort", targetNamespace = "http://apache.org/hello_world_xml_http/bare") @BindingType(value = javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING) @ServiceMode(value = javax.xml.ws.Service.Mode.PAYLOAD) public class GreeterProvider implements Provider<Source> { public Source invoke(Source req) { return new StreamSource(); } } }
@BindingType(value = "http://schemas.xmlsoap.org/wsdl/soap/http") @ServiceMode(value = javax.xml.ws.Service.Mode.PAYLOAD) @WebServiceProvider(targetNamespace = "http://cxf.apache.org/", serviceName = "HelloWS", portName = "hello") @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) @EndpointProperties(value = { @EndpointProperty(key = "schema-validation-enabled", value = "true"), @EndpointProperty(key = "mtom-enabled", value = "true") }) public class TestProvider implements Provider<SAXSource> { private String successRsp = "<ns2:helloResponse xmlns:ns2=\"http://cxf.apache.org/\">" + "<return>Hello CXF</return>" + "</ns2:helloResponse>"; public SAXSource invoke(SAXSource request) { return new SAXSource(new InputSource(new StringReader(successRsp))); } }
@WebServiceProvider(wsdlLocation = "classpath:/wsdl/schema_validation.wsdl", serviceName = "SchemaValidationService", portName = "SoapPort", targetNamespace = "http://apache.org/schema_validation") @ServiceMode(Service.Mode.PAYLOAD) @SchemaValidation @Logging static class PayloadProvider implements Provider<Source> { @Override public Source invoke(Source request) { try { Document doc = StaxUtils.read(request); String name = doc.getDocumentElement().getLocalName(); if ("SomeRequest".equals(name)) { String v = DOMUtils.getFirstElement(doc.getDocumentElement()).getTextContent(); return new StreamSource(new StringReader(getResponse(v))); } } catch (XMLStreamException e) { e.printStackTrace(); } return null; } }