Examples of JAXBSource


Examples of javax.xml.bind.util.JAXBSource

    protected <T> T marshall(Class<T> type, Object value) throws JAXBException {
        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);
            try {
                return parentTypeConverter.convertTo(type, source);
            } catch (NoTypeConversionAvailableException e) {
                // lets try a stream
                StringWriter buffer = new StringWriter();
View Full Code Here

Examples of javax.xml.bind.util.JAXBSource

         JAXBElement jbe = unmarshaller.unmarshal(request, UserType.class);
         UserType user = (UserType)jbe.getValue();

         log.info("[string=" + user.getString() + ",qname=" + user.getQname() + "]");

         return new JAXBSource(jc, user);
      }
      catch (RuntimeException rte)
      {
         throw rte;
      }
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

    protected <T> T marshall(Class<T> type, Object value) throws JAXBException {
        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);
            try {
                return parentTypeConverter.convertTo(type, source);
            } catch (NoTypeConversionAvailableException e) {
                // lets try a stream
                StringWriter buffer = new StringWriter();
View Full Code Here

Examples of javax.xml.bind.util.JAXBSource

                                  "{http://schemas.xmlsoap.org/ws/2005/04/discovery}*");
                        InTransformReader reader = new InTransformReader(domReader, inMap , null, false);
                        doc = StaxUtils.read(reader);
                        return new DOMSource(doc);
                    }
                    return new JAXBSource(context, factory.createProbeMatches(pmt));
                } else if (obj instanceof HelloType) {
                    //check if it's a DiscoveryProxy
                    HelloType h = (HelloType)obj;
                    if (h.getTypes().contains(WSDiscoveryClient.SERVICE_QNAME)
                        || h.getTypes().contains(new QName("", WSDiscoveryClient.SERVICE_QNAME.getLocalPart()))) {
View Full Code Here

Examples of javax.xml.bind.util.JAXBSource

    }

    @Converter
    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

    protected <T> T marshall(Class<T> type, Object value) throws JAXBException {
        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);
            T answer = parentTypeConverter.convertTo(type, source);
            if (answer == null) {
                // lets try a stream
                StringWriter buffer = new StringWriter();
                Marshaller marshaller = context.createMarshaller();
View Full Code Here

Examples of javax.xml.bind.util.JAXBSource

         JAXBElement jbe = unmarshaller.unmarshal(request, UserType.class);
         UserType user = (UserType)jbe.getValue();

         log.info("[string=" + user.getString() + ",qname=" + user.getQname() + "]");

         return new JAXBSource(jc, user);
      }
      catch (RuntimeException rte)
      {
         throw rte;
      }
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
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.