Author: mmerz
Date: Wed Apr 27 11:42:46 2005
New Revision: 165026
URL: http://svn.apache.org/viewcvs?rev=165026&view=rev
Log:
Added RPC-encoded sample
Contributor: Daryoush Mehrtash
Added:
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/complex/RpcEncodedSample.jws
Modified:
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/complex/RpcLiteralSample.jws
incubator/beehive/trunk/samples/wsm-samples/soapbinding.html
Added:
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/complex/RpcEncodedSample.jws
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/complex/RpcEncodedSample.jws?rev=165026&view=auto
==============================================================================
---
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/complex/RpcEncodedSample.jws
(added)
+++
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/complex/RpcEncodedSample.jws
Wed Apr 27 11:42:46 2005
@@ -0,0 +1,133 @@
+package web.complex;
+
+/*
+ * 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.WebParam;
+import javax.jws.WebResult;
+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.AddressException;
+import org.apache.beehive.sample.Phone;
+import org.apache.beehive.sample.StateType;
+
+/**
+ * This class illustrates the use of complex types with style/use
"RPC/ENCODED".
+ */
[EMAIL PROTECTED](
targetNamespace="http://beehive.apache.org/web/webservice/rpc-examples")
+
[EMAIL PROTECTED](
+ style=SOAPBinding.Style.RPC,
+ use=SOAPBinding.Use.ENCODED
+)
+public class RpcEncodedSample {
+
+ /**
+ * Returns a complex (address) object that was passed in as IN parameter
in the message body.
+ * @param address The complex object to be returned.
+ * @return The complex object that was passed in as an IN parameter.
+ */
+ @WebMethod
+ @WebResult(name="ReturnAddressFromBodyResult")
+ public Address returnAddressFromBody(@WebParam(name="in_param_body",
mode=WebParam.Mode.IN) Address address) {
+ return address;
+ }
+
+ /**
+ * Returns a complex (address) object that was passed in as IN parameter
in the message header.
+ * @param object The complex object to be modified.
+ * @return The complex object that was passed in as an IN parameter.
+ */
+ @WebMethod
+ @WebResult(name="ReturnAddressFromHeaderResult")
+ public Address returnAddressFromHeader(@WebParam(name="in_param_header",
header=true, mode=WebParam.Mode.IN) Address address) {
+ return address;
+ }
+
+ /**
+ * Creates a new complex (address) object and returns that object as an
OUT parameter that is encoded in the message body.
+ * @param addressHolder The holder of the complex object to be returned.
+ * @return An operational result (always 0).
+ */
+ @WebMethod
+ @WebResult(name="ReturnCreateAddressInBodyResult")
+ public int createAddressInBody(@WebParam(name="out_param_body",
mode=WebParam.Mode.OUT) AddressHolder addressHolder) {
+ StateType state = new StateType("WA");
+ Phone phoneNumber = new Phone(425, "555", "1234");
+ Address address = new Address(10230, "NE Points Drive", "Kirkland",
state, 98008, phoneNumber);
+ addressHolder.value = address;
+ return 0;
+ }
+
+ /**
+ * Creates a new complex (address) object and returns that object as an
OUT parameter that is encoded in the message header.
+ * @param addressHolder The holder of the complex object to be returned.
+ * @return An operational result (always 0).
+ */
+ @WebMethod
+ @WebResult(name="ReturnCreateAddressInHeaderResult")
+ public int createAddressInHeader(@WebParam(name="out_param_header",
header=true, mode=WebParam.Mode.OUT) AddressHolder addressHolder) {
+ StateType state = new StateType("CA");
+ Phone phoneNumber = new Phone(714, "555", "1234");
+ Address address = new Address(1, "some street", "Los Angeles", state,
90210, phoneNumber);
+ addressHolder.value = address;
+ return 0;
+ }
+
+ /**
+ * Modifies a complex (address) INOUT parameter that is encoded in the
message body.
+ * @param addressHolder The object to be modified.
+ * @return An operational result (always 0).
+ */
+ @WebMethod
+ @WebResult(name="ChangeAddressInBodyResult")
+ public int changeAddressInBody(@WebParam(name="inout_param_body",
mode=WebParam.Mode.INOUT) AddressHolder addressHolder) {
+ Address address = addressHolder.value;
+ address.setZip(address.getZip() + 1);
+ return 0;
+ }
+
+ /**
+ * Modifies a complex (address) INOUT parameter that is encoded in the
message header.
+ * @param addressHolder The object to be modified.
+ * @return An operational result (always 0).
+ */
+ @WebMethod
+ @WebResult(name="ChangeAddressInHeaderResult")
+ public int changeAddressInHeader(@WebParam(name="inout_param_header",
header=true, mode=WebParam.Mode.INOUT) AddressHolder addressHolder) {
+ Address address = addressHolder.value;
+ address.setZip(address.getZip() + 1);
+ return 0;
+ }
+
+ /**
+ * Throws an AddressException.
+ * @param value Ignored (only printed in message).
+ * @return An operational result (never returned).
+ * @throws AddressException Always thrown.
+ */
+ @WebMethod
+ @WebResult(name="ThrowAddressExceptionResult")
+ public int throwAddressException(@WebParam(name="in_param") int value)
throws AddressException {
+ throw new AddressException("This is a sample message
for:\n\tAddressException; input value=\"" + value + "\"");
+ }
+}
\ No newline at end of file
Modified:
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/complex/RpcLiteralSample.jws
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/complex/RpcLiteralSample.jws?rev=165026&r1=165025&r2=165026&view=diff
==============================================================================
---
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/complex/RpcLiteralSample.jws
(original)
+++
incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/complex/RpcLiteralSample.jws
Wed Apr 27 11:42:46 2005
@@ -33,7 +33,8 @@
/**
* This class illustrates the use of complex types with style/use
"RPC/LITERAL".
*/
[EMAIL PROTECTED]
[EMAIL PROTECTED](
targetNamespace="http://beehive.apache.org/web/webservice/rpc-examples")
+
@SOAPBinding(
style=SOAPBinding.Style.RPC,
use=SOAPBinding.Use.LITERAL
@@ -85,9 +86,9 @@
@WebMethod
@WebResult(name="ReturnCreateAddressInHeaderResult")
public int createAddressInHeader(@WebParam(name="out_param_header",
header=true, mode=WebParam.Mode.OUT) AddressHolder addressHolder) {
- StateType state = new StateType("WA");
- Phone phoneNumber = new Phone(425, "555", "1234");
- Address address = new Address(10230, "NE Points Drive", "Kirkland",
state, 98008, phoneNumber);
+ StateType state = new StateType("CA");
+ Phone phoneNumber = new Phone(714, "555", "1234");
+ Address address = new Address(1, "some street", "Los Angeles", state,
90210, phoneNumber);
addressHolder.value = address;
return 0;
}
Modified: incubator/beehive/trunk/samples/wsm-samples/soapbinding.html
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/wsm-samples/soapbinding.html?rev=165026&r1=165025&r2=165026&view=diff
==============================================================================
--- incubator/beehive/trunk/samples/wsm-samples/soapbinding.html (original)
+++ incubator/beehive/trunk/samples/wsm-samples/soapbinding.html Wed Apr 27
11:42:46 2005
@@ -24,7 +24,9 @@
<li>
<a href="web/complex/RpcLiteralSample.jws?wsdl">RpcLiteralSample</a>
</li>
-</ul>
+ <li>
+ <a href="web/complex/RpcEncodedSample.jws?wsdl">RpcEncodedSample</a>
+ </li></ul>
</p>
<hr>
<p>
@@ -48,7 +50,13 @@
<li>
<a
href="web/complex/RpcLiteralSample.jws?method=createAddressInHeader">RpcLiteralSample.createAddressInHeader()</a>
</li>
-</ul>
+ <li>
+ <a
href="web/complex/RpcEncodedSample.jws?method=createAddressInBody">RpcEncodedSample.createAddressInBody()</a>
+ </li>
+ <li>
+ <a
href="web/complex/RpcEncodedSample.jws?method=createAddressInHeader">RpcEncodedSample.createAddressInHeader()</a>
+ </li>
+ </ul>
</p>
<hr>