Examples of JAXBContext


Examples of javax.xml.bind.JAXBContext

        assertNotNull(wsdl);

        SOAPService service = new SOAPService(wsdl, serviceName);
        assertNotNull(service);
       
        JAXBContext jc = JAXBContext.newInstance("org.objectweb.hello_world_soap_http.types")
        Dispatch<Object> disp = service.createDispatch(portName, jc, Service.Mode.PAYLOAD);
       
        String expected = "Hello Jeeves";  
        GreetMe greetMe = new GreetMe();
        greetMe.setRequestType("Jeeves")
View Full Code Here

Examples of javax.xml.bind.JAXBContext

                                    ? env.getHeader()
                                    : env.addHeader();
                discardMAPs(header);
                header.addNamespaceDeclaration(Names.WSA_NAMESPACE_PREFIX,
                                               maps.getNamespaceURI());
                JAXBContext jaxbContext =
                    VersionTransformer.getExposedJAXBContext(
                                                     maps.getNamespaceURI());
                Marshaller marshaller = jaxbContext.createMarshaller();
                marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);
                transformer.encodeAsExposed(maps.getNamespaceURI(),
                                            maps.getMessageID(),
                                            Names.WSA_MESSAGEID_NAME,
                                            AttributedURIType.class,
View Full Code Here

Examples of javax.xml.bind.JAXBContext

                    SOAPHeaderElement headerElement =
                        (SOAPHeaderElement)headerElements.next();
                    Name headerName = headerElement.getElementName();
                    String headerURI = headerName.getURI();
                    if (unmarshaller == null) {
                        JAXBContext jaxbContext =
                            VersionTransformer.getExposedJAXBContext(headerURI);
                        unmarshaller =
                            jaxbContext.createUnmarshaller();
                    }
                    if (transformer.isSupported(headerURI)) {
                        if (maps == null) {
                            maps = new AddressingPropertiesImpl();
                            maps.exposeAs(headerURI);
View Full Code Here

Examples of javax.xml.bind.JAXBContext

                InputSource inputSource = new InputSource(getSOAPBodyStream(doc));
                obj = new SAXSource(inputSource);
            } else if (StreamSource.class.isAssignableFrom(callback.getSupportedFormats()[0])) {    
                obj = new StreamSource(getSOAPBodyStream(doc));
            } else if (Object.class.isAssignableFrom(callback.getSupportedFormats()[0])) {          
                JAXBContext context = callback.getJAXBContext();
                Unmarshaller u = context.createUnmarshaller();
                return u.unmarshal(doc);                   
            }
        } catch (Exception se) {
            se.printStackTrace();
        }
View Full Code Here

Examples of javax.xml.bind.JAXBContext

   
    public void testGetHeaders() throws Exception {
        SOAPMessageContext smc = new SOAPMessageContextImpl(new GenericMessageContext());
        assertNotNull(smc);

        JAXBContext jaxbContext = JAXBContext.newInstance(TestHeader1.class.getPackage().getName());
        //Test 1 No Headers in SOAP Message
        setSOAPMessage(smc, "resources/TestIntDocLitTypeTestReq.xml");
        Object[] obj1 = smc.getHeaders(null, jaxbContext, true);
       
        assertEquals(0, obj1.length);
View Full Code Here

Examples of javax.xml.bind.JAXBContext

                StreamSource streamSource = (StreamSource)obj;
                Document doc = getDocBuilder().parse(streamSource.getInputStream());
                dest.addDocument(doc);
            } else if (Object.class.isAssignableFrom(obj.getClass())) {
               
                JAXBContext context = callback.getJAXBContext();
               
                Marshaller u = context.createMarshaller();
                u.setProperty(Marshaller.JAXB_ENCODING , "UTF-8");
                u.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
                u.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE)
               
                DOMResult domResult = new DOMResult();
View Full Code Here

Examples of javax.xml.bind.JAXBContext

   
    private JAXBEncoderDecoder() {       
    }
   
    public static JAXBContext createJAXBContextForClass(Class cls) throws JAXBException {
        JAXBContext context = contextMap.get(cls);
        if (context == null) {
            Set<Class> classes = new HashSet<Class>();
            getClassesForContext(cls, classes, cls.getClassLoader());
            classes.add(AttributedQNameType.class);
            classes.add(ServiceNameType.class);
View Full Code Here

Examples of javax.xml.bind.JAXBContext

        throw new IllegalArgumentException("Cannot get Class object from unknown Type");
    }
   
    public static String toString(Object obj) throws JAXBException {
        String name = obj.getClass().getPackage().getName();
        JAXBContext context = JAXBContext.newInstance(name);
        JAXBElement<Object> el = new JAXBElement<Object>(new QName("test"), Object.class, obj);
        Marshaller m = context.createMarshaller();
        StringWriter writer = new StringWriter();
        m.marshal(el, writer);

        return writer.toString();      
    }
View Full Code Here

Examples of javax.xml.bind.JAXBContext

    private RMAssertionType getRMAssertion(Element policyElement) {
        RMAssertionType rma = null;
        NodeList nl = policyElement.getElementsByTagNameNS(RMUtils.getRMConstants().getRMPolicyNamespaceURI(),
                                                           "RMAssertion");
        if (nl.getLength() > 0) {
            JAXBContext context = null;
            String packageName = RMUtils.getWSRMPolicyFactory().getClass().getPackage().getName();
            try {
                context = JAXBContext.newInstance(packageName, getClass().getClassLoader());
                Unmarshaller u = context.createUnmarshaller();
                Object obj = u.unmarshal(nl.item(0));
                if (obj instanceof JAXBElement<?>) {
                    JAXBElement<?> el = (JAXBElement<?>)obj;
                    obj = el.getValue();
                }
View Full Code Here

Examples of javax.xml.bind.JAXBContext

                //
                LogicalMessage msg = messageContext.getMessage();

                // check the payload, if its an AddNumbers request, we'll intervene
                //
                JAXBContext jaxbContext = JAXBContext.newInstance(AddNumbers.class);
                Object payload = msg.getPayload(jaxbContext);
               
                if (payload instanceof AddNumbers) {
                    AddNumbers req = (AddNumbers)payload;
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.