KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis2 > soap > impl > llom > soap11 > SOAP11SerializerTest


1 package org.apache.axis2.soap.impl.llom.soap11;
2
3 import org.apache.axis2.om.OMOutput;
4 import org.apache.axis2.om.OMTestCase;
5 import org.apache.axis2.soap.SOAPEnvelope;
6 import org.apache.axis2.soap.impl.llom.builder.StAXSOAPModelBuilder;
7
8 import javax.xml.stream.XMLOutputFactory;
9 import javax.xml.stream.XMLStreamException;
10
11 /*
12  * Copyright 2004,2005 The Apache Software Foundation.
13  *
14  * Licensed under the Apache License, Version 2.0 (the "License");
15  * you may not use this file except in compliance with the License.
16  * You may obtain a copy of the License at
17  *
18  * http://www.apache.org/licenses/LICENSE-2.0
19  *
20  * Unless required by applicable law or agreed to in writing, software
21  * distributed under the License is distributed on an "AS IS" BASIS,
22  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23  * See the License for the specific language governing permissions and
24  * limitations under the License.
25  *
26  * author : Eran Chinthaka (chinthaka@apache.org)
27  */

28
29 public class SOAP11SerializerTest extends OMTestCase{
30     private OMOutput omOutput;
31
32     public SOAP11SerializerTest(String JavaDoc testName) {
33         super(testName);
34     }
35
36     protected StAXSOAPModelBuilder getOMBuilder(String JavaDoc fileName) throws Exception JavaDoc {
37         return super.getOMBuilder(fileName);
38     }
39
40     protected void setUp() throws Exception JavaDoc {
41         super.setUp();
42         soapEnvelope = (SOAPEnvelope) getOMBuilder("soap/soap11/soap11fault.xml").getDocumentElement();
43         omOutput = new OMOutput(XMLOutputFactory.newInstance().
44                 createXMLStreamWriter(System.out));
45     }
46
47     public void testSerialize(){
48         try {
49             soapEnvelope.serializeWithCache(omOutput);
50             omOutput.flush();
51
52             System.out.println("");
53             System.out.println("=======================");
54             soapEnvelope.serialize(omOutput);
55             omOutput.flush();
56         } catch (XMLStreamException e) {
57             e.printStackTrace();
58         }
59
60     }
61 }
62
Popular Tags