01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */package org.apache.geronimo.test;
19:
20: import java.io.StringWriter;
21: import java.io.StringReader;
22:
23: import javax.xml.soap.MessageFactory;
24: import javax.xml.soap.SOAPConnectionFactory;
25: import javax.xml.soap.SOAPFactory;
26: import javax.xml.soap.SOAPConstants;
27:
28: /**
29: * Performs basic tests using the SAAJ 1.3 API.
30: */
31: public class SAAJTest {
32:
33: MessageFactory messageFactory = null;
34: SOAPConnectionFactory soapConnectionFactory = null;
35: SOAPFactory soapFactory = null;
36:
37: public SAAJTest() throws Exception {
38: this .messageFactory = MessageFactory.newInstance();
39: this .soapConnectionFactory = SOAPConnectionFactory
40: .newInstance();
41: this .soapFactory = SOAPFactory.newInstance();
42: }
43:
44: public String getMessageFactoryImplementation() {
45: return this .messageFactory.getClass().getName();
46: }
47:
48: public String getSOAPFactoryImplementation() {
49: return this .soapFactory.getClass().getName();
50: }
51:
52: public String getSOAPConnectionFactoryImplementation() {
53: return this .soapConnectionFactory.getClass().getName();
54: }
55:
56: public void test() throws Exception {
57: // this will test SAAJMetaFactory (and 1.3 SAAJ API)
58: System.out.println(SOAPFactory
59: .newInstance(SOAPConstants.SOAP_1_1_PROTOCOL));
60: System.out.println(SOAPFactory
61: .newInstance(SOAPConstants.SOAP_1_2_PROTOCOL));
62: System.out.println(SOAPFactory
63: .newInstance(SOAPConstants.DYNAMIC_SOAP_PROTOCOL));
64:
65: System.out.println(MessageFactory
66: .newInstance(SOAPConstants.SOAP_1_1_PROTOCOL));
67: System.out.println(MessageFactory
68: .newInstance(SOAPConstants.SOAP_1_2_PROTOCOL));
69: System.out.println(MessageFactory
70: .newInstance(SOAPConstants.DYNAMIC_SOAP_PROTOCOL));
71:
72: System.out.println(this .soapConnectionFactory
73: .createConnection().getClass().getName());
74: System.out.println(this .messageFactory.createMessage()
75: .getClass().getName());
76: System.out.println(this .soapFactory.createName("foo")
77: .getClass().getName());
78: }
79:
80: }
|