001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.apache.camel.example.camel.transport;
018
019 import java.util.logging.Logger;
020 import org.apache.hello_world_soap_http.Greeter;
021 import org.apache.hello_world_soap_http.PingMeFault;
022 import org.apache.hello_world_soap_http.types.FaultDetail;
023
024 @javax.jws.WebService(portName = "CamelPort", serviceName = "CamelService",
025 targetNamespace = "http://apache.org/hello_world_soap_http",
026 endpointInterface = "org.apache.hello_world_soap_http.Greeter")
027
028 public class GreeterImpl implements Greeter {
029
030 private static final Logger LOG =
031 Logger.getLogger(GreeterImpl.class.getPackage().getName());
032
033 private String suffix;
034
035 public GreeterImpl() {
036 }
037
038 public void setSuffix(String suffix) {
039 this.suffix = suffix;
040 }
041
042 /* (non-Javadoc)
043 * @see org.apache.hello_world_soap_http.Greeter#greetMe(java.lang.String)
044 */
045 public String greetMe(String me) {
046 LOG.info("Executing operation greetMe");
047 System.out.println("Executing operation greetMe");
048 System.out.println("Message received: " + me + "\n");
049 return "Hello " + me + " from " + suffix;
050 }
051
052 /* (non-Javadoc)
053 * @see org.apache.hello_world_soap_http.Greeter#greetMeOneWay(java.lang.String)
054 */
055 public void greetMeOneWay(String me) {
056 LOG.info("Executing operation greetMeOneWay");
057 System.out.println("Executing operation greetMeOneWay\n");
058 System.out.println("Hello there " + me);
059 }
060
061 /* (non-Javadoc)
062 * @see org.apache.hello_world_soap_http.Greeter#sayHi()
063 */
064 public String sayHi() {
065 LOG.info("Executing operation sayHi");
066 System.out.println("Executing operation sayHi\n");
067 return "Bonjour from " + suffix;
068 }
069
070 public void pingMe(String messageIn) throws PingMeFault {
071 FaultDetail faultDetail = new FaultDetail();
072 faultDetail.setMajor((short)2);
073 faultDetail.setMinor((short)1);
074 LOG.info("Executing operation pingMe, throwing PingMeFault exception, message = "
075 + messageIn);
076 System.out.println("Executing operation pingMe, throwing PingMeFault exception\n");
077 throw new PingMeFault("PingMeFault raised by server " + suffix, faultDetail);
078 }
079
080
081 }