Upgraded sample to maven
This commit is contained in:
Binary file not shown.
@@ -1,44 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<project name="spring-ws-airline-sample-saaj-client" default="build">
|
||||
|
||||
<property name="bin.dir" value="bin"/>
|
||||
<property name="src.dir" value="src"/>
|
||||
<property name="gen.dir" value="gen"/>
|
||||
<property name="wsdl" value="http://localhost:8080/airline/airline.wsdl"/>
|
||||
<property name="exe" value="bin/airline.exe"/>
|
||||
|
||||
<target name="init">
|
||||
<taskdef resource="org/apache/ant/dotnet/antlib.xml">
|
||||
<classpath>
|
||||
<pathelement location="ant-dotnet-1.0.jar"/>
|
||||
</classpath>
|
||||
</taskdef>
|
||||
</target>
|
||||
|
||||
<target name="generate" depends="init">
|
||||
<mkdir dir="${gen.dir}"/>
|
||||
|
||||
<wsdltodotnet url="${wsdl}" destfile="${gen.dir}/AirlineService.cs"
|
||||
namespace="Spring.Ws.Samples.Airline.Client.DotNet"/>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="build" depends="generate">
|
||||
<mkdir dir="${bin.dir}"/>
|
||||
<csc targettype="exe" destfile="${bin.dir}/airline.exe" references="System.Web.Services.dll">
|
||||
<src dir="${src.dir}"/>
|
||||
<src dir="${gen.dir}"/>
|
||||
</csc>
|
||||
</target>
|
||||
|
||||
<target name="clean">
|
||||
<delete dir="${bin.dir}"/>
|
||||
<delete dir="${gen.dir}"/>
|
||||
</target>
|
||||
|
||||
<target name="run" depends="build">
|
||||
<dotnetexec executable="${exe}"/>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
@@ -1,10 +0,0 @@
|
||||
SPRING WEB SERVICES
|
||||
|
||||
This directory contains a .NET client for the Airline Web Service.
|
||||
The client can be run from the provided ant file, by calling "ant run".
|
||||
|
||||
SAJA Client Sample table of contents
|
||||
---------------------------------------------------
|
||||
* src - The source files for the client
|
||||
* build.xml - Ant build file with a 'build' and a 'run' target
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
using System;
|
||||
using System.Web;
|
||||
using System.Web.Services.Protocols;
|
||||
|
||||
namespace Spring.Ws.Samples.Airline.Client.DotNet {
|
||||
|
||||
public class Client {
|
||||
public static void Main(string[] args) {
|
||||
try {
|
||||
AirlineService service = new AirlineService();
|
||||
if (args.Length > 0) {
|
||||
service.Url = args[0];
|
||||
} else {
|
||||
service.Url = "http://localhost:8080/airline/services";
|
||||
}
|
||||
// Get all flights on 31st Januari, 2006 from Amsterdam to Venice
|
||||
MessageGetFlightsRequest getFlightsRequest = new MessageGetFlightsRequest();
|
||||
getFlightsRequest.from = "AMS";
|
||||
getFlightsRequest.to = "VCE";
|
||||
getFlightsRequest.departureDate = new DateTime(2006,1,31);
|
||||
Console.WriteLine("Requesting flights on {0:d}", getFlightsRequest.departureDate);
|
||||
Flight[] flights = service.GetFlights(getFlightsRequest);
|
||||
Console.WriteLine("Got {0} results", flights.Length);
|
||||
if (flights.Length > 0) {
|
||||
// Book the first flight using John Doe as a frequent flyer
|
||||
MessageBookFlightRequest bookFlightRequest = new MessageBookFlightRequest();
|
||||
bookFlightRequest.flightNumber = flights[0].number;
|
||||
bookFlightRequest.departureTime = flights[0].departureTime;
|
||||
bookFlightRequest.passengers = new object[] { "john" };
|
||||
Ticket ticket = service.BookFlight(bookFlightRequest);
|
||||
WriteTicket(ticket);
|
||||
}
|
||||
} catch (SoapException ex) {
|
||||
Console.Error.WriteLine("SOAP Fault Code {0}", ex.Code);
|
||||
Console.Error.WriteLine("SOAP Fault String: {0}", ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private static void WriteTicket(Ticket ticket) {
|
||||
Console.WriteLine("Ticket {0}", ticket.id);
|
||||
Console.WriteLine("Ticket issue date:\t{0:d}", ticket.issueDate);
|
||||
foreach (Name passenger in ticket.passengers) {
|
||||
WriteName(passenger);
|
||||
}
|
||||
WriteFlight(ticket.flight);
|
||||
}
|
||||
|
||||
private static void WriteName(Name name) {
|
||||
Console.WriteLine("Passenger Name:");
|
||||
Console.WriteLine("{0} {1}", name.first, name.last);
|
||||
Console.WriteLine("------------");
|
||||
}
|
||||
|
||||
private static void WriteFlight(Flight flight) {
|
||||
Console.WriteLine("{0:d}", flight.departureTime);
|
||||
Console.WriteLine("{0}\t{1}", flight.number, flight.serviceClass);
|
||||
Console.WriteLine("------------");
|
||||
Console.WriteLine("Depart:\t{0}-{1}\t{2:t}", flight.from.code, flight.from.name,
|
||||
flight.departureTime);
|
||||
Console.WriteLine("\t{0}", flight.from.city);
|
||||
Console.WriteLine("Arrive:\t{0}-{1}\t{2:t}", flight.to.code, flight.to.name,
|
||||
flight.arrivalTime);
|
||||
Console.WriteLine("\t{0}", flight.to.city);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,5 +13,7 @@
|
||||
<modules>
|
||||
<module>saaj</module>
|
||||
<module>axis1</module>
|
||||
<module>spring-ws</module>
|
||||
<module>jms</module>
|
||||
</modules>
|
||||
</project>
|
||||
|
||||
Reference in New Issue
Block a user