Examples of JAXBSource


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

                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

                    }
                    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

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);

            assertNotNull("dispatch invoke returned null", response);
            //Print the response as string.
            StringWriter writer = new StringWriter();
            Transformer t = TransformerFactory.newInstance().newTransformer();
            Result result = new StreamResult(writer);
            t.transform(response, result);

            TestLogger.logger.debug("Response On Client: \n" + writer.getBuffer().toString());
           
            // Invoke a second time
            jbSrc = new JAXBSource(ctx.createMarshaller(), invokeObj);
            // Invoke the Dispatch
            TestLogger.logger.debug(">> Invoking sync Dispatch");
            //Invoke Server endpoint and read response
            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

                                  "{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

                    }
                    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

Examples of javax.xml.bind.util.JAXBSource

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

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

    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.