Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
2007-10-03 Atsushi Enomoto <atsushi@ximian.com>
* SoapHttpClientProtocolTest.cs: actually those tests fails on mono
on Windows, so mark them as Ignore (not only in 2.0).
2007-10-03 Atsushi Enomoto <atsushi@ximian.com>
* SoapHttpClientProtocolTest.cs: disabled connection-oriented tests
that do not work fine on .NET 2.0.
2007-06-16 Gert Driesen <drieseng@users.sourceforge.net>
* LogicalMethodInfoTest.cs: Fixed namespace.
* WebClientProtocolTest.cs: Fixed namespace.
* SoapHttpClientProtocolTest.cs: Fixed namespace. Added test for
bug #81886.
* SoapServerTypeTest.cs: Fixed namespace.
* SocketResponder.cs: Sync with copy in System assembly.
2007-05-11 Atsushi Enomoto <atsushi@ximian.com>
* SoapServerTypeTest.cs : make sure that SoapRpcServiceAttribute works.
2007-05-08 Atsushi Enomoto <atsushi@ximian.com>
* SoapServerTypeTest.cs : added some more tests related to server
methods.
2007-05-08 Atsushi Enomoto <atsushi@ximian.com>
* SoapServerTypeTest.cs : added some .ctor() tests to verify
validity of attributes on the service class.
2007-05-08 Atsushi Enomoto <atsushi@ximian.com>
* LogicalMethodInfoTest.cs : new test (cosmetic for now).
2007-04-23 Atsushi Enomoto <atsushi@ximian.com>
* SoapServerTypeTest.cs : added new test (one is not working yet).
It will be very useful when we test service type generation.
2007-01-15 Gert Driesen <drieseng@users.sourceforge.net>
* SoapHttpClientProtocolTest.cs: Added test for bug #79988.
* SocketResponder.cs: Utility class for emulating Web Service backend.

View File

@@ -0,0 +1,61 @@
//
// LogicalMethodInfoTest.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2007 Novell, Inc.
//
#if !MOBILE
using NUnit.Framework;
using System;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Web.Services;
using System.Web.Services.Configuration;
using System.Web.Services.Description;
using System.Web.Services.Protocols;
using System.Xml.Schema;
using System.Xml.Serialization;
namespace MonoTests.System.Web.Services.Protocol
{
[TestFixture]
public class LogicalMethodInfoTest
{
[Test]
public void BeginEndMethodInfo ()
{
LogicalMethodInfo [] ll = LogicalMethodInfo.Create (
new MethodInfo [] {
typeof (FooService).GetMethod ("BeginEcho"),
typeof (FooService).GetMethod ("EndEcho")});
Assert.AreEqual (1, ll.Length, "#1");
LogicalMethodInfo l = ll [0];
Assert.IsNull (l.MethodInfo, "#2");
Assert.IsNotNull (l.BeginMethodInfo, "#3");
Assert.IsNotNull (l.EndMethodInfo, "#4");
}
class FooService : WebService
{
public string Echo (string arg)
{
return arg;
}
public IAsyncResult BeginEcho (string arg, AsyncCallback cb, object state)
{
return null;
}
public string EndEcho (IAsyncResult result)
{
return null;
}
}
}
}
#endif

View File

