Package javax.xml.bind.util

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


                    }
                    updateOutputAction("Matches");
                    if (mapToOld) {
                        ret = mapToOld(doc, factory.createProbeMatches(pmt));
                    } else {
                        ret = new JAXBSource(context, factory.createProbeMatches(pmt));
                    }
                } else if (obj instanceof ResolveType) {
                    ResolveMatchesType rmt = handleResolve((ResolveType)obj);
                    if (rmt == null) {
                        return null;
                    }
                    updateOutputAction("Matches");
                    if (mapToOld) {
                        ret = mapToOld(doc, factory.createResolveMatches(rmt));
                    } else {
                        ret = new JAXBSource(context, factory.createResolveMatches(rmt));
                    }
                } else if (obj instanceof HelloType) {
                    //check if it's a DiscoveryProxy
                    HelloType h = (HelloType)obj;
                    if (h.getTypes().contains(WSDiscoveryClient.SERVICE_QNAME)
View Full Code Here

          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

        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

          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

        EmployeeEntity employee = new EmployeeEntity(id,
                EMPLOYEE_NAME, new Date());

        // 2. Define trafo source using JAXB source from Employee bean.
        JAXBContext jaxbContext = JAXBContext.newInstance(EmployeeEntity.class);
        JAXBSource employeeSource = new JAXBSource(jaxbContext, employee);

        // 3. Define XSLT stylesheet.
        StreamSource xslt = new StreamSource(
                new File(getClass().getResource("/employee.xslt").getFile()));
View Full Code Here

            JAXBContext context = ctxt;
            if (context == null) {
                context = defaultJaxbContext.getJAXBContext();
            }
            try {
                return new JAXBSource(context, o);
            } catch (JAXBException e) {
                throw new WebServiceException(e);
            }
        }
View Full Code Here

     * Note: Useful for Dispatch Client implementations
     * </p>
     */
    public Source toSource(final RequestSecurityToken rst) {
        try{
            return new JAXBSource(getMarshaller(), toJAXBElement(rst));
        }catch(JAXBException ex){
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0002_FAIL_MARSHAL_TOSOURCE(RST), ex);
            throw new RuntimeException(LogStringsMessages.WST_0002_FAIL_MARSHAL_TOSOURCE(RST), ex);
        }
View Full Code Here

     * </p>
     */
    public Source toSource(final RequestSecurityTokenResponse rstr) {
        //return new DOMSource(toElement(rstr));
        try{
            return new JAXBSource(getMarshaller(), toJAXBElement(rstr));
        }catch(JAXBException ex){
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0002_FAIL_MARSHAL_TOSOURCE("RSTR"), ex);
            throw new RuntimeException(LogStringsMessages.WST_0002_FAIL_MARSHAL_TOSOURCE("RSTR"), ex);
        }
View Full Code Here

     * Note: Useful for STS implementations which are JAXWS Providers
     * </p>
     */
    public  Source toSource(final RequestSecurityTokenResponseCollection rstrCollection) {
        try{
            return new JAXBSource(getMarshaller(), toJAXBElement(rstrCollection));
        }catch(JAXBException ex){
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0002_FAIL_MARSHAL_TOSOURCE(RSTRCollection), ex);
            throw new RuntimeException(LogStringsMessages.WST_0002_FAIL_MARSHAL_TOSOURCE(RSTRCollection), ex);
        }
View Full Code Here

TOP

Related Classes of javax.xml.bind.util.JAXBSource

Copyright © 2018 www.massapicom. 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.