diff options
author | nash <nash@13f79535-47bb-0310-9956-ffa450edef68> | 2010-04-20 22:27:34 +0000 |
---|---|---|
committer | nash <nash@13f79535-47bb-0310-9956-ffa450edef68> | 2010-04-20 22:27:34 +0000 |
commit | 54e785c9a15bc1286757c147323b697a6c40a640 (patch) | |
tree | 1753072ba5b7468376d8ca7cf2d921126daca90c /sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-ws-jaxws | |
parent | f094477f3cda79a3918b02e29aa233001c7e4193 (diff) |
Copy 1.x travel sample to branches for start of 1.0 travel sample release
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@936092 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-ws-jaxws')
4 files changed, 305 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-ws-jaxws/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-ws-jaxws/build.xml new file mode 100644 index 0000000000..116f2999ba --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-ws-jaxws/build.xml @@ -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.
+-->
+
+<project name="scatours-client-currency-converter-ws-jaxws" default="compile">
+ <import file="../../antdefs.xml"/>
+
+ <target name="wsdljava">
+ <antcall target="wsimport">
+ <param name="wsdlfile" value="wsdl/CurrencyConverter.wsdl"/>
+ <param name="javaclass" value="scatours/currencyconverter/client/CurrencyConverter.class"/>
+ <param name="package" value="scatours.currencyconverter.client"/>
+ </antcall>
+ </target>
+
+ <!-- Before invoking the "run" target, the Web Services implementation of
+ the currency converter service needs to be started in its own process. -->
+ <target name="run-service">
+ <ant dir="../../launchers/currency-converter-ws" target="run"/>
+ </target>
+
+ <target name="run" depends="is-jdk6, jaxws-jdk6, jaxws-jdk5">
+ <java classname="scatours.CurrencyConverterWSClient" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="target/${ant.project.name}.jar"/>
+ <path refid="jaxws-path"/>
+ </classpath>
+ </java>
+ </target>
+
+ <!-- check to see if we are running on JDK 6 -->
+ <target name="is-jdk6">
+ <condition property="jdk6">
+ <available classname="javax.xml.ws.Service"/>
+ </condition>
+ </target>
+
+ <!-- JDK 6 contains JAX-WS so we don't need it on the classpath -->
+ <target name="jaxws-jdk6" if="jdk6">
+ <path id="jaxws-path"/>
+ </target>
+
+ <!-- on JDK 5 we need to add the JAX-WS runtime to the classpath -->
+ <target name="jaxws-jdk5" unless="jdk6">
+ <path id="jaxws-path">
+ <fileset dir="${env.JAXWS_HOME}/lib"/>
+ </path>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-ws-jaxws/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-ws-jaxws/pom.xml new file mode 100644 index 0000000000..8513023a92 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-ws-jaxws/pom.xml @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-client-currency-converter-ws-jaxws</artifactId>
+ <name>Apache Tuscany SCA Tours Currency Converter Web Service JAX-WS Client</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.xml.ws</groupId>
+ <artifactId>jaxws-api</artifactId>
+ <version>2.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.xml.soap</groupId>
+ <artifactId>saaj-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>java.net2</id>
+ <name>java.net Maven 2.x Repository</name>
+ <url>http://download.java.net/maven/2</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Class-Path>../util/scatours-util-jaxws-runtime.jar</Class-Path>
+ <Main-Class>scatours.CurrencyConverterWSClient</Main-Class>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxws-maven-plugin</artifactId>
+ <version>1.12</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>wsimport</goal>
+ </goals>
+ <configuration>
+ <wsdlDirectory>${basedir}/src/main/resources/wsdl</wsdlDirectory>
+ <packageName>scatours.currencyconverter.client</packageName>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-ws-jaxws/src/main/java/scatours/CurrencyConverterWSClient.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-ws-jaxws/src/main/java/scatours/CurrencyConverterWSClient.java new file mode 100644 index 0000000000..dbaa7c2124 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-ws-jaxws/src/main/java/scatours/CurrencyConverterWSClient.java @@ -0,0 +1,33 @@ +/* + * 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 scatours; + +import scatours.currencyconverter.client.CurrencyConverter; +import scatours.currencyconverter.client.CurrencyConverterService; + +public class CurrencyConverterWSClient { + + public static void main(String[] args) throws Exception { + CurrencyConverterService service = new CurrencyConverterService(); + CurrencyConverter converter = service.getPort(CurrencyConverter.class); + + System.out.println("USD -> GBP = " + converter.getExchangeRate("USD", "GBP")); + System.out.println("100 USD = " + converter.convert("USD", "GBP", 100.0) + "GBP"); + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-ws-jaxws/src/main/resources/wsdl/CurrencyConverter.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-ws-jaxws/src/main/resources/wsdl/CurrencyConverter.wsdl new file mode 100644 index 0000000000..055431bbf2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/clients/currency-converter-ws-jaxws/src/main/resources/wsdl/CurrencyConverter.wsdl @@ -0,0 +1,115 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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. + --> +<wsdl:definitions name="CurrencyConverterService" targetNamespace="http://currencyconverter.tuscanyscatours.com/" + xmlns:tns="http://currencyconverter.tuscanyscatours.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:SOAP11="http://schemas.xmlsoap.org/wsdl/soap/"> + <wsdl:types> + <xs:schema attributeFormDefault="qualified" elementFormDefault="unqualified" targetNamespace="http://currencyconverter.tuscanyscatours.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema"> + <xs:element name="getExchangeRate"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" name="arg0" nillable="true" type="xs:string"/> + <xs:element minOccurs="0" name="arg1" nillable="true" type="xs:string"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="convertResponse"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" name="return" type="xs:double"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="getExchangeRateResponse"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" name="return" type="xs:double"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="convert"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" name="arg0" nillable="true" type="xs:string"/> + <xs:element minOccurs="0" name="arg1" nillable="true" type="xs:string"/> + <xs:element minOccurs="0" name="arg2" type="xs:double"/> + </xs:sequence> + </xs:complexType> + </xs:element> + </xs:schema> + </wsdl:types> + <wsdl:message name="getExchangeRate"> + <wsdl:part name="getExchangeRate" element="tns:getExchangeRate"> + </wsdl:part> + </wsdl:message> + <wsdl:message name="convertResponse"> + <wsdl:part name="convertResponse" element="tns:convertResponse"> + </wsdl:part> + </wsdl:message> + <wsdl:message name="getExchangeRateResponse"> + <wsdl:part name="getExchangeRateResponse" element="tns:getExchangeRateResponse"> + </wsdl:part> + </wsdl:message> + <wsdl:message name="convert"> + <wsdl:part name="convert" element="tns:convert"> + </wsdl:part> + </wsdl:message> + <wsdl:portType name="CurrencyConverter"> + <wsdl:operation name="getExchangeRate"> + <wsdl:input message="tns:getExchangeRate"> + </wsdl:input> + <wsdl:output message="tns:getExchangeRateResponse"> + </wsdl:output> + </wsdl:operation> + <wsdl:operation name="convert"> + <wsdl:input message="tns:convert"> + </wsdl:input> + <wsdl:output message="tns:convertResponse"> + </wsdl:output> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="CurrencyConverterBinding" type="tns:CurrencyConverter"> + <SOAP:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> + <wsdl:operation name="getExchangeRate"> + <SOAP:operation/> + <wsdl:input> + <SOAP:body use="literal"/> + </wsdl:input> + <wsdl:output> + <SOAP:body use="literal"/> + </wsdl:output> + </wsdl:operation> + <wsdl:operation name="convert"> + <SOAP:operation/> + <wsdl:input> + <SOAP:body use="literal"/> + </wsdl:input> + <wsdl:output> + <SOAP:body use="literal"/> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="CurrencyConverterService"> + <wsdl:port name="CurrencyConverterPort" binding="tns:CurrencyConverterBinding"> + <SOAP:address location="http://localhost:8080/CurrencyConverter"/> + </wsdl:port> + </wsdl:service> +</wsdl:definitions> |