Package javax.xml.bind

Examples of javax.xml.bind.JAXBContext


            LOG.fine("unmarshalling: element namespaceURI: " + data.getNamespaceURI() + "\n"
                     + "                       localName: " + data.getLocalName() + "\n"
                     + "             type: " + type  + "\n"
                     + "             type schema package name: " + packageName);           
        }
        JAXBContext context = null;
        Object obj = null;

        context = JAXBContext.newInstance(packageName, getClass().getClassLoader());
        Unmarshaller u = context.createUnmarshaller();
        if (doValidate) {
            u.setSchema(schema);
        }
        obj = u.unmarshal(data);
        if (obj instanceof JAXBElement<?>) {
View Full Code Here


                try {
                    Boolean outbound = (Boolean)ctx.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
                    if (outbound) {
                        LogicalMessage msg = ctx.getMessage();
                        assertNotNull("logical message is null", msg);
                        JAXBContext jaxbCtx = JAXBContext.newInstance(GreetMe.class.getPackage().getName());
                        PingResponse resp = new PingResponse();
                        resp.getHandlersInfo().add(clientHandlerMessage);

                        msg.setPayload(resp, jaxbCtx);
                    }
View Full Code Here

        super(name);
    }
   
    public void testRpcLit() throws Exception {
        Class<?> cls = GreeterRPCLit.class;
        JAXBContext ctx = JAXBEncoderDecoder.createJAXBContextForClass(cls);
       
        URL url = getClass().getResource("/wsdl/hello_world_rpc_lit.wsdl");
        assertNotNull("Could not find wsdl /wsdl/hello_world_rpc_lit.wsdl", url);
       
       
View Full Code Here

    }
    */
   
    public void testDocLitBare() throws Exception {
        Class<?> cls = PutLastTradedPricePortType.class;
        JAXBContext ctx = JAXBEncoderDecoder.createJAXBContextForClass(cls);
       
        URL url = getClass().getResource("/wsdl/doc_lit_bare.wsdl");
        assertNotNull("Could not find wsdl /wsdl/doc_lit_bare.wsdl", url);
       
       
View Full Code Here

   
    public static void addExtensions(ExtensionRegistry registry,
                                     Class<?> parentType,
                                     Class<? extends TExtensibilityElementImpl> cls) throws JAXBException {
       
        JAXBContext context = JAXBContext.newInstance(cls.getPackage().getName(), cls.getClassLoader());
        JAXBExtensionHelper helper = new JAXBExtensionHelper(context, cls);
       
        try {
            Class<?> objectFactory = Class.forName(cls.getPackage().getName() + ".ObjectFactory");
            Method methods[] = objectFactory.getDeclaredMethods();
View Full Code Here

        Class cls[] = new Class[] {
            ObjectFactory.class,
            org.objectweb.celtix.ws.addressing.wsdl.ObjectFactory.class
        };
        JAXBContext context = JAXBContext.newInstance(cls);
        Unmarshaller u = context.createUnmarshaller();

        EndpointReferenceType ref = (EndpointReferenceType)
                                    ((JAXBElement<?>)u.unmarshal(
                                        getClass().getResource("resources/reference2.xml"))).getValue();
View Full Code Here

        checkSource("TestSOAPInputMessage", obj);       
    }
   
    public void testJAXBObjectRead() throws Exception {
       
        JAXBContext jc = JAXBContext.newInstance("org.objectweb.hello_world_soap_http.types");
        TestDynamicDataBindingCallback callback = 
            new TestDynamicDataBindingCallback(jc, Mode.PAYLOAD);       
        SOAPBodyDataReader<SOAPBody> soapBodyDataReader = new SOAPBodyDataReader<SOAPBody>(callback);
        Object obj = soapBodyDataReader.read(0, soapMsg.getSOAPBody());
        assertNotNull(obj);
View Full Code Here

     
    }
   
    public void testJAXBObjectWrite() throws Exception {
       
        JAXBContext jc = JAXBContext.newInstance("org.objectweb.hello_world_soap_http.types")
        TestDynamicDataBindingCallback callback = 
            new TestDynamicDataBindingCallback(jc, Mode.PAYLOAD);       
        TestSOAPBodyDataWriter<SOAPBody> soapBodyDataWriter = new TestSOAPBodyDataWriter<SOAPBody>(callback);
        GreetMe greetMe = new GreetMe();
        greetMe.setRequestType("DIPLO");
View Full Code Here

   private static final Class[] CTX_CLASS = {ManagedConnectionFactoryDeploymentGroup.class};
  
   public static String marshalResourceAsString(ManagedConnectionFactoryDeploymentGroup group) throws Exception
   {
      Class[] classes = {ManagedConnectionFactoryDeploymentGroup.class, ManagedConnectionFactoryDeploymentMetaData.class, LocalDataSourceDeploymentMetaData.class, NonXADataSourceDeploymentMetaData.class, DataSourceDeploymentMetaData.class};     
      JAXBContext context = JAXBContext.newInstance(classes);     
      Marshaller m = context.createMarshaller();     
      JAXBElement element = new JAXBElement(new QName("", "datasources"), group.getClass(), group);
      StringWriter w = new StringWriter();
      m.marshal(element, w);     
      return w.toString();     
   }
View Full Code Here

      return w.toString();     
   }
  
   public static ManagedConnectionFactoryDeploymentGroup unmarshalSource(String content) throws Exception
   {
      JAXBContext ctx = JAXBContext.newInstance(CTX_CLASS);
      Unmarshaller um = ctx.createUnmarshaller();
      StringReader r = new StringReader(content);
      InputSource is = new InputSource(r);
      Source s = new SAXSource(is);
      JAXBElement<ManagedConnectionFactoryDeploymentGroup> elem = um.unmarshal(s, ManagedConnectionFactoryDeploymentGroup.class);
      ManagedConnectionFactoryDeploymentGroup group = elem.getValue();
View Full Code Here

TOP

Related Classes of javax.xml.bind.JAXBContext

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.