@@ -0,0 +1,257 @@
//
// System.Web.Services.Protocols.SoapHttpClientProtocolTest.cs
//
// Author:
// Gert Driesen <drieseng@users.sourceforge.net>
//
// (C) 2007 Gert Driesen
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Web.Services;
using System.Web.Services.Description;
using System.Web.Services.Protocols;
using System.Xml;
using System.Xml.Serialization;
using NUnit.Framework;
namespace MonoTests.System.Web.Services.Protocols
{
[TestFixture]
public class SoapHttpClientProtocolTest
{
[Ignore ("this kind of connection oriented tests got non-working after some Windows updates in .NET 2.0 (1.1 still works).")]
[Test] // bug #79988
public void OutParametersTest ()
{
IPEndPoint localEP = new IPEndPoint (IPAddress.Loopback, 5000);
using (SocketResponder sr = new SocketResponder (localEP, new SocketRequestHandler (OutParametersResponse))) {
sr.Start ();
FooService service = new FooService ();
service.Url = "http://" + IPAddress.Loopback.ToString () + ":5000/";
int a;
bool b;
Elem [] e = service.Req ("x", out a, out b);
Assert.IsNull (e, "#A1");
Assert.AreEqual (0, a, "#A2");
Assert.IsFalse (b, "#A3");
service.Dispose ();
sr.Stop ();
}
}
[Ignore ("this kind of connection oriented tests got non-working after some Windows updates in .NET 2.0 (1.1 still works).")]
[Test] // bug #81886
public void FaultTest ()
{
IPEndPoint localEP = new IPEndPoint (IPAddress.Loopback, 5000);
using (SocketResponder sr = new SocketResponder (localEP, new SocketRequestHandler (FaultResponse_Qualified))) {
sr.Start ();
FooService service = new FooService ();
service.Url = "http://" + IPAddress.Loopback.ToString () + ":5000/";
try {
service.Run ();
Assert.Fail ("#A1");
} catch (SoapException ex) {
Assert.AreEqual ("Mono Web Service", ex.Actor, "#A2");
Assert.AreEqual (SoapException.ServerFaultCode, ex.Code, "#A3");
Assert.IsNotNull (ex.Detail, "#A4");
Assert.AreEqual ("detail", ex.Detail.LocalName, "#A5");
Assert.AreEqual ("http://schemas.xmlsoap.org/soap/envelope/", ex.Detail.NamespaceURI, "#A6");
XmlNamespaceManager nsMgr = new XmlNamespaceManager (ex.Detail.OwnerDocument.NameTable);
nsMgr.AddNamespace ("se", "http://www.mono-project/System");
XmlElement systemError = (XmlElement) ex.Detail.SelectSingleNode (
"se:systemerror", nsMgr);
Assert.IsNotNull (systemError, "#A7");
Assert.IsNull (ex.InnerException, "#A8");
Assert.AreEqual ("Failure processing request.", ex.Message, "#A9");
}
service.Dispose ();
sr.Stop ();
}
using (SocketResponder sr = new SocketResponder (localEP, new SocketRequestHandler (FaultResponse_Unqualified))) {
sr.Start ();
FooService service = new FooService ();
service.Url = "http://" + IPAddress.Loopback.ToString () + ":5000/";
try {
service.Run ();
Assert.Fail ("#B1");
} catch (SoapException ex) {
Assert.AreEqual ("Mono Web Service", ex.Actor, "#B2");
Assert.AreEqual (SoapException.ServerFaultCode, ex.Code, "#B3");
Assert.IsNotNull (ex.Detail, "#B4");
Assert.AreEqual ("detail", ex.Detail.LocalName, "#B5");
Assert.AreEqual (string.Empty, ex.Detail.NamespaceURI, "#B6");
XmlNamespaceManager nsMgr = new XmlNamespaceManager (ex.Detail.OwnerDocument.NameTable);
nsMgr.AddNamespace ("se", "http://www.mono-project/System");
XmlElement systemError = (XmlElement) ex.Detail.SelectSingleNode (
"se:systemerror", nsMgr);
Assert.IsNotNull (systemError, "#B7");
Assert.IsNull (ex.InnerException, "#B8");
Assert.AreEqual ("Failure processing request.", ex.Message, "#B9");
}
service.Dispose ();
sr.Stop ();
}
}
static byte [] FaultResponse_Qualified (Socket socket)
{
string responseContent =
"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
" <soap:Body>" +
" <soap:Fault>" +
" <soap:faultcode>soap:Server</soap:faultcode>" +
" <soap:faultstring>Failure processing request.</soap:faultstring>" +
" <soap:faultactor>Mono Web Service</soap:faultactor>" +
" <soap:detail>" +
" <se:systemerror xmlns:se=\"http://www.mono-project/System\">" +
" <se:code>5000</se:code>" +
" <se:description>Invalid credentials.</se:description>" +
" </se:systemerror>" +
" </soap:detail>" +
" </soap:Fault>" +
" </soap:Body>" +
"</soap:Envelope>";
StringWriter sw = new StringWriter ();
sw.WriteLine ("HTTP/1.1 200 OK");
sw.WriteLine ("Content-Type: text/xml");
sw.WriteLine ("Content-Length: " + responseContent.Length);
sw.WriteLine ();
sw.Write (responseContent);
sw.Flush ();
return Encoding.UTF8.GetBytes (sw.ToString ());
}
static byte [] FaultResponse_Unqualified (Socket socket)
{
string responseContent =
"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
" <soap:Body>" +
" <soap:Fault>" +
" <faultcode>soap:Server</faultcode>" +
" <faultstring>Failure processing request.</faultstring>" +
" <faultactor>Mono Web Service</faultactor>" +
" <detail>" +
" <se:systemerror xmlns:se=\"http://www.mono-project/System\">" +
" <se:code>5000</se:code>" +
" <se:description>Invalid credentials.</se:description>" +
" </se:systemerror>" +
" </detail>" +
" </soap:Fault>" +
" </soap:Body>" +
"</soap:Envelope>";
StringWriter sw = new StringWriter ();
sw.WriteLine ("HTTP/1.1 200 OK");
sw.WriteLine ("Content-Type: text/xml");
sw.WriteLine ("Content-Length: " + responseContent.Length);
sw.WriteLine ();
sw.Write (responseContent);
sw.Flush ();
return Encoding.UTF8.GetBytes (sw.ToString ());
}
static byte [] OutParametersResponse (Socket socket)
{
string responseContent =
"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
" <soap:Body>" +
" <ReqResponse2 xmlns=\"urn:foo\">" +
" <Hits>ERERE</Hits>" +
" </ReqResponse2>" +
" </soap:Body>" +
"</soap:Envelope>";
StringWriter sw = new StringWriter ();
sw.WriteLine ("HTTP/1.1 200 OK");
sw.WriteLine ("Content-Type: text/xml");
sw.WriteLine ("Content-Length: " + responseContent.Length);
sw.WriteLine ();
sw.Write (responseContent);
sw.Flush ();
return Encoding.UTF8.GetBytes (sw.ToString ());
}
[WebServiceBindingAttribute (Name = "Foo", Namespace = "urn:foo")]
public class FooService : SoapHttpClientProtocol
{
[SoapDocumentMethodAttribute ("", RequestElementName = "Req", RequestNamespace = "urn:foo", ResponseNamespace = "urn:foo", Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
[return: XmlElementAttribute ("Hits")]
public Elem [] Req ([XmlAttributeAttribute ()] string arg, [XmlAttributeAttribute ()] out int status, [XmlAttributeAttribute ()] [XmlIgnoreAttribute ()] out bool statusSpecified)
{
object [] results = this.Invoke ("Req", new object [] { arg });
status = ((int) (results [1]));
statusSpecified = ((bool) (results [2]));
return ((Elem []) (results [0]));
}
[SoapDocumentMethodAttribute ("", RequestElementName = "Run", RequestNamespace = "urn:foo", ResponseNamespace = "urn:foo", Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
[return: XmlElementAttribute ("Hits")]
public Elem Run ()
{
this.Invoke ("Run", new object [0]);
return new Elem ();
}
}
[SerializableAttribute ()]
public class Elem
{
private string attrField;
[XmlAttributeAttribute ()]
public string attr
{
get
{
return this.attrField;
}
set
{
this.attrField = value;
}
}
}
}
}

View File

@@ -0,0 +1,299 @@
//
// SoapServerTypeTest.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2007 Novell, Inc.
//
#if !MOBILE
using NUnit.Framework;
using System;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Web.Services;
using System.Web.Services.Configuration;
using System.Web.Services.Description;
using System.Web.Services.Protocols;
using System.Xml.Schema;
using System.Xml.Serialization;
namespace MonoTests.System.Web.Services.Protocol
{
[TestFixture]
public class SoapServerTypeTest
{
[Test]
public void NamedServiceBinding ()
{
SoapServerType sst = new SoapServerType (typeof (EdaInterface), WebServiceProtocols.HttpSoap);
new ServerType (typeof (EdaInterface));
SoapServerMethod m = sst.GetMethod ("urn:localBinding:local:LocalBindingMethod");
Assert.IsNotNull (m, "#1");
m = sst.GetMethod ("somethingFoo");
Assert.IsNull (m, "#2");
MethodInfo mi = typeof (EdaInterface).GetMethod ("BindingMethod");
Assert.IsNotNull ("#3-1");
m = sst.GetMethod (mi);
// ... so, MethodInfo does not work as a key here.
Assert.IsNull (m, "#3-2");
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void GetMethodNullKey ()
{
SoapServerType sst = new SoapServerType (typeof (EdaInterface), WebServiceProtocols.HttpSoap);
sst.GetMethod (null);
}
[Test]
public void ConstructorHttpGet ()
{
SoapServerType st = new SoapServerType (typeof (EdaInterface), WebServiceProtocols.HttpGet);
// I wonder if this property makes sense here ...
Assert.IsTrue (st.ServiceRoutingOnSoapAction, "#1");
}
[Test]
[ExpectedException (typeof (InvalidOperationException))]
[Category ("NotWorking")]
public void DuplicateBindingAttribute ()
{
new SoapServerType (typeof (DuplicateService), WebServiceProtocols.HttpSoap);
}
[Test]
public void DuplicateBindingAttribute2 ()
{
// ServerType, not SoapServerType ... no failure.
new ServerType (typeof (DuplicateService));
}
[Test]
public void DuplicateBindingAttributeButNotInUse ()
{
new SoapServerType (typeof (DuplicateButUnusedService), WebServiceProtocols.AnyHttpSoap);
}
[Test]
[ExpectedException (typeof (SoapException))]
[Category ("NotWorking")]
public void DuplicateMethodsWithSoapAction ()
{
new SoapServerType (typeof (WebService1), WebServiceProtocols.HttpSoap);
}
[Test]
// still error because both methods have the same name (though
// the error message seems saying that the element name
// conflicts with other "type" which I guess is the one built
// from another conflicting method).
[ExpectedException (typeof (InvalidOperationException))]
[Category ("NotWorking")]
public void DuplicateMethodsWithRequestElement1 ()
{
new SoapServerType (typeof (WebService2), WebServiceProtocols.HttpSoap);
}
[Test]
[Category ("NotWorking")]
public void DuplicateMethodsWithRequestElement2 ()
{
new SoapServerType (typeof (WebService3), WebServiceProtocols.HttpSoap);
}
[Test]
[ExpectedException (typeof (InvalidOperationException))]
public void WrongNamedServiceBinding ()
{
new SoapServerType (typeof (WrongBindingNameClass), WebServiceProtocols.HttpSoap);
}
[Test]
public void SimpleRpcType ()
{
new SoapServerType (typeof (SimpleRpcService), WebServiceProtocols.HttpSoap);
}
[WebService]
[SoapRpcService]
public class SimpleRpcService : WebService
{
[WebMethod]
public void Hello ()
{
}
}
// bug #78953
[WebServiceAttribute (Namespace = "www.DefaultNamespace.org")]
[WebServiceBindingAttribute (Name = "Local", Namespace = "urn:localBinding:local")]
[WebServiceBindingAttribute (Name = "Local2", Namespace = "urn:localBinding:local2")]
public class EdaInterface : WebService
{
[WebMethod]
public void Test ()
{
}
[WebMethod]
[SoapDocumentMethodAttribute ("urn:localBinding:local:LocalBindingMethod",
RequestNamespace = "urn:localBinding:local",
Binding = "Local",
Use = SoapBindingUse.Literal,
ParameterStyle = SoapParameterStyle.Bare)]
public void BindingMethod ()
{
}
}
[WebServiceBindingAttribute (Name = "Wrong", Namespace = "urn:localBinding:local")]
public class WrongBindingNameClass : WebService
{
[WebMethod]
public void Test ()
{
}
[WebMethod]
[SoapDocumentMethodAttribute ("urn:localBinding:local:LocalBindingMethod",
RequestNamespace = "urn:localBinding:local",
Binding = "Local",
Use = SoapBindingUse.Literal,
ParameterStyle = SoapParameterStyle.Bare)]
public void BindingMethod ()
{
}
}
[WebServiceAttribute (Namespace = "www.DefaultNamespace.org")]
[WebServiceBindingAttribute (Name = "Duplicate", Namespace = "urn:localBinding:local")]
[WebServiceBindingAttribute (Name = "Duplicate", Namespace = "urn:localBinding:local")]
public class DuplicateService : WebService
{
[WebMethod]
public void Test ()
{
}
[WebMethod]
[SoapDocumentMethodAttribute ("urn:localBinding:local:LocalBindingMethod",
RequestNamespace = "urn:localBinding:local",
Binding = "Duplicate",
Use = SoapBindingUse.Literal,
ParameterStyle = SoapParameterStyle.Bare)]
public void Foo ()
{
}
}
[WebServiceAttribute (Namespace = "www.DefaultNamespace.org")]
[WebServiceBindingAttribute (Name = "Duplicate", Namespace = "urn:localBinding:local")]
[WebServiceBindingAttribute (Name = "Duplicate", Namespace = "urn:localBinding:local")]
[WebServiceBindingAttribute (Name = "Local", Namespace = "urn:localBinding:local")]
public class DuplicateButUnusedService : WebService
{
[WebMethod]
public void Test ()
{
}
[WebMethod]
[SoapDocumentMethodAttribute ("urn:localBinding:local:LocalBindingMethod",
RequestNamespace = "urn:localBinding:local",
Binding = "Local",
Use = SoapBindingUse.Literal,
ParameterStyle = SoapParameterStyle.Bare)]
public void Foo ()
{
}
}
[WebService]
public class WebService1 : WebService
{
[WebMethod]
public void Test ()
{
}
[WebMethod]
[SoapDocumentMethodAttribute ("urn:foo:method1",
RequestNamespace = "urn:foo:method1",
Use = SoapBindingUse.Literal)]
public void BindingMethod ()
{
}
[WebMethod]
[SoapDocumentMethodAttribute ("urn:foo:method1",
RequestNamespace = "urn:foo:method1",
Use = SoapBindingUse.Literal)]
public void BindingMethod2 ()
{
}
}
[WebService]
[SoapDocumentService (RoutingStyle = SoapServiceRoutingStyle.RequestElement)]
public class WebService2 : WebService
{
[WebMethod]
public void Test ()
{
}
[WebMethod]
[SoapDocumentMethodAttribute ("urn:foo:method1",
RequestNamespace = "urn:foo:method1",
RequestElementName = "Element1",
Use = SoapBindingUse.Literal)]
public void BindingMethod ()
{
}
[WebMethod]
[SoapDocumentMethodAttribute ("urn:foo:method1",
RequestNamespace = "urn:foo:method1",
RequestElementName = "Element1",
Use = SoapBindingUse.Literal)]
public void BindingMethod2 ()
{
}
}
[WebService]
[SoapDocumentService (RoutingStyle = SoapServiceRoutingStyle.RequestElement)]
public class WebService3 : WebService
{
[WebMethod]
public void Test ()
{
}
[WebMethod]
[SoapDocumentMethodAttribute ("urn:foo:method1",
RequestNamespace = "urn:foo:method1",
RequestElementName = "Element1",
Use = SoapBindingUse.Literal)]
public void BindingMethod ()
{
}
[WebMethod]
[SoapDocumentMethodAttribute ("urn:foo:method1",
RequestNamespace = "urn:foo:method1",
RequestElementName = "Element2",
Use = SoapBindingUse.Literal)]
public void BindingMethod2 ()
{
}
}
}
}
#endif

View File

@@ -0,0 +1,118 @@
//
// SocketResponder.cs - Utility class for tests that require a listener
//
// Author:
// Gert Driesen (drieseng@users.sourceforge.net)
//
// Copyright (C) 2007 Gert Driesen
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Globalization;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
namespace MonoTests.System.Web.Services.Protocols
{
public delegate byte [] SocketRequestHandler (Socket socket);
public class SocketResponder : IDisposable
{
private TcpListener tcpListener;
private readonly IPEndPoint _localEndPoint;
private Thread listenThread;
private SocketRequestHandler _requestHandler;
private bool _stopped = true;
private readonly object _syncRoot = new object ();
private const int SOCKET_CLOSED = 10004;
public SocketResponder (IPEndPoint localEP, SocketRequestHandler requestHandler)
{
_localEndPoint = localEP;
_requestHandler = requestHandler;
}
public IPEndPoint LocalEndPoint
{
get { return _localEndPoint; }
}
public void Dispose ()
{
Stop ();
}
public bool IsStopped
{
get
{
lock (_syncRoot) {
return _stopped;
}
}
}
public void Start ()
{
lock (_syncRoot) {
if (!_stopped)
return;
_stopped = false;
listenThread = new Thread (new ThreadStart (Listen));
listenThread.Start ();
Thread.Sleep (20); // allow listener to start
}
}
public void Stop ()
{
lock (_syncRoot) {
if (_stopped)
return;
_stopped = true;
if (tcpListener != null) {
tcpListener.Stop ();
tcpListener = null;
}
}
}
private void Listen ()
{
tcpListener = new TcpListener (LocalEndPoint);
tcpListener.Start ();
try {
Socket socket = tcpListener.AcceptSocket ();
socket.Send (_requestHandler (socket));
socket.Close ();
} catch (SocketException ex) {
// ignore interruption of blocking call
if (ex.ErrorCode != SOCKET_CLOSED)
throw;
}
}
}
}

View File

@@ -0,0 +1,61 @@
//
// System.Web.Services.Discovery.ContractReference.cs
//
// Author:
// Konstantin Triger (kostat@mainsoft.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using NUnit.Framework;
using System;
using System.Net;
using System.Web.Services;
using System.Web.Services.Protocols;
namespace MonoTests.System.Web.Services.Protocols
{
[TestFixture]
public class WebClientProtocolTest
{
[WebServiceBinding (Name = "PokerSoap", Namespace = "http://tempuri.org/")]
public class Poker : SoapHttpClientProtocol
{
}
#if NET_2_0
[Test]
public void TestUseDefaultCredentials () {
Poker client = new Poker ();
Assert.IsFalse (client.UseDefaultCredentials, "#1");
client.UseDefaultCredentials = true;
Assert.IsTrue (client.Credentials == CredentialCache.DefaultCredentials, "#2");
client.Credentials = new NetworkCredential ("a", "b");
Assert.IsFalse (client.UseDefaultCredentials, "#3");
client.UseDefaultCredentials = false;
Assert.IsNull (client.Credentials, "#4");
client.Credentials = CredentialCache.DefaultCredentials;
Assert.IsTrue (client.UseDefaultCredentials, "#5");
}
#endif
}
}