Examples of GreetMe


Examples of org.apache.hello_world_soap_http.types.GreetMe

        assertTrue(xmlResult.contains("Gallia:string2"));
    }
   
    @Test
    public void testMarshallIntoStax() throws Exception {
        GreetMe obj = new GreetMe();
        obj.setRequestType("Hello");
        QName elName = new QName(wrapperAnnotation.targetNamespace(),
                                 wrapperAnnotation.localName());
        MessagePartInfo part = new MessagePartInfo(elName, null);
        part.setElement(true);
        part.setElementQName(elName);
               
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        XMLOutputFactory opFactory = XMLOutputFactory.newInstance();
        opFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
        XMLEventWriter writer = opFactory.createXMLEventWriter(baos);

        //STARTDOCUMENT/ENDDOCUMENT is not required
        //writer.add(eFactory.createStartDocument("utf-8", "1.0"));       
        JAXBEncoderDecoder.marshall(context.createMarshaller(), obj, part, writer);
        //writer.add(eFactory.createEndDocument());
        writer.flush();
        writer.close();
       
        //System.out.println(baos.toString());
       
        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
        XMLInputFactory ipFactory = XMLInputFactory.newInstance();
        XMLEventReader reader = ipFactory.createXMLEventReader(bais);
       
        Unmarshaller um = context.createUnmarshaller();       
        Object val = um.unmarshal(reader, GreetMe.class);
        assertTrue(val instanceof JAXBElement);
        val = ((JAXBElement<?>)val).getValue();
        assertTrue(val instanceof GreetMe);
        assertEquals(obj.getRequestType(),
                     ((GreetMe)val).getRequestType());
    }
View Full Code Here

Examples of org.apache.hello_world_soap_http.types.GreetMe

        assertEquals("Hello Test", ((GreetMe)obj).getRequestType());
    }

    @Test
    public void testMarshallWithoutQNameInfo() throws Exception {
        GreetMe obj = new GreetMe();
        obj.setRequestType("Hello");
       
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        XMLOutputFactory opFactory = XMLOutputFactory.newInstance();
        opFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
        XMLEventWriter writer = opFactory.createXMLEventWriter(baos);

        //STARTDOCUMENT/ENDDOCUMENT is not required
        //writer.add(eFactory.createStartDocument("utf-8", "1.0"));       
        JAXBEncoderDecoder.marshall(context.createMarshaller(), obj, null, writer);
        //writer.add(eFactory.createEndDocument());
        writer.flush();
        writer.close();
       
        //System.out.println(baos.toString());
       
        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
        XMLInputFactory ipFactory = XMLInputFactory.newInstance();
        XMLEventReader reader = ipFactory.createXMLEventReader(bais);
       
        Unmarshaller um = context.createUnmarshaller();       
        Object val = um.unmarshal(reader, GreetMe.class);
        assertTrue(val instanceof JAXBElement);
        val = ((JAXBElement<?>)val).getValue();
        assertTrue(val instanceof GreetMe);
        assertEquals(obj.getRequestType(),
                     ((GreetMe)val).getRequestType());
    }
View Full Code Here

Examples of org.apache.hello_world_soap_http.types.GreetMe

                                     "http://localhost:"
                                     + greeterPort
                                     + "/SOAPDispatchService/SoapDispatchPort");

        String expected = "Hello Jeeves";
        GreetMe greetMe = new GreetMe();
        greetMe.setRequestType("Jeeves");

        Object response = disp.invoke(greetMe);
        assertNotNull(response);
        String responseValue = ((GreetMeResponse)response).getResponseType();
        assertTrue("Expected string, " + expected, expected.equals(responseValue));
View Full Code Here

Examples of org.apache.hello_world_soap_http.types.GreetMe

                                     "http://localhost:"
                                     + greeterPort
                                     + "/SOAPDispatchService/SoapDispatchPort");

        String expected = "Hello Jeeves";
        GreetMe greetMe = new GreetMe();
        greetMe.setRequestType("Jeeves");

        Object response = disp.invoke(greetMe);
        assertNotNull(response);
        String responseValue = ((GreetMeResponse)response).getResponseType();
        assertTrue("Expected string, " + expected, expected.equals(responseValue));
View Full Code Here

