Author: mmerz
Date: Wed Feb 23 17:36:33 2005
New Revision: 155119

URL: http://svn.apache.org/viewcvs?view=rev&rev=155119
Log:
Sample web services and web methods for @WebMethod and @WebParam.

Added:
    incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/webmethod/
    
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/webmethod/WebMethodWithAnnotationSample.jws
    
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/webmethod/WebMethodWithoutAnnotationSample.jws
    incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/webparam/
    
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/webparam/WebParamDocumentLiteralSample.jws
    
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/webparam/WebParamRpcLiteralSample.jws
Modified:
    
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/org/apache/beehive/sample/Address.java
    incubator/beehive/trunk/samples/wsm-samples/index.html

Modified: 
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/org/apache/beehive/sample/Address.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/org/apache/beehive/sample/Address.java?view=diff&r1=155118&r2=155119
==============================================================================
--- 
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/org/apache/beehive/sample/Address.java
 (original)
+++ 
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/org/apache/beehive/sample/Address.java
 Wed Feb 23 17:36:33 2005
@@ -17,13 +17,14 @@
  *
  * $Header:$
  */
+
 public class Address implements java.io.Serializable {
 
     private static final long serialVersionUID = 1L;
 
     private int streetNum;
-    private java.lang.String streetName;
-    private java.lang.String city;
+    private String streetName;
+    private String city;
     private StateType state;
     private int zip;
     private Phone phoneNumber;

Added: 
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/webmethod/WebMethodWithAnnotationSample.jws
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/webmethod/WebMethodWithAnnotationSample.jws?view=auto&rev=155119
==============================================================================
--- 
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/webmethod/WebMethodWithAnnotationSample.jws
 (added)
+++ 
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/webmethod/WebMethodWithAnnotationSample.jws
 Wed Feb 23 17:36:33 2005
@@ -0,0 +1,45 @@
+package web.webmethod;
+
+/*
+ * Copyright 2004, 2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$Factory
+ */
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+/**
+ * This web service does contain @WebMethod annotations; thus only methods that
+ * are annotated with @WebMethod are considered web methods.
+ */
[EMAIL PROTECTED]
+public class WebMethodWithAnnotationSample {
+
+    @WebMethod
+    public String sayHello(String name) {
+        return "Hello, " + name + "!";
+    }
+
+    @WebMethod(action="urn:sayHelloAction", operationName="sayHelloOperation")
+    public String sayHelloCustomized(String name) {
+        return "Hello, " + name + "!";
+    }
+
+    // not a web method
+    public String sayHello(String name, int i) {
+        return "Hello, " + name + "!";
+    }
+}
\ No newline at end of file

Added: 
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/webmethod/WebMethodWithoutAnnotationSample.jws
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/webmethod/WebMethodWithoutAnnotationSample.jws?view=auto&rev=155119
==============================================================================
--- 
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/webmethod/WebMethodWithoutAnnotationSample.jws
 (added)
+++ 
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/webmethod/WebMethodWithoutAnnotationSample.jws
 Wed Feb 23 17:36:33 2005
@@ -0,0 +1,38 @@
+package web.webmethod;
+
+/*
+ * Copyright 2004, 2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$Factory
+ */
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+/**
+ * This web service does not contain any @WebMethod annotations; thus all
+ * methods are automatically considered web methods.
+ */
[EMAIL PROTECTED]
+public class WebMethodWithoutAnnotationSample {
+
+    public String sayHello(String name) {
+        return "Hello " + name + "!";
+    }
+
+    public String sayHello(String name, int i) {
+        return "Hello " + name + "!";
+    }
+}
\ No newline at end of file

Added: 
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/webparam/WebParamDocumentLiteralSample.jws
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/webparam/WebParamDocumentLiteralSample.jws?view=auto&rev=155119
==============================================================================
--- 
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/webparam/WebParamDocumentLiteralSample.jws
 (added)
+++ 
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/webparam/WebParamDocumentLiteralSample.jws
 Wed Feb 23 17:36:33 2005
@@ -0,0 +1,103 @@
+package web.webparam;
+
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+import org.apache.beehive.sample.Address;
+import org.apache.beehive.sample.AddressHolder;
+import org.apache.beehive.sample.Phone;
+import org.apache.beehive.sample.StateType;
+
[EMAIL PROTECTED]
+public class WebParamDocumentLiteralSample {
+
+    /**
+     * This method shows the encoding of a parameter of simple type in the 
message body.
+     */
+    @WebMethod
+    public String sayHelloInBody(@WebParam(name="name-in") String name) {
+        return "Hello, " + name + "!";
+    }
+
+    /**
+     * This method shows the encoding of a parameter of simple type in the 
message header.
+     */
+    @WebMethod
+    public String sayHelloInHeader(@WebParam(name="name-in", header=true) 
String name) {
+        return "Hello, " + name + "!";
+    }
+    
+    /**
+     * This method shows the encoding of a parameter of complex type in the 
message body.
+     */
+    @WebMethod
+    public Phone getPhoneNumberInBody(@WebParam(mode=WebParam.Mode.IN) Address 
address) {
+        return address.getPhoneNumber();
+    }
+    
+    /**
+     * This method shows the encoding of a parameter of complex type in the 
message header.
+     */
+    @WebMethod
+    public Phone getPhoneNumberInHeader(@WebParam(mode=WebParam.Mode.IN, 
header=true) Address address) {
+        return address.getPhoneNumber();
+    }
+
+    /**
+     * This method shows the encoding of multiple simple and complex 
parameters in the message header.
+     */
+    @WebMethod
+    public Phone createPhoneNumberInHeader(
+            @WebParam(name="area-code", header=true) int areaCode, 
+            @WebParam(name="phone-in", header=true) Phone phone
+    ) {
+        return new Phone(areaCode, phone.getExchange(), phone.getNumber());
+    }
+
+    /**
+     * This method shows the encoding of multiple simple and complex 
parameters in both message body and header.
+     */
+    @WebMethod
+    public Phone createPhoneNumberInBodyHeader(
+            int areaCode,
+            @WebParam(name="phone-in", header=true) Phone phone
+    ) {
+        return new Phone(areaCode, phone.getExchange(), phone.getNumber());
+    }
+
+    /**
+     * This method shows the encoding of multiple simple and complex 
parameters in both message body and header.
+     */
+    @WebMethod
+    public int updatePhoneNumbers(
+            Phone phone,
+            @WebParam(name="address1", header=true, mode=WebParam.Mode.INOUT) 
AddressHolder addressHolder1,
+            @WebParam(name="address2", header=true, mode=WebParam.Mode.OUT) 
AddressHolder addressHolder2
+    ) {
+        Phone oldPhone = addressHolder1.value.getPhoneNumber();
+        addressHolder1.value.setPhoneNumber(phone);
+        addressHolder2.value = new Address(5960, "West Las Positas Blvd", 
"Pleasanton", new StateType("CA"), 94588, oldPhone);
+        
+        return 0;
+    }
+}
\ No newline at end of file

Added: 
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/webparam/WebParamRpcLiteralSample.jws
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/webparam/WebParamRpcLiteralSample.jws?view=auto&rev=155119
==============================================================================
--- 
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/webparam/WebParamRpcLiteralSample.jws
 (added)
+++ 
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/webparam/WebParamRpcLiteralSample.jws
 Wed Feb 23 17:36:33 2005
@@ -0,0 +1,104 @@
+package web.webparam;
+
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+import org.apache.beehive.sample.Address;
+import org.apache.beehive.sample.AddressHolder;
+import org.apache.beehive.sample.Phone;
+import org.apache.beehive.sample.StateType;
+
[EMAIL PROTECTED]
[EMAIL PROTECTED](style=SOAPBinding.Style.RPC, use=SOAPBinding.Use.LITERAL)     
   
+public class WebParamRpcLiteralSample {
+
+    /**
+     * This method shows the encoding of a parameter of simple type in the 
message body.
+     */
+    @WebMethod
+    public String sayHelloInBody(@WebParam(name="name-in") String name) {
+        return "Hello, " + name + "!";
+    }
+
+    /**
+     * This method shows the encoding of a parameter of simple type in the 
message header.
+     */
+    @WebMethod
+    public String sayHelloInHeader(@WebParam(name="name-in", header=true) 
String name) {
+        return "Hello, " + name + "!";
+    }
+    
+    /**
+     * This method shows the encoding of a parameter of complex type in the 
message body.
+     */
+    @WebMethod
+    public Phone getPhoneNumberInBody(@WebParam(mode=WebParam.Mode.IN) Address 
address) {
+        return address.getPhoneNumber();
+    }
+    
+    /**
+     * This method shows the encoding of a parameter of complex type in the 
message header.
+     */
+    @WebMethod
+    public Phone getPhoneNumberInHeader(@WebParam(mode=WebParam.Mode.IN, 
header=true) Address address) {
+        return address.getPhoneNumber();
+    }
+
+    /**
+     * This method shows the encoding of multiple simple and complex 
parameters in the message header.
+     */
+    @WebMethod
+    public Phone createPhoneNumberInHeader(
+            @WebParam(name="area-code", header=true) int areaCode, 
+            @WebParam(name="phone-in", header=true) Phone phone
+    ) {
+        return new Phone(areaCode, phone.getExchange(), phone.getNumber());
+    }
+
+    /**
+     * This method shows the encoding of multiple simple and complex 
parameters in both message body and header.
+     */
+    @WebMethod
+    public Phone createPhoneNumberInBodyHeader(
+            int areaCode,
+            @WebParam(name="phone-in", header=true) Phone phone
+    ) {
+        return new Phone(areaCode, phone.getExchange(), phone.getNumber());
+    }
+
+    /**
+     * This method shows the encoding of multiple simple and complex 
parameters in both message body and header.
+     */
+    @WebMethod
+    public int updatePhoneNumbers(
+            Phone phone,
+            @WebParam(name="address1", header=true, mode=WebParam.Mode.INOUT) 
AddressHolder addressHolder1,
+            @WebParam(name="address2", header=true, mode=WebParam.Mode.OUT) 
AddressHolder addressHolder2
+    ) {
+        Phone oldPhone = addressHolder1.value.getPhoneNumber();
+        addressHolder1.value.setPhoneNumber(phone);
+        addressHolder2.value = new Address(5960, "West Las Positas Blvd", 
"Pleasanton", new StateType("CA"), 94588, oldPhone);
+        
+        return 0;
+    }
+}
\ No newline at end of file

Modified: incubator/beehive/trunk/samples/wsm-samples/index.html
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/wsm-samples/index.html?view=diff&r1=155118&r2=155119
==============================================================================
--- incubator/beehive/trunk/samples/wsm-samples/index.html (original)
+++ incubator/beehive/trunk/samples/wsm-samples/index.html Wed Feb 23 17:36:33 
2005
@@ -29,6 +29,12 @@
     <li>
         <a 
href="web/soapmessagehandlers/SoapMessageHandlersSample.jws?wsdl">SOAPMessageHandlersSample</a>
     </li>
+    <li>
+        <a 
href="web/webmethod/WebMethodWithAnnotationSample.jws?wsdl">WebMethodWithAnnotationSample</a>
+    </li>
+    <li>
+        <a 
href="web/webmethod/WebMethodWithoutAnnotationSample.jws?wsdl">WebMethodWithoutAnnotationSample</a>
+    </li>
 </ul>
 <hr>
 <p>
@@ -60,6 +66,12 @@
     </li>
     <li>
         <a 
href="web/soapmessagehandlers/SoapMessageHandlersSample.jws?method=sayHello&name=test">SoapMessageHandlersSample.sayHello("test")</a>
+    </li>
+    <li>
+        <a 
href="web/webmethod/WebMethodWithAnnotationSample.jws?method=sayHello&name=test">WebMethodWithAnnotationSample.sayHello("test")</a>
+    </li>
+    <li>
+        <a 
href="web/webmethod/WebmethodWithoutAnnotationSample.jws?method=sayHello&name=test">WebMethodWithoutAnnotationSample.sayHello("test")</a>
     </li>
 </ul>
 </p>


Reply via email to