Author: sandakith
Date: Wed Jan 2 23:42:53 2008
New Revision: 11788
Log:
Adding the compatible jaxws calculator sample
Added:
trunk/wsas/java/modules/samples/JAXWS/src/org/wso2/wsas/sample/
trunk/wsas/java/modules/samples/JAXWS/src/org/wso2/wsas/sample/jaxws/
trunk/wsas/java/modules/samples/JAXWS/src/org/wso2/wsas/sample/jaxws/calculator/
trunk/wsas/java/modules/samples/JAXWS/src/org/wso2/wsas/sample/jaxws/calculator/client/
trunk/wsas/java/modules/samples/JAXWS/src/org/wso2/wsas/sample/jaxws/calculator/client/CalculatorClient.java
trunk/wsas/java/modules/samples/JAXWS/src/org/wso2/wsas/sample/jaxws/calculator/service/
trunk/wsas/java/modules/samples/JAXWS/src/org/wso2/wsas/sample/jaxws/calculator/service/Add.java
trunk/wsas/java/modules/samples/JAXWS/src/org/wso2/wsas/sample/jaxws/calculator/service/AddResponse.java
trunk/wsas/java/modules/samples/JAXWS/src/org/wso2/wsas/sample/jaxws/calculator/service/Calculator.java
trunk/wsas/java/modules/samples/JAXWS/src/org/wso2/wsas/sample/jaxws/calculator/service/CalculatorService.java
trunk/wsas/java/modules/samples/JAXWS/src/org/wso2/wsas/sample/jaxws/calculator/service/ObjectFactory.java
trunk/wsas/java/modules/samples/JAXWS/src/org/wso2/wsas/sample/jaxws/calculator/service/package-info.java
Added:
trunk/wsas/java/modules/samples/JAXWS/src/org/wso2/wsas/sample/jaxws/calculator/client/CalculatorClient.java
==============================================================================
--- (empty file)
+++
trunk/wsas/java/modules/samples/JAXWS/src/org/wso2/wsas/sample/jaxws/calculator/client/CalculatorClient.java
Wed Jan 2 23:42:53 2008
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.wso2.wsas.sample.jaxws.calculator.client;
+
+import org.wso2.wsas.sample.jaxws.calculator.Add;
+import org.wso2.wsas.sample.jaxws.calculator.AddResponse;
+import org.wso2.wsas.sample.jaxws.services.CalculatorServiceStub;
+
+import java.rmi.RemoteException;
+import java.util.Random;
+
+/**
+ * JAXWS Calculator Client
+ */
+public class CalculatorClient {
+
+ public static void main(String[] args) {
+ try {
+ //Instantiate the Calculator Stub
+ CalculatorServiceStub stub = new CalculatorServiceStub();
+ doAdd(stub);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Invoke the Calculator Service Add
+ */
+ private static void doAdd(CalculatorServiceStub stub) throws
RemoteException {
+
+ //Generate two random values between 0 to 100
+ Random rand = new Random();
+ int value1 = rand.nextInt(100+1);
+ int value2 = rand.nextInt(100+1);
+
+ //Invoke
+ Add add = new Add();
+ add.setValue1(value1);
+ add.setValue2(value2);
+
+ AddResponse res = stub.add(add);
+ System.out.println("Results of Addition of "+
+ value1 + " with " + value2 + " is : " + res.get_return());
+
+ }
+
+}
Added:
trunk/wsas/java/modules/samples/JAXWS/src/org/wso2/wsas/sample/jaxws/calculator/service/Add.java
==============================================================================
--- (empty file)
+++
trunk/wsas/java/modules/samples/JAXWS/src/org/wso2/wsas/sample/jaxws/calculator/service/Add.java
Wed Jan 2 23:42:53 2008
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+package org.wso2.wsas.sample.jaxws.calculator.service;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for add element declaration.
+ *
+ * <p>The following schema fragment specifies the expected content contained
within this class.
+ *
+ * <pre>
+ * <element name="add">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="value1"
type="{http://www.w3.org/2001/XMLSchema}int"/>
+ * <element name="value2"
type="{http://www.w3.org/2001/XMLSchema}int"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * </pre>
+ *
+ *
+ */
[EMAIL PROTECTED](XmlAccessType.FIELD)
[EMAIL PROTECTED](name = "", propOrder = {
+ "value1",
+ "value2"
+})
[EMAIL PROTECTED](name = "add")
+public class Add {
+
+ @XmlElement(namespace = "http://calculator.jaxws.wsas.wso2.org")
+ protected int value1;
+ @XmlElement(namespace = "http://calculator.jaxws.wsas.wso2.org")
+ protected int value2;
+
+ /**
+ * Gets the value of the value1 property.
+ *
+ */
+ public int getValue1() {
+ return value1;
+ }
+
+ /**
+ * Sets the value of the value1 property.
+ *
+ */
+ public void setValue1(int value) {
+ this.value1 = value;
+ }
+
+ /**
+ * Gets the value of the value2 property.
+ *
+ */
+ public int getValue2() {
+ return value2;
+ }
+
+ /**
+ * Sets the value of the value2 property.
+ *
+ */
+ public void setValue2(int value) {
+ this.value2 = value;
+ }
+
+}
Added:
trunk/wsas/java/modules/samples/JAXWS/src/org/wso2/wsas/sample/jaxws/calculator/service/AddResponse.java
==============================================================================
--- (empty file)
+++
trunk/wsas/java/modules/samples/JAXWS/src/org/wso2/wsas/sample/jaxws/calculator/service/AddResponse.java
Wed Jan 2 23:42:53 2008
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+package org.wso2.wsas.sample.jaxws.calculator.service;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for addResponse element declaration.
+ *
+ * <p>The following schema fragment specifies the expected content contained
within this class.
+ *
+ * <pre>
+ * <element name="addResponse">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="return"
type="{http://www.w3.org/2001/XMLSchema}int"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * </pre>
+ *
+ *
+ */
[EMAIL PROTECTED](XmlAccessType.FIELD)
[EMAIL PROTECTED](name = "", propOrder = {
+ "_return"
+})
[EMAIL PROTECTED](name = "addResponse")
+public class AddResponse {
+
+ @XmlElement(name = "return", namespace =
"http://calculator.jaxws.wsas.wso2.org")
+ protected int _return;
+
+ /**
+ * Gets the value of the return property.
+ *
+ */
+ public int getReturn() {
+ return _return;
+ }
+
+ /**
+ * Sets the value of the return property.
+ *
+ */
+ public void setReturn(int value) {
+ this._return = value;
+ }
+
+}
Added:
trunk/wsas/java/modules/samples/JAXWS/src/org/wso2/wsas/sample/jaxws/calculator/service/Calculator.java
==============================================================================
--- (empty file)
+++
trunk/wsas/java/modules/samples/JAXWS/src/org/wso2/wsas/sample/jaxws/calculator/service/Calculator.java
Wed Jan 2 23:42:53 2008
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+package org.wso2.wsas.sample.jaxws.calculator.service;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+
+
+/**
+ * This class was generated by the JAXWS SI.
+ * JAX-WS RI 2.0_01-b59-fcs
+ * Generated source version: 2.0
+ *
+ */
[EMAIL PROTECTED](name = "Calculator", targetNamespace =
"http://calculator.jaxws.sample.wsas.wso2.org")
+public interface Calculator {
+
+
+ /**
+ *
+ * @param value1
+ * @param value2
+ * @return
+ * returns int
+ */
+ @WebMethod(action = "add")
+ @WebResult(targetNamespace =
"http://calculator.jaxws.sample.wsas.wso2.org")
+ @RequestWrapper(localName = "add", targetNamespace =
"http://calculator.jaxws.sample.wsas.wso2.org", className =
"org.wso2.wsas.sample.jaxws.calculator.Add")
+ @ResponseWrapper(localName = "addResponse", targetNamespace =
"http://calculator.jaxws.sample.wsas.wso2.org", className =
"org.wso2.wsas.sample.jaxws.calculator.AddResponse")
+ public int add(
+ @WebParam(name = "value1", targetNamespace =
"http://calculator.jaxws.sample.wsas.wso2.org")
+ int value1,
+ @WebParam(name = "value2", targetNamespace =
"http://calculator.jaxws.sample.wsas.wso2.org")
+ int value2);
+
+}
Added:
trunk/wsas/java/modules/samples/JAXWS/src/org/wso2/wsas/sample/jaxws/calculator/service/CalculatorService.java
==============================================================================
--- (empty file)
+++
trunk/wsas/java/modules/samples/JAXWS/src/org/wso2/wsas/sample/jaxws/calculator/service/CalculatorService.java
Wed Jan 2 23:42:53 2008
@@ -0,0 +1,52 @@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+package org.wso2.wsas.sample.jaxws.calculator.service;
+import javax.annotation.Resource;
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceContext;
+
[EMAIL PROTECTED](serviceName = "Calculator",
+ endpointInterface =
"org.wso2.wsas.sample.jaxws.calculator.Calculator",
+ targetNamespace = "http://calculator.jaxws.sample.wsas.wso2.org")
+public class CalculatorService implements Calculator {
+
+ @Resource
+ private WebServiceContext context;
+
+ /**
+ * @return
+ * returns javax.xml.ws.WebServiceContext
+ */
+ public WebServiceContext getContext() {
+ return context;
+ }
+
+ /**
+ * @param value1
+ * @param value2
+ * @return
+ * returns int
+ */
+ public int add(int value1, int value2) {
+ System.out.println("User Principal: " + context.getUserPrincipal());
+ System.out.println("value1: " + value1 + " value2: " + value2);
+ return value1 + value2;
+ }
+}
\ No newline at end of file
Added:
trunk/wsas/java/modules/samples/JAXWS/src/org/wso2/wsas/sample/jaxws/calculator/service/ObjectFactory.java
==============================================================================
--- (empty file)
+++
trunk/wsas/java/modules/samples/JAXWS/src/org/wso2/wsas/sample/jaxws/calculator/service/ObjectFactory.java
Wed Jan 2 23:42:53 2008
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+package org.wso2.wsas.sample.jaxws.calculator.service;
+
+import javax.xml.bind.annotation.XmlRegistry;
+
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
+ * generated in the org.apache.axis2.jaxws.calculator package.
+ * <p>An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups. Factory methods for each of these are
+ * provided in this class.
+ *
+ */
[EMAIL PROTECTED]
+public class ObjectFactory {
+
+
+ /**
+ * Create a new ObjectFactory that can be used to create new instances of
schema derived classes for package: org.apache.axis2.jaxws.calculator
+ *
+ */
+ public ObjectFactory() {
+ }
+
+ /**
+ * Create an instance of [EMAIL PROTECTED] Add }
+ *
+ */
+ public Add createAdd() {
+ return new Add();
+ }
+
+ /**
+ * Create an instance of [EMAIL PROTECTED] AddResponse }
+ *
+ */
+ public AddResponse createAddResponse() {
+ return new AddResponse();
+ }
+
+}
Added:
trunk/wsas/java/modules/samples/JAXWS/src/org/wso2/wsas/sample/jaxws/calculator/service/package-info.java
==============================================================================
--- (empty file)
+++
trunk/wsas/java/modules/samples/JAXWS/src/org/wso2/wsas/sample/jaxws/calculator/service/package-info.java
Wed Jan 2 23:42:53 2008
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
[EMAIL PROTECTED](namespace = "http://calculator.jaxws.sample.wsas.wso2.org")
+package org.wso2.wsas.sample.jaxws.calculator;
_______________________________________________
Wsas-java-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/wsas-java-dev