Examples of JAXBSource


Examples of javax.xml.bind.util.JAXBSource

        order.setPrice(2.4);
    }
   
    @Test
    public void testToSourceUsingExplicitJaxbConverter() throws JAXBException {       
        JAXBSource source = jaxbConverter.toSource(order);
        assertNotNull("The result should be not be null", source);
        source = jaxbConverter.toSource("test");
        assertNull("The result should be null", source);
    }
View Full Code Here

Examples of javax.xml.bind.util.JAXBSource

            throw new IllegalArgumentException("Cannot convert from null value to JAXBSource");
        }
        // just need to check if the Object class has the XmlRootElement
        if (value.getClass().getAnnotation(XmlRootElement.class) != null) {
            JAXBContext context = getJaxbContext(value);
            return new JAXBSource(context, value);
        } else {
            return null;
        }
    }
View Full Code Here

Examples of javax.xml.bind.util.JAXBSource

          ObjectFactory factory = new ObjectFactory();
          Invoke invokeObj = factory.createInvoke();
          invokeObj.setInvokeStr("Some Request");
          JAXBContext ctx = JAXBContext.newInstance("org.test.dispatch.jaxbsource");
        
          JAXBSource jbSrc = new JAXBSource(ctx.createMarshaller(), invokeObj);
          // Invoke the Dispatch
            TestLogger.logger.debug(">> Invoking sync Dispatch");
          //Invoke Server endpoint and read response
          Source response = dispatch.invoke(jbSrc);
        
View Full Code Here

Examples of javax.xml.bind.util.JAXBSource

          ObjectFactory factory = new ObjectFactory();
          EchoString jaxb = factory.createEchoString();
          jaxb.setInput("Hello World");
          JAXBContext context = JAXBContext.newInstance("test");
        
          JAXBSource src = new JAXBSource(context.createMarshaller(), jaxb);
          BlockFactory f = (SourceBlockFactory)
        FactoryRegistry.getFactory(SourceBlockFactory.class);
         
          Block block =f.createFrom(src, null, null);
         
View Full Code Here

Examples of javax.xml.bind.util.JAXBSource

        JAXBContext context = JAXBContext.newInstance("test");
       
        Unmarshaller u = context.createUnmarshaller();
        ByteArrayInputStream inputStream = new ByteArrayInputStream(echoSample.getBytes());
        EchoString jaxb = (EchoString)u.unmarshal(inputStream);
        JAXBSource src = new JAXBSource(context.createMarshaller(), jaxb);
       
        // Create a Block using the sample string as the content.  This simulates
        // what occurs on the outbound JAX-WS dispatch<Source> client
        Block block = f.createFrom(src, null, null);
       
View Full Code Here

Examples of javax.xml.bind.util.JAXBSource

    public JAXBSource toSource(@HasAnnotation(XmlRootElement.class)Object value) throws JAXBException {
        if (value == null) {
            throw new IllegalArgumentException("Cannot convert from null value to JAXBSource");
        }
        JAXBContext context = getJaxbContext(value);
        return new JAXBSource(context, value);
    }
View Full Code Here

Examples of javax.xml.bind.util.JAXBSource

        T answer = null;
        if (parentTypeConverter != null) {
            // lets convert the object to a JAXB source and try convert that to
            // the required source
            JAXBContext context = createContext(value.getClass());
            JAXBSource source = new JAXBSource(context, value);

            answer = parentTypeConverter.convertTo(type, source);
            if (answer == null) {
                // lets try a stream
                StringWriter buffer = new StringWriter();
View Full Code Here

Examples of javax.xml.bind.util.JAXBSource

        this.jaxbConverter = jaxbConverter;
    }

    public static JAXBSource toSource(@HasAnnotation(XmlRootElement.class)Object value) throws JAXBException {
        JAXBContext context = createJaxbContext(value);
        return new JAXBSource(context, value);
    }
View Full Code Here

Examples of javax.xml.bind.util.JAXBSource

                throw new Exception("Error in implementation class.");
            }
            if (obj instanceof RequestSecurityTokenResponseCollectionType) {
                RequestSecurityTokenResponseCollectionType tokenResponse =
                    (RequestSecurityTokenResponseCollectionType)obj;
                response = new JAXBSource(jaxbContext,
                                          new ObjectFactory()
                                          .createRequestSecurityTokenResponseCollection(tokenResponse));
            } else {
                RequestSecurityTokenResponseType tokenResponse =
                    (RequestSecurityTokenResponseType)obj;
                response = new JAXBSource(jaxbContext,
                                          new ObjectFactory()
                                          .createRequestSecurityTokenResponse(tokenResponse));
            }

        } catch (InvocationTargetException ex) {
View Full Code Here

Examples of javax.xml.bind.util.JAXBSource

    public JAXBSource toSource(@HasAnnotation(XmlRootElement.class)Object value) throws JAXBException {
        if (value == null) {
            throw new IllegalArgumentException("Cannot convert from null value to JAXBSource");
        }
        JAXBContext context = getJaxbContext(value);
        return new JAXBSource(context, value);
    }
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.