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: */
19: package org.apache.axis2.jaxws.provider;
20:
21: import org.apache.axis2.jaxws.TestLogger;
22:
23: import java.io.File;
24: import java.io.FileInputStream;
25: import java.io.InputStream;
26:
27: import javax.xml.namespace.QName;
28: import javax.xml.transform.Source;
29: import javax.xml.transform.stream.StreamSource;
30: import javax.xml.ws.Dispatch;
31: import javax.xml.ws.Service;
32:
33: public class SourceMessageProviderTests extends ProviderTestCase {
34:
35: private String endpointUrl = "http://localhost:8080/axis2/services/SourceMessageProviderService";
36: private QName serviceName = new QName("http://ws.apache.org/axis2",
37: "SourceMessageProviderService");
38: private String xmlDir = "xml";
39:
40: protected void setUp() throws Exception {
41: super .setUp();
42: }
43:
44: protected void tearDown() throws Exception {
45: super .tearDown();
46: }
47:
48: public SourceMessageProviderTests(String name) {
49: super (name);
50: }
51:
52: public void testProviderSource() {
53: try {
54: String resourceDir = new File(providerResourceDir, xmlDir)
55: .getAbsolutePath();
56: String fileName = resourceDir + File.separator + "web.xml";
57:
58: File file = new File(fileName);
59: InputStream inputStream = new FileInputStream(file);
60: StreamSource xmlStreamSource = new StreamSource(inputStream);
61:
62: Service svc = Service.create(serviceName);
63: svc.addPort(portName, null, endpointUrl);
64: Dispatch<Source> dispatch = svc.createDispatch(portName,
65: Source.class, null);
66: TestLogger.logger
67: .debug(">> Invoking SourceMessageProviderDispatch");
68: Source response = dispatch.invoke(xmlStreamSource);
69:
70: TestLogger.logger.debug(">> Response ["
71: + response.toString() + "]");
72:
73: } catch (Exception e) {
74: e.printStackTrace();
75: fail("Caught exception " + e);
76: }
77:
78: }
79: }
|