Commit 0a4df131 authored by Nicolas Dolet's avatar Nicolas Dolet

New web services examples:

 - isbn-test
 - dictionary
parent cab0547d
<?xml version="1.0"?>
<!--
* OW2 FraSCAti Examples: Dictionary
*
* Copyright (c) 2009 INRIA, USTL
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: frascati@ow2.org
*
* Author: Nicolas Dolet
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.ow2.frascati.examples</groupId>
<artifactId>dictionary</artifactId>
<version>0.6-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Dictionary</name>
<parent>
<groupId>org.ow2.frascati.examples</groupId>
<artifactId>ws-parent</artifactId>
<version>0.6-SNAPSHOT</version>
</parent>
<properties>
<wsdl.file>DictService.wsdl</wsdl.file>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
</plugin>
</plugins>
</build>
</project>
/***
* OW2 FraSCAti Assembly Factory Examples: Dictionary
* Copyright (C) 2009 INRIA, USTL
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Nicolas Dolet
*/
package org.ow2.frascati.examples.dictionary;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Iterator;
import org.osoa.sca.annotations.Reference;
import com.aonaware.services.webservices.Definition;
import com.aonaware.services.webservices.DictServiceSoap;
/**
* SCA Java Component implementation using a dictionary web service
*/
public class Client implements Runnable {
@Reference
protected DictServiceSoap dict;
public void run() {
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter a word: ");
try {
String word = input.readLine();
Iterator<Definition> it = dict.define(word).getDefinitions().getDefinition().iterator();
int count = 1;
while(it.hasNext()) {
Definition def = it.next();
System.out.println("Definition " + count + ":");
System.out.println(def.getWordDefinition());
count++;
}
} catch (IOException e) {
System.err.println("Can't read input data!");
e.printStackTrace();
}
}
}
<?xml version="1.0" encoding="ISO-8859-15"?>
<!-- OW2 FraSCAti Examples: Dictionary -->
<!-- Copyright (C) 2009 INRIA, USTL -->
<!-- -->
<!-- This library is free software; you can redistribute it and/or -->
<!-- modify it under the terms of the GNU Lesser General Public -->
<!-- License as published by the Free Software Foundation; either -->
<!-- version 2 of the License, or (at your option) any later version. -->
<!-- -->
<!-- This library is distributed in the hope that it will be useful, -->
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -->
<!-- Lesser General Public License for more details. -->
<!-- -->
<!-- You should have received a copy of the GNU Lesser General Public -->
<!-- License along with this library; if not, write to the Free Software -->
<!-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
<!-- -->
<!-- Author: Nicolas Dolet -->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="dictionary"
targetNamespace="http://frascati.ow2.org/dictionary">
<service name="r" promote="client/r">
<interface.java interface="java.lang.Runnable" />
</service>
<component name="client">
<implementation.java class="org.ow2.frascati.examples.dictionary.Client" />
<service name="r">
<interface.java interface="java.lang.Runnable" />
</service>
<reference name="dict">
<interface.java interface="com.aonaware.services.webservices.DictServiceSoap" />
<binding.ws wsdlElement="http://services.aonaware.com/DictService#wsdl.port(DictService/DictServiceSoap)" />
</reference>
</component>
</composite>
This diff is collapsed.
<?xml version="1.0"?>
<!--
* OW2 FraSCAti Examples: ISBN test
*
* Copyright (c) 2009 INRIA, USTL
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: frascati@ow2.org
*
* Author: Nicolas Dolet
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.ow2.frascati.examples</groupId>
<artifactId>isbntest</artifactId>
<version>0.6-SNAPSHOT</version>
<packaging>jar</packaging>
<name>ISBN test</name>
<parent>
<groupId>org.ow2.frascati.examples</groupId>
<artifactId>ws-parent</artifactId>
<version>0.6-SNAPSHOT</version>
</parent>
<properties>
<wsdl.file>isbnservice.wsdl</wsdl.file>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
</plugin>
</plugins>
</build>
</project>
/***
* OW2 FraSCAti Assembly Factory Examples: ISBN test
* Copyright (C) 2009 INRIA, USTL
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Nicolas Dolet
*/
package org.ow2.frascati.examples.isbntest;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import org.osoa.sca.annotations.Reference;
import com.daehosting.webservices.isbn.ISBNServiceSoapType;
/**
* SCA Java Component implementation using an ISBN test web service
*/
public class Client implements Runnable {
@Reference
protected ISBNServiceSoapType isbn;
public void run() {
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
try {
System.out.println("Do you want to check ISBN-10 [1] or ISBN-13 [2]?");
String choice = input.readLine();
if(!(choice.equals("1") || choice.equals("2"))) {
System.err.println("Invalid choice, exit...");
return;
}
System.out.print("Enter ISBN to check: ");
String isbnNumber = input.readLine();
System.out.println("Checking ISBN " + isbnNumber + "...");
boolean valid;
if(choice.equals("1")) {
valid = isbn.isValidISBN10(isbnNumber);
} else {
valid = isbn.isValidISBN13(isbnNumber);
}
System.out.println("ISBN " + isbnNumber + " is " + (valid?"":"not ") + "valid.");
} catch (IOException e) {
System.err.println("Can't read input data!");
e.printStackTrace();
}
}
}
<?xml version="1.0" encoding="ISO-8859-15"?>
<!-- OW2 FraSCAti Examples: ISBN test -->
<!-- Copyright (C) 2009 INRIA, USTL -->
<!-- -->
<!-- This library is free software; you can redistribute it and/or -->
<!-- modify it under the terms of the GNU Lesser General Public -->
<!-- License as published by the Free Software Foundation; either -->
<!-- version 2 of the License, or (at your option) any later version. -->
<!-- -->
<!-- This library is distributed in the hope that it will be useful, -->
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -->
<!-- Lesser General Public License for more details. -->
<!-- -->
<!-- You should have received a copy of the GNU Lesser General Public -->
<!-- License along with this library; if not, write to the Free Software -->
<!-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
<!-- -->
<!-- Author: Nicolas Dolet -->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="isbntest"
targetNamespace="http://frascati.ow2.org/isbntest">
<service name="r" promote="client/r">
<interface.java interface="java.lang.Runnable" />
</service>
<component name="client">
<implementation.java class="org.ow2.frascati.examples.isbntest.Client" />
<service name="r">
<interface.java interface="java.lang.Runnable" />
</service>
<reference name="isbn">
<interface.java interface="com.daehosting.webservices.isbn.ISBNServiceSoapType" />
<binding.ws wsdlElement="http://webservices.daehosting.com/services#wsdl.port(ISBNService/ISBNServiceSoap)" />
</reference>
</component>
</composite>
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://webservices.daehosting.com/ISBN" name="ISBNService" targetNamespace="http://webservices.daehosting.com/ISBN">
<types>
<xs:schema elementFormDefault="qualified" targetNamespace="http://webservices.daehosting.com/ISBN">
<xs:element name="IsValidISBN13">
<xs:complexType>
<xs:sequence>
<xs:element name="sISBN" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="IsValidISBN13Response">
<xs:complexType>
<xs:sequence>
<xs:element name="IsValidISBN13Result" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="IsValidISBN10">
<xs:complexType>
<xs:sequence>
<xs:element name="sISBN" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="IsValidISBN10Response">
<xs:complexType>
<xs:sequence>
<xs:element name="IsValidISBN10Result" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</types>
<message name="IsValidISBN13SoapRequest">
<part name="parameters" element="tns:IsValidISBN13"/>
</message>
<message name="IsValidISBN13SoapResponse">
<part name="parameters" element="tns:IsValidISBN13Response"/>
</message>
<message name="IsValidISBN10SoapRequest">
<part name="parameters" element="tns:IsValidISBN10"/>
</message>
<message name="IsValidISBN10SoapResponse">
<part name="parameters" element="tns:IsValidISBN10Response"/>
</message>
<portType name="ISBNServiceSoapType">
<operation name="IsValidISBN13">
<documentation>The test is done by calculation on the first 12 digits and compare the result with the checksum number at the end. You have to pass a 13 digits number.</documentation>
<input message="tns:IsValidISBN13SoapRequest"/>
<output message="tns:IsValidISBN13SoapResponse"/>
</operation>
<operation name="IsValidISBN10">
<documentation>The test is done by calculation on the first 9 digits and compare the result with the checksum number at the end. You have to pass a 10 digits number or 8 digits and an X.</documentation>
<input message="tns:IsValidISBN10SoapRequest"/>
<output message="tns:IsValidISBN10SoapResponse"/>
</operation>
</portType>
<binding name="ISBNServiceSoapBinding" type="tns:ISBNServiceSoapType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="IsValidISBN13">
<soap:operation soapAction="" style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="IsValidISBN10">
<soap:operation soapAction="" style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="ISBNService">
<documentation>Visual DataFlex Web Service to validate ISBN numbers.</documentation>
<port name="ISBNServiceSoap" binding="tns:ISBNServiceSoapBinding">
<soap:address location="http://webservices.daehosting.com/services/isbnservice.wso"/>
</port>
</service>
</definitions>
......@@ -72,6 +72,8 @@
<module>ws-parent</module>
<module>weather</module>
<module>verify-mail</module>
<module>isbn-test</module>
<module>dictionary</module>
</modules>
</project>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment