Examples of JAXBBlockFactory


Examples of org.apache.axis2.jaxws.message.factory.JAXBBlockFactory

        m.setStyle(Style.RPC);
        QName opQName = new QName("urn://sample", "op", "m");
        m.setOperationElement(opQName);
       
        // Get the BlockFactory
        JAXBBlockFactory bf = (JAXBBlockFactory)
            FactoryRegistry.getFactory(JAXBBlockFactory.class);
       
        // Create the JAXBContext
        JAXBBlockContext context = new JAXBBlockContext(StockPrice.class.getPackage().getName());
       
        // Create the JAX-B object
        ObjectFactory of = new ObjectFactory();
        StockPrice obj = of.createStockPrice();
        obj.setPrice("100");
       
        // Create the JAX-B Element
        QName paramQName = new QName("urn://sample", "param", "m");
        JAXBElement e = new JAXBElement(paramQName, StockPrice.class, obj);
       
        // Create a JAXBBlock using the param object as the content.  This simulates
        // what occurs on the outbound JAX-WS Proxy client
        Block block = bf.createFrom(e, context, null);
       
        // Add the block to the message as normal body content.
        m.setBodyBlock(block);
       
        // Check to see if the message is a fault.  The client/server will always call this method.
View Full Code Here

Examples of org.apache.axis2.jaxws.message.factory.JAXBBlockFactory

        m.setStyle(Style.RPC);
        QName opQName = new QName("urn://sample", "op", "m");
        m.setOperationElement(opQName);
       
        // Get the BlockFactory
        JAXBBlockFactory bf = (JAXBBlockFactory)
            FactoryRegistry.getFactory(JAXBBlockFactory.class);
       
        // Create the JAXBContext
        JAXBBlockContext context = new JAXBBlockContext(StockPrice.class.getPackage().getName());
       
        // Create the JAX-B object
        ObjectFactory of = new ObjectFactory();
        StockPrice obj = of.createStockPrice();
        obj.setPrice("100");
       
        // Create the JAX-B Element
        QName paramQName = new QName("urn://sample", "param", "m");
        JAXBElement e = new JAXBElement(paramQName, StockPrice.class, obj);
       
        // Create a JAXBBlock using the param object as the content.  This simulates
        // what occurs on the outbound JAX-WS Proxy client
        Block block = bf.createFrom(e, context, null);
       
        // Add the block to the message as normal body content.
        m.setBodyBlock(block);
       
        // Check to see if the message is a fault.  The client/server will always call this method.
View Full Code Here

Examples of org.apache.axis2.jaxws.message.factory.JAXBBlockFactory

       
        // Indicate that the message should be accessed as RPC
        m.setStyle(Style.RPC);
       
        // Get the BlockFactory
        JAXBBlockFactory bf = (JAXBBlockFactory)
            FactoryRegistry.getFactory(JAXBBlockFactory.class);
       
        // Create the JAXBContext instance that will be used
        // to deserialize the JAX-B object content in the message.
        JAXBBlockContext context = new JAXBBlockContext(StockPrice.class.getPackage().getName());
View Full Code Here

Examples of org.apache.axis2.jaxws.message.factory.JAXBBlockFactory

       
        // Indicate that the message should be accessed as RPC
        m.setStyle(Style.RPC);
       
        // Get the BlockFactory
        JAXBBlockFactory bf = (JAXBBlockFactory)
            FactoryRegistry.getFactory(JAXBBlockFactory.class);
       
        // Create the JAXBContext instance that will be used
        // to deserialize the JAX-B object content in the message.
        JAXBBlockContext context = new JAXBBlockContext(ConfigHeader.class.getPackage().getName());
View Full Code Here

Examples of org.apache.axis2.jaxws.message.factory.JAXBBlockFactory

            if (!marshalDesc.getAnnotationDesc(cls).hasXmlRootElement()) {
                object = new JAXBElement(wrapperQName, cls, object);
            }

            // Put the object into the message
            JAXBBlockFactory factory =
                    (JAXBBlockFactory)FactoryRegistry.getFactory(JAXBBlockFactory.class);
            Block block = factory.createFrom(object,
                                             new JAXBBlockContext(packages, packagesKey),
                                             wrapperQName)// The factory will get the qname from the value
            m.setBodyBlock(block);

            // Now place the headers in the message
View Full Code Here

Examples of org.apache.axis2.jaxws.message.factory.JAXBBlockFactory

     * normal Dispatch<JAXB> flow
     * @throws Exception
     */
    public void testJAXBOutflow() throws Exception {
        // Get the BlockFactory
        JAXBBlockFactory f = (JAXBBlockFactory)
        FactoryRegistry.getFactory(JAXBBlockFactory.class);

        // Create a jaxb object
        ObjectFactory factory = new ObjectFactory();
        EchoString jaxb = factory.createEchoString();
        jaxb.setInput("Hello World");
        JAXBBlockContext context = new JAXBBlockContext(EchoString.class.getPackage().getName());

        JAXBIntrospector jbi = JAXBUtils.getJAXBIntrospector(context.getJAXBContext());
        QName expectedQName = jbi.getElementName(jaxb);

        // Create a Block using the sample string as the content.  This simulates
        // what occurs on the outbound JAX-WS dispatch<JAXB> client
        Block block = f.createFrom(jaxb, context, null);

        // JAXB objects set the qname from their internal data
        assertTrue(block.isQNameAvailable());

        // Assume that we need to find the QName (perhaps to identify the operation and
View Full Code Here

Examples of org.apache.axis2.jaxws.message.factory.JAXBBlockFactory

     * slightly more complicated Dispatch<JAXB> flow
     * @throws Exception
     */
    public void testJAXBOutflow2() throws Exception {
        // Get the BlockFactory
        JAXBBlockFactory f = (JAXBBlockFactory)
        FactoryRegistry.getFactory(JAXBBlockFactory.class);

        // Create a jaxb object
        ObjectFactory factory = new ObjectFactory();
        EchoString jaxb = factory.createEchoString();
        jaxb.setInput("Hello World");
        JAXBBlockContext context = new JAXBBlockContext(EchoString.class.getPackage().getName());

        JAXBIntrospector jbi = JAXBUtils.getJAXBIntrospector(context.getJAXBContext());
        QName expectedQName = jbi.getElementName(jaxb);

        // Create a Block using the sample string as the content.  This simulates
        // what occurs with an outbound JAX-WS JAXB parameter
        Block block = f.createFrom(jaxb, context, expectedQName);

        // We did pass in a qname, so the following should return false
        assertTrue(block.isQNameAvailable());

        // Assume that we need to find the QName (perhaps to identify the operation and
View Full Code Here

Examples of org.apache.axis2.jaxws.message.factory.JAXBBlockFactory

     * normal Dispatch<JAXB> input flow
     * @throws Exception
     */
    public void testJAXBInflow() throws Exception {
        // Get the BlockFactory
        JAXBBlockFactory f = (JAXBBlockFactory)
        FactoryRegistry.getFactory(JAXBBlockFactory.class);

        // Create a jaxb object
        ObjectFactory factory = new ObjectFactory();
        EchoString jaxb = factory.createEchoString();
        jaxb.setInput("Hello World");
        JAXBBlockContext context = new JAXBBlockContext(EchoString.class.getPackage().getName());

        // On inbound, there will already be a XMLStreamReader (probably from OM)
        // which represents the message.  We will simulate this with inflow.
        StringWriter sw = new StringWriter();
        XMLStreamWriter writer = outputFactory.createXMLStreamWriter(sw);
        Marshaller marshaller = JAXBUtils.getJAXBMarshaller(context.getJAXBContext());
        marshaller.marshal(jaxb, writer);
        JAXBUtils.releaseJAXBMarshaller(context.getJAXBContext(), marshaller);
        writer.flush();
        sw.flush();
        StringReader sr = new StringReader(sw.toString());
        XMLStreamReader inflow = inputFactory.createXMLStreamReader(sr);

        // Create a Block from the inflow. 
        Block block = f.createFrom(inflow, context, null);

        // Assuming no handlers are installed, the next thing that will happen
        // is the proxy code will ask for the business object.
        Object bo = block.getBusinessObject(true);
        assertTrue(bo instanceof EchoString);
View Full Code Here

Examples of org.apache.axis2.jaxws.message.factory.JAXBBlockFactory

     * normal Dispatch<JAXB> input flow
     * @throws Exception
     */
    public void testJAXBInflow2() throws Exception {
        // Get the BlockFactory
        JAXBBlockFactory f = (JAXBBlockFactory)
        FactoryRegistry.getFactory(JAXBBlockFactory.class);

        // Create a jaxb object
        ObjectFactory factory = new ObjectFactory();
        EchoString jaxb = factory.createEchoString();
        jaxb.setInput("Hello World");
        JAXBBlockContext context = new JAXBBlockContext(EchoString.class.getPackage().getName());

        JAXBIntrospector jbi = JAXBUtils.getJAXBIntrospector(context.getJAXBContext());
        QName expectedQName = jbi.getElementName(jaxb);

        // On inbound, there will already be a XMLStreamReader (probably from OM)
        // which represents the message.  We will simulate this with inflow.
        StringWriter sw = new StringWriter();
        XMLStreamWriter writer = outputFactory.createXMLStreamWriter(sw);
        Marshaller marshaller = JAXBUtils.getJAXBMarshaller(context.getJAXBContext());
        marshaller.marshal(jaxb, writer);
        JAXBUtils.releaseJAXBMarshaller(context.getJAXBContext(), marshaller);
        writer.flush();
        sw.flush();
        StringReader sr = new StringReader(sw.toString());
        XMLStreamReader inflow = inputFactory.createXMLStreamReader(sr);

        // Create a Block from the inflow. 
        Block block = f.createFrom(inflow, context, null);

        // Assume that we need to find the QName (perhaps to identify the operation and
        // determine if handlers are installed).   This is not very perfomant since
        // it causes an underlying parse of the String...but we need to support this.
        QName qName = block.getQName();
View Full Code Here

Examples of org.apache.axis2.jaxws.message.factory.JAXBBlockFactory

     * normal Dispatch<JAXB> input flow
     * @throws Exception
     */
    public void testJAXBInflow3() throws Exception {
        // Get the BlockFactory
        JAXBBlockFactory f = (JAXBBlockFactory)
        FactoryRegistry.getFactory(JAXBBlockFactory.class);

        // Create a jaxb object
        ObjectFactory factory = new ObjectFactory();
        EchoString jaxb = factory.createEchoString();
        jaxb.setInput("Hello World");
        JAXBBlockContext context = new JAXBBlockContext(EchoString.class.getPackage().getName());

        JAXBIntrospector jbi = JAXBUtils.getJAXBIntrospector(context.getJAXBContext());
        QName expectedQName = jbi.getElementName(jaxb);

        // On inbound, there will already be a XMLStreamReader (probably from OM)
        // which represents the message.  We will simulate this with inflow.
        StringWriter sw = new StringWriter();
        XMLStreamWriter writer = outputFactory.createXMLStreamWriter(sw);
        Marshaller marshaller = JAXBUtils.getJAXBMarshaller(context.getJAXBContext());
        marshaller.marshal(jaxb, writer);
        JAXBUtils.releaseJAXBMarshaller(context.getJAXBContext(), marshaller);
        writer.flush();
        sw.flush();
        StringReader sr = new StringReader(sw.toString());
        XMLStreamReader inflow = inputFactory.createXMLStreamReader(sr);

        // Create a Block from the inflow. 
        Block block = f.createFrom(inflow, context, expectedQName);

        // We passed in a qname, so the following should return true
        assertTrue(block.isQNameAvailable());

        // Assume that we need to find the QName (perhaps to identify the operation and
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.