Examples of org.apache.hello_world_xml_http.wrapped.types.GreetMe

                        "http://localhost:"
                        + port
                        + "/XMLService/XMLDispatchPort");
       
       
        GreetMe gm = new GreetMe();
        gm.setRequestType("CXF");
        JAXBContext ctx = JAXBContext.newInstance(ObjectFactory.class);
        Dispatch<Object> disp = service.createDispatch(PORT_NAME, ctx, Service.Mode.MESSAGE);
        GreetMeResponse resp = (GreetMeResponse)disp.invoke(gm);
        assertNotNull(resp);
        assertEquals("Hello CXF", resp.getResponseType());
View Full Code Here

Examples of org.apache.hello_world_xml_http.wrapped.types.GreetMe

            assertEquals("tli", dxr.getText());
        }
    }

    public void testWrapOut() throws Exception {
        GreetMe greetMe = new GreetMe();
        greetMe.setRequestType("tli");
        params.add(greetMe);
        common("/wsdl/hello_world_xml_wrapped.wsdl", new QName(wrapNs, "XMLPort"), GreetMe.class);

        BindingInfo bi = super.serviceInfo.getBinding(new QName(wrapNs, "Greeter_XMLBinding"));
        BindingOperationInfo boi = bi.getOperation(new QName(wrapNs, "greetMe"));
        xmlMessage.getExchange().put(BindingOperationInfo.class, boi);

        out.handleMessage(xmlMessage);

        XMLStreamReader reader = getXMLReader();
        DepthXMLStreamReader dxr = new DepthXMLStreamReader(reader);
        StaxUtils.nextEvent(dxr);
        StaxUtils.toNextElement(dxr);
        assertEquals(wrapGreetMeQName.getNamespaceURI(), dxr.getNamespaceURI());
        assertEquals(wrapGreetMeQName.getLocalPart(), dxr.getLocalName());
        StaxUtils.toNextElement(dxr);
        StaxUtils.toNextText(dxr);
        assertEquals(greetMe.getRequestType(), dxr.getText());
    }
View Full Code Here

Examples of org.apache.hello_world_xml_http.wrapped.types.GreetMe

        assertNotNull(service);
        service.addPort(portName, "http://cxf.apache.org/bindings/xformat",
                        "http://localhost:9007/XMLService/XMLDispatchPort");
       
       
        GreetMe gm = new GreetMe();
        gm.setRequestType("CXF");
        JAXBContext ctx = JAXBContext.newInstance(ObjectFactory.class);
        Dispatch<Object> disp = service.createDispatch(portName, ctx, Service.Mode.MESSAGE);
        GreetMeResponse resp = (GreetMeResponse)disp.invoke(gm);
        assertNotNull(resp);
        assertEquals("Hello CXF", resp.getResponseType());
View Full Code Here

Examples of org.objectweb.hello_world_soap_http.types.GreetMe

       
        JAXBContext jc = JAXBContext.newInstance("org.objectweb.hello_world_soap_http.types")
        Dispatch<Object> disp = service.createDispatch(portName, jc, Service.Mode.PAYLOAD);
       
        String expected = "Hello Jeeves";  
        GreetMe greetMe = new GreetMe();
        greetMe.setRequestType("Jeeves")
       
        Object response = disp.invoke(greetMe);
        assertNotNull(response);
        String responseValue = ((GreetMeResponse)response).getResponseType();   
        assertTrue("Expected string, " + expected , expected.equals(responseValue));
View Full Code Here

Examples of org.objectweb.hello_world_soap_http.types.GreetMe

            fail("Should have thrown a ProtocolException");
        } catch (ProtocolException ex) {
            //expected - not a valid object
        }

        GreetMe obj = new GreetMe();
        obj.setRequestType("Hello");
        QName elName = new QName(wrapperAnnotation.targetNamespace(),
                                 wrapperAnnotation.localName());
        JAXBEncoderDecoder.marshall(context, null, obj, elName, elNode);
        node = elNode.getLastChild();
        //The XML Tree Looks like
View Full Code Here

Examples of org.objectweb.hello_world_soap_http.types.GreetMe

        ctx.put(ObjectMessageContext.MESSAGE_INPUT, false);
        ctx.put(MessageContext.MESSAGE_OUTBOUND_PROPERTY, true);

        final String testArg = "test argument set";
        GreetMe wrapper = new GreetMe();
        wrapper.setRequestType(testArg);
        lm.setPayload(wrapper, jaxbCtx);
       
        GreetMe payload = (GreetMe)lm.getPayload(jaxbCtx);
        assertEquals(wrapper.getRequestType(), payload.getRequestType());
       
        Object[] args = ctx.getMessageObjects();

        assertNotNull(args);
        assertEquals(1, args.length);
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.