diff --git a/samples/stockquote/client/wcf/bin/client.exe b/samples/stockquote/client/wcf/bin/client.exe new file mode 100644 index 00000000..76789724 Binary files /dev/null and b/samples/stockquote/client/wcf/bin/client.exe differ diff --git a/samples/stockquote/client/wcf/bin/client.exe.config b/samples/stockquote/client/wcf/bin/client.exe.config new file mode 100644 index 00000000..75a57f8f --- /dev/null +++ b/samples/stockquote/client/wcf/bin/client.exe.config @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/stockquote/client/wcf/build.bat b/samples/stockquote/client/wcf/build.bat new file mode 100644 index 00000000..5af9f17e --- /dev/null +++ b/samples/stockquote/client/wcf/build.bat @@ -0,0 +1,5 @@ +@echo off +set WCF_PATH=%WINDIR%\Microsoft.NET\Framework\v3.0\Windows Communication Foundation +svcutil /noLogo /out:src\StockService.cs -namespace:http://www.springframework.org/spring-ws/samples/stockquote,Spring.Ws.Samples.Stock.Client.Wcf /noConfig http://localhost:8080/StockService.wsdl +csc /noLogo /out:bin\client.exe src\Main.cs src\StockService.cs +copy src\*.config bin\ \ No newline at end of file diff --git a/samples/stockquote/client/wcf/src/Main.cs b/samples/stockquote/client/wcf/src/Main.cs new file mode 100644 index 00000000..8476d7db --- /dev/null +++ b/samples/stockquote/client/wcf/src/Main.cs @@ -0,0 +1,59 @@ +using System; +using System.IO; +using System.ServiceModel; + +namespace Spring.Ws.Samples.Stock.Client.Wcf +{ + + public class Client + { + public static void Main(string[] args) + { + StockClient wcfClient = new StockClient(); + try + { + string[] symbols = new string[] { "FABRIKAM", "CONTOSO" }; + StockQuoteRequest request = new StockQuoteRequest(symbols); + + Console.Out.WriteLine("Requesting quotes for {0}", symbols); + StockQuote[] quotes = wcfClient.StockQuote(symbols); + + Console.Out.WriteLine("Got {0} results", quotes.Length); + + foreach (StockQuote quote in quotes) + { + Console.Out.WriteLine(); + Console.Out.WriteLine("Symbol: " + quote.Symbol); + Console.Out.WriteLine("\tName:\t\t\t" + quote.Name); + Console.Out.WriteLine("\tLast Price:\t\t" + quote.Last); + Console.Out.WriteLine("\tPrevious Change:\t" + quote.Change + "%"); + } + + } + catch (TimeoutException ex) + { + Console.Error.WriteLine("The service operation timed out. " + ex.Message); + wcfClient.Abort(); + } + catch (FaultException ex) + { + Console.Error.WriteLine("SOAP Fault Code {0}", ex.Code); + Console.Error.WriteLine("SOAP Fault Reason: {0}", ex.Reason); + wcfClient.Abort(); + } + catch (CommunicationException ex) + { + Console.WriteLine(ex.GetType()); + Console.Error.WriteLine("There was a communication problem. " + ex.Message); + Console.Error.WriteLine(ex.StackTrace); + wcfClient.Abort(); + } + catch (Exception ex) + { + Console.Error.WriteLine("Unknown exception. " + ex.Message); + Console.Error.WriteLine(ex.StackTrace); + wcfClient.Abort(); + } + } + } +} diff --git a/samples/stockquote/client/wcf/src/StockService.cs b/samples/stockquote/client/wcf/src/StockService.cs new file mode 100644 index 00000000..c95e4ade --- /dev/null +++ b/samples/stockquote/client/wcf/src/StockService.cs @@ -0,0 +1,207 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.1433 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + + +/// +[System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "3.0.4506.648")] +[System.SerializableAttribute()] +[System.Diagnostics.DebuggerStepThroughAttribute()] +[System.ComponentModel.DesignerCategoryAttribute("code")] +[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.springframework.org/spring-ws/samples/stockquote")] +public partial class StockQuote +{ + + private string symbolField; + + private double lastField; + + private System.DateTime dateField; + + private double changeField; + + private string nameField; + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=0)] + public string Symbol + { + get + { + return this.symbolField; + } + set + { + this.symbolField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=1)] + public double Last + { + get + { + return this.lastField; + } + set + { + this.lastField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=2)] + public System.DateTime Date + { + get + { + return this.dateField; + } + set + { + this.dateField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=3)] + public double Change + { + get + { + return this.changeField; + } + set + { + this.changeField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=4)] + public string Name + { + get + { + return this.nameField; + } + set + { + this.nameField = value; + } + } +} +namespace Spring.Ws.Samples.Stock.Client.Wcf +{ + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] + [System.ServiceModel.ServiceContractAttribute(Namespace="http://www.springframework.org/spring-ws/samples/stockquote", ConfigurationName="Spring.Ws.Samples.Stock.Client.Wcf.Stock")] + public interface Stock + { + + // CODEGEN: Generating message contract since the operation StockQuote is neither RPC nor document wrapped. + [System.ServiceModel.OperationContractAttribute(Action="http://www.springframework.org/spring-ws/samples/stockquote/StockService/GetQuote" + + "", ReplyAction="http://www.springframework.org/spring-ws/samples/stockquote/StockService/GetQuote" + + "Response")] + [System.ServiceModel.XmlSerializerFormatAttribute()] + Spring.Ws.Samples.Stock.Client.Wcf.StockQuoteResponse StockQuote(Spring.Ws.Samples.Stock.Client.Wcf.StockQuoteRequest request); + } + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] + [System.ServiceModel.MessageContractAttribute(IsWrapped=false)] + public partial class StockQuoteRequest + { + + [System.ServiceModel.MessageBodyMemberAttribute(Name="StockQuoteRequest", Namespace="http://www.springframework.org/spring-ws/samples/stockquote", Order=0)] + [System.Xml.Serialization.XmlArrayItemAttribute("Symbol", IsNullable=false)] + public string[] StockQuoteRequest1; + + public StockQuoteRequest() + { + } + + public StockQuoteRequest(string[] StockQuoteRequest1) + { + this.StockQuoteRequest1 = StockQuoteRequest1; + } + } + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] + [System.ServiceModel.MessageContractAttribute(IsWrapped=false)] + public partial class StockQuoteResponse + { + + [System.ServiceModel.MessageBodyMemberAttribute(Name="StockQuoteResponse", Namespace="http://www.springframework.org/spring-ws/samples/stockquote", Order=0)] + [System.Xml.Serialization.XmlArrayItemAttribute(IsNullable=false)] + public StockQuote[] StockQuoteResponse1; + + public StockQuoteResponse() + { + } + + public StockQuoteResponse(StockQuote[] StockQuoteResponse1) + { + this.StockQuoteResponse1 = StockQuoteResponse1; + } + } + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] + public interface StockChannel : Spring.Ws.Samples.Stock.Client.Wcf.Stock, System.ServiceModel.IClientChannel + { + } + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] + public partial class StockClient : System.ServiceModel.ClientBase, Spring.Ws.Samples.Stock.Client.Wcf.Stock + { + + public StockClient() + { + } + + public StockClient(string endpointConfigurationName) : + base(endpointConfigurationName) + { + } + + public StockClient(string endpointConfigurationName, string remoteAddress) : + base(endpointConfigurationName, remoteAddress) + { + } + + public StockClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : + base(endpointConfigurationName, remoteAddress) + { + } + + public StockClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + base(binding, remoteAddress) + { + } + + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + Spring.Ws.Samples.Stock.Client.Wcf.StockQuoteResponse Spring.Ws.Samples.Stock.Client.Wcf.Stock.StockQuote(Spring.Ws.Samples.Stock.Client.Wcf.StockQuoteRequest request) + { + return base.Channel.StockQuote(request); + } + + public StockQuote[] StockQuote(string[] StockQuoteRequest1) + { + Spring.Ws.Samples.Stock.Client.Wcf.StockQuoteRequest inValue = new Spring.Ws.Samples.Stock.Client.Wcf.StockQuoteRequest(); + inValue.StockQuoteRequest1 = StockQuoteRequest1; + Spring.Ws.Samples.Stock.Client.Wcf.StockQuoteResponse retVal = ((Spring.Ws.Samples.Stock.Client.Wcf.Stock)(this)).StockQuote(inValue); + return retVal.StockQuoteResponse1; + } + } +} diff --git a/samples/stockquote/client/wcf/src/client.exe.config b/samples/stockquote/client/wcf/src/client.exe.config new file mode 100644 index 00000000..75a57f8f --- /dev/null +++ b/samples/stockquote/client/wcf/src/client.exe.config @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file