Examples of Greeter


Examples of org.apache.hello_world_soap_http.Greeter

    @Test
    public void testAddPortWithSpecifiedSoap11Binding() throws Exception {
        Service service = Service.create(serviceName);
        service.addPort(fakePortName, javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING,
            "http://localhost:" + PORT + "/SoapContext/SoapPort");
        Greeter greeter = service.getPort(fakePortName, Greeter.class);

        String response = new String("Bonjour");
        try {
            greeter.greetMe("test");
            String reply = greeter.sayHi();
            assertNotNull("no response received from service", reply);
            assertEquals(response, reply);
        } catch (UndeclaredThrowableException ex) {
            throw (Exception)ex.getCause();
        }
View Full Code Here

Examples of org.apache.hello_world_soap_http.Greeter

    @Test
    public void testAddPort() throws Exception {
        Service service = Service.create(serviceName);
        service.addPort(fakePortName, "http://schemas.xmlsoap.org/soap/",
                        "http://localhost:" + PORT + "/SoapContext/SoapPort");
        Greeter greeter = service.getPort(fakePortName, Greeter.class);

        String response = new String("Bonjour");
        try {
            greeter.greetMe("test");
            String reply = greeter.sayHi();
            assertNotNull("no response received from service", reply);
            assertEquals(response, reply);
        } catch (UndeclaredThrowableException ex) {
            throw (Exception)ex.getCause();
        }
View Full Code Here

Examples of org.apache.hello_world_soap_http.Greeter

    public void testGetPortOneParam() throws Exception {

        URL url = getClass().getResource("/wsdl/hello_world.wsdl");
        Service service = Service.create(url, serviceName);
       
        Greeter greeter = service.getPort(Greeter.class);
        String response = new String("Bonjour");
        
        try {
            ((BindingProvider)greeter).getRequestContext()
                .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                     "http://localhost:" + PORT + "/SoapContext/SoapPort");
            greeter.greetMe("test");
            String reply = greeter.sayHi();
            assertNotNull("no response received from service", reply);
            assertEquals(response, reply);
        } catch (UndeclaredThrowableException ex) {
            throw (Exception)ex.getCause();
        }
View Full Code Here

Examples of org.apache.hello_world_soap_http.Greeter

        assertNotNull(wsdl);
       
        SOAPService service = new SOAPService(wsdl, serviceName);
        assertNotNull(service);
       
        Greeter greeter = service.getPort(portName, Greeter.class);
        updateAddressPort(greeter, PORT);
       
        String response1 = new String("Hello Milestone-");
        String response2 = new String("Bonjour");
        try {      
            for (int idx = 0; idx < 1; idx++) {
                String greeting = greeter.greetMe("Milestone-" + idx);
                assertNotNull("no response received from service", greeting);
                String exResponse = response1 + idx;
                assertEquals(exResponse, greeting);
               
                String reply = greeter.sayHi();
                assertNotNull("no response received from service", reply);
                assertEquals(response2, reply);

                greeter.greetMeOneWay("Milestone-" + idx);
               
               
               
            }           
        } catch (UndeclaredThrowableException ex) {
View Full Code Here

Examples of org.apache.hello_world_soap_http.Greeter

       
        SOAPService service = new SOAPService(wsdl, serviceName);
        assertNotNull(service);
       
        //getPort only passing in SEI
        Greeter greeter = service.getPort(Greeter.class);
        ((BindingProvider)greeter).getRequestContext()
            .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                 "http://localhost:" + PORT + "/SoapContext/SoapPort");
       
        String response1 = new String("Hello Milestone-");
        String response2 = new String("Bonjour");
        try {      
            for (int idx = 0; idx < 5; idx++) {
                String greeting = greeter.greetMe("Milestone-" + idx);
                assertNotNull("no response received from service", greeting);
                String exResponse = response1 + idx;
                assertEquals(exResponse, greeting);
               
                String reply = greeter.sayHi();
                assertNotNull("no response received from service", reply);
                assertEquals(response2, reply);

                greeter.greetMeOneWay("Milestone-" + idx);
               
               
               
            }           
        } catch (UndeclaredThrowableException ex) {
View Full Code Here

Examples of org.apache.hello_world_soap_http.any.Greeter

    public void testAny() throws Exception {
        URL wsdl = getClass().getResource("/wsdl/any.wsdl");
        assertNotNull(wsdl);

        SOAPService ss = new SOAPService(wsdl, serviceName);
        Greeter port = ss.getSoapPort();

        List<Port> any = new ArrayList<Port>();
        Port anyPort = new Port();
        Port anyPort1 = new Port();
        JAXBElement<String> ele1 = new JAXBElement<String>(
            new QName("http://apache.org/hello_world_soap_http/other", "port"),
            String.class, "hello");
       
        anyPort.setAny(ele1);
        JAXBElement<String> ele2 = new JAXBElement<String>(
            new QName("http://apache.org/hello_world_soap_http/other", "port"),
            String.class, "Bon");
        anyPort1.setAny(ele2);
       
        any.add(anyPort);
        any.add(anyPort1);
        String rep = port.sayHi(any);
        assertEquals(rep, "helloBon");
    }
View Full Code Here

Examples of org.apache.hello_world_soap_http.jibx.Greeter

        BusFactory.setDefaultBus(bus);
        URL wsdl = this.getClass().getResource("/wsdl_systest_databinding/jibx/hello_world.wsdl");
        assertNotNull("We should have found the WSDL here. " , wsdl);     
       
        SOAPService ss = new SOAPService(wsdl, SERVICE_NAME);
        Greeter port = ss.getSoapPort();
        updateAddressPort(port, WSDL_PORT);
       
        String resp;
        ClientProxy.getClient(port).getInInterceptors().add(new LoggingInInterceptor());
        ClientProxy.getClient(port).getOutInterceptors().add(new LoggingOutInterceptor());
        resp = port.sayHi();
        assertEquals("We should get the right response", "Bonjour", resp);       
       
        resp = port.greetMe("Willem");
        assertEquals("We should get the right response", "Hello Willem", resp);

        try {
            port.greetMe("fault");
            fail("Should have been a fault");
        } catch (GreetMeFault ex) {
            assertEquals("Some fault detail", ex.getFaultInfo().getGreetMeFaultDetail());
        }
       
        try {
            port.pingMe();
            fail("We expect exception here");
        } catch (PingMeFault ex) {           
            FaultDetail detail = ex.getFaultInfo();
            assertEquals("Wrong faultDetail major", detail.getMajor(), 2);
            assertEquals("Wrong faultDetail minor", detail.getMinor(), 1);            
View Full Code Here

Examples of org.apache.hello_world_soap_http.xmlbeans.Greeter

        BusFactory.setDefaultBus(bus);
        URL wsdl = this.getClass().getResource("/wsdl_systest_databinding/xmlbeans/hello_world.wsdl");
        assertNotNull("We should have found the WSDL here. " , wsdl);     
       
        SOAPService ss = new SOAPService(wsdl, SERVICE_NAME);
        Greeter port = ss.getSoapPort();
        String resp;
        ClientProxy.getClient(port).getInInterceptors().add(new LoggingInInterceptor());
        ClientProxy.getClient(port).getOutInterceptors().add(new LoggingOutInterceptor());
        resp = port.sayHi();
        assertEquals("We should get the right response", "Bonjour", resp);       
       
        resp = port.greetMe("Willem");
        assertEquals("We should get the right response", "Hello Willem", resp);

        try {
            port.greetMe("fault");
            fail("Should have been a fault");
        } catch (GreetMeFault ex) {
            assertEquals("Some fault detail", ex.getFaultInfo().getStringValue());
        }

        try {
            resp = port.greetMe("Invoking greetMe with invalid length string, expecting exception...");
            fail("We expect exception here");
        } catch (WebServiceException ex) {          
            assertTrue("Get a wrong exception",
                       ex.getMessage().
                       indexOf("string length (67) is greater than maxLength facet (30)") >= 0);
        }
       
        try {
            port.pingMe();
            fail("We expect exception here");
        } catch (PingMeFault ex) {           
            FaultDetailDocument detailDocument = ex.getFaultInfo();
            FaultDetail detail = detailDocument.getFaultDetail();
            assertEquals("Wrong faultDetail major", detail.getMajor(), 2);
View Full Code Here

Examples of org.apache.hello_world_soap_http_jibx.jibx.Greeter

        BusFactory.setDefaultBus(bus);
        URL wsdl = this.getClass().getResource("/wsdl_systest_databinding/jibx/hello_world.wsdl");
        assertNotNull("We should have found the WSDL here. " , wsdl);     
       
        SOAPService ss = new SOAPService(wsdl, SERVICE_NAME);
        Greeter port = ss.getSoapPort();
        updateAddressPort(port, WSDL_PORT);
       
        String resp;
        ClientProxy.getClient(port).getInInterceptors().add(new LoggingInInterceptor());
        ClientProxy.getClient(port).getOutInterceptors().add(new LoggingOutInterceptor());
        resp = port.sayHi();
        assertEquals("We should get the right response", "Bonjour", resp);       
       
        resp = port.greetMe("Willem");
        assertEquals("We should get the right response", "Hello Willem", resp);

        try {
            port.greetMe("fault");
            fail("Should have been a fault");
        } catch (GreetMeFault ex) {
            assertEquals("Some fault detail", ex.getFaultInfo().getGreetMeFaultDetail());
        }
       
        try {
            port.pingMe();
            fail("We expect exception here");
        } catch (PingMeFault ex) {           
            FaultDetail detail = ex.getFaultInfo();
            assertEquals("Wrong faultDetail major", detail.getMajor(), 2);
            assertEquals("Wrong faultDetail minor", detail.getMinor(), 1);            
View Full Code Here

Examples of org.apache.hello_world_soap_http_source.source.Greeter

        BusFactory.setDefaultBus(bus);
        URL wsdl = this.getClass().getResource("/wsdl_systest_databinding/source/hello_world.wsdl");
        assertNotNull("We should have found the WSDL here. " , wsdl);     
       
        SOAPService ss = new SOAPService(wsdl, SERVICE_NAME);
        Greeter port = ss.getSoapPort();
        updateAddressPort(port, WSDL_PORT);
       
        ClientProxy.getClient(port).getInInterceptors().add(new LoggingInInterceptor());
        ClientProxy.getClient(port).getOutInterceptors().add(new LoggingOutInterceptor());
       
        Document doc = XMLUtils.newDocument();
        doc.appendChild(doc.createElementNS("http://apache.org/hello_world_soap_http_source/source/types",
                                            "ns1:sayHi"));
        DOMSource ds = new DOMSource(doc);
        DOMSource resp = port.sayHi(ds);
        assertEquals("We should get the right response", "Bonjour",
                     DOMUtils.getContent(getElement(resp.getNode().getFirstChild().getFirstChild())));
       
        doc = XMLUtils.newDocument();
        Element el = doc.createElementNS("http://apache.org/hello_world_soap_http_source/source/types",
            "ns1:greetMe");
        Element el2 = doc.createElementNS("http://apache.org/hello_world_soap_http_source/source/types",
            "ns1:requestType");
        el2.appendChild(doc.createTextNode("Willem"));
        el.appendChild(el2);
        doc.appendChild(el);
        ds = new DOMSource(doc);
        resp = port.greetMe(ds);
        assertEquals("We should get the right response", "Hello Willem",
                     DOMUtils.getContent(DOMUtils.getFirstElement(getElement(resp.getNode()))));

        try {
            doc = XMLUtils.newDocument();
            el = doc.createElementNS("http://apache.org/hello_world_soap_http_source/source/types",
                "ns1:greetMe");
            el2 = doc.createElementNS("http://apache.org/hello_world_soap_http_source/source/types",
                "ns1:requestType");
            el2.appendChild(doc.createTextNode("fault"));
            el.appendChild(el2);
            doc.appendChild(el);
            ds = new DOMSource(doc);
            port.greetMe(ds);
            fail("Should have been a fault");
        } catch (GreetMeFault ex) {
            assertEquals("Some fault detail", DOMUtils.getContent(getElement(ex.getFaultInfo().getNode())));
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.