Package org.apache.axis.encoding

Examples of org.apache.axis.encoding.SerializationContextImpl


        tb1.s1 = "john";
        TestBeanB tb2 = new TestBeanB();
        tb2.s1 = "john";
       
        CharArrayWriter caw = new CharArrayWriter();
        SerializationContextImpl sci = new SerializationContextImpl(caw);
        sci.setDoMultiRefs(true);
        sci.serialize(new QName("someLocalPart"), null, tb1);
        sci.serialize(new QName("someOtherLocalPart"), null, tb2);
       
        String s = caw.toString();
       
        // Cheap but fragile.
        int first = s.indexOf("#id0");
View Full Code Here


    super.setUp();

    // Initialisation of attribute used in the testMethods.
    stringWriter = new StringWriter();
    MessageContext msgContext = new MessageContext(new AxisServer());
    context = new SerializationContextImpl(stringWriter, msgContext);

    // Create a TypeMapping and register the specialized Type Mapping
    TypeMappingRegistry reg = context.getTypeMappingRegistry();
    TypeMapping tm = (TypeMapping) reg.createTypeMapping();
    tm.setSupportedEncodings(new String[] {Constants.URI_DEFAULT_SOAP_ENC});
View Full Code Here

        RPCElement body = new RPCElement("urn:myNamespace", "method1", new Object[]{ input });
        msg.addBodyElement(body);
       
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        OutputStreamWriter writer = new OutputStreamWriter(baos,"UTF-8");
        SerializationContext context = new SerializationContextImpl(writer, msgContext);
        msg.output(context);
        writer.flush();
       
        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
        DeserializationContext dser = new DeserializationContextImpl(
View Full Code Here

        return deployment;
    }

    public Document getDOMDocument() throws ConfigurationException {
        StringWriter writer = new StringWriter();
        SerializationContext context = new SerializationContextImpl(writer, null);
        context.setPretty(true);
        try {
            deployment.writeToContext(context);
        } catch (Exception e) {
            log.error(Messages.getMessage("exception00"), e);
        }
View Full Code Here

        RPCParam arg2 = new RPCParam("", "struct", data);
        RPCElement body = new RPCElement("urn:myNamespace", "method1", new Object[]{ arg1, arg2 });
        msg.addBodyElement(body);

        Writer stringWriter = new StringWriter();
        SerializationContext context = new SerializationContextImpl(stringWriter, msgContext);
        context.setDoMultiRefs(multiref);

        // Create a TypeMapping and register the specialized Type Mapping
        TypeMappingRegistry reg = context.getTypeMappingRegistry();
        TypeMapping tm = (TypeMapping) reg.createTypeMapping();
        tm.setSupportedEncodings(new String[] {Constants.URI_DEFAULT_SOAP_ENC});
        reg.register(Constants.URI_DEFAULT_SOAP_ENC, tm);

        QName dataQName = new QName("typeNS", "Data");
View Full Code Here

   
    public void testAttributeQNames() throws Exception {
        String NS1 = "urn:foo";
        MessageContext context = new MessageContext(new AxisServer());
        StringWriter writer = new StringWriter();
        SerializationContextImpl ser = new SerializationContextImpl(writer);
        ser.registerPrefixForURI("", NS1);
        ser.startElement(new QName(NS1, "e1"), null);
        String foo = ser.attributeQName2String(new QName(NS1, "attr"));
        AttributesImpl attrs = new AttributesImpl();
        attrs.addAttribute("a", "a", "a", "CDATA", foo);
        ser.startElement(new QName(NS1, "e2"), attrs);
        ser.endElement();
        foo = ser.attributeQName2String(new QName(NS1, "attr"));
        attrs = new AttributesImpl();
        attrs.addAttribute("a", "a", "a", "CDATA", foo);
        ser.startElement(new QName(NS1, "e3"), null);
        ser.endElement();
        ser.endElement();
        System.out.println(writer.getBuffer().toString());
    }
View Full Code Here

       
        RPCElement body = new RPCElement("urn:myNamespace", "method1", new Object[] { arg1 });
        msg.addBodyElement(body);
        body.setEncodingStyle(Constants.URI_LITERAL_ENC);
       
        SerializationContext context = new SerializationContextImpl(stringWriter, msgContext);
        msg.output(context);
       
        msgString = stringWriter.toString();
        assertTrue(msgString.indexOf("xmlns=\"\"")==-1);
    }   
View Full Code Here

       
        RPCElement body = new RPCElement("urn:myNamespace", "method1", new Object[] { arg1 });
        msg.addBodyElement(body);
        body.setEncodingStyle(Constants.URI_LITERAL_ENC);
       
        SerializationContext context = new SerializationContextImpl(stringWriter, msgContext);
        msg.output(context);
       
        msgString = stringWriter.toString();
       
        // Now reparse into DOM so we can check namespaces.
View Full Code Here

        if (context != null) {
            msgContext = context.getMessageContext();
        } else {
            msgContext = MessageContext.getCurrentContext();
        }
        serializeContext = new SerializationContextImpl(writer, msgContext);
        serializeContext.setSendDecl(false);
        output(serializeContext);
        writer.close();

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

       operationWrapper.appendChild(node);

       message.addBodyElement(new SOAPBodyElement(operationWrapper));
      
       StringWriter stringWriter = new StringWriter();
       SerializationContext context = new SerializationContextImpl(stringWriter, messageContext);
       context.setDoMultiRefs(false);
       message.output(context);
       stringWriter.close();
       String messageString = stringWriter.getBuffer().toString();
       logger.debug(messageString);
       Reader reader = new StringReader(messageString);
View Full Code Here

TOP

Related Classes of org.apache.axis.encoding.SerializationContextImpl

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.