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.string;
20:
21: import org.apache.axis2.jaxws.TestLogger;
22:
23: import javax.xml.ws.Provider;
24: import javax.xml.ws.WebServiceException;
25: import javax.xml.ws.WebServiceProvider;
26:
27: @WebServiceProvider()
28: public class StringProvider implements Provider<String> {
29:
30: public String invoke(String text) {
31: TestLogger.logger
32: .debug("StringProvider invoke received the message ["
33: + text + "]");
34: if (text == null) {
35: return null;
36: } else if (text.contains("throwWebServiceException")) {
37: throw new WebServiceException("provider");
38: } else if (text.contains("<Code>")
39: && text.contains("SOAPFaultProviderTests")) {
40: // Make sure the received fault has the Reason string
41: if (text.contains("<Reason>")) {
42: return null;
43: } else {
44: throw new UnsupportedOperationException(
45: "Test failed: No <Reason> element");
46: }
47: } else if (text.contains("<faultcode>")
48: && text.contains("SOAPFaultProviderTests")) {
49: // Make sure the received fault has the Reason string
50: if (text.contains("<faultstring>")) {
51: return null;
52: } else {
53: throw new UnsupportedOperationException(
54: "Test failed: No <faultstring> element");
55: }
56: } else {
57: // Echo the input
58: return text;
59: }
60: }
61: }
|