[Mono-bugs] [Bug 577139] 500 response from memorabilia.hardrock.com (under moonlight) due to message format
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Tue Feb 9 21:45:21 EST 2010
http://bugzilla.novell.com/show_bug.cgi?id=577139
http://bugzilla.novell.com/show_bug.cgi?id=577139#c2
--- Comment #2 from Atsushi Enomoto <aenomoto at novell.com> 2010-02-10 02:45:19 UTC ---
Created an attachment (id=341658)
--> (http://bugzilla.novell.com/attachment.cgi?id=341658)
verifier
After r151087, our svcutil tool can generate working client proxy from
http://memorabilia.hardrock.com/MemoService.svc?wsdl which is easy to debug.
With "driver.cs" below, .NET successfully processes GetCollectionData()
requests i.e. the proxy code is valid.
The *attached* code contains a sample binary output from request to memorabilia
in .NET WCF (The binary buffer can be retrieved by simple http listener below).
The attached code reads that .NET buffer as binary XML, and stores it into
XmlDocument, then outputs as binary XML. It does *not* roundtrip, but the
/output is now completely identical between Mono and .NET.
The only difference between mono and .NET I can see there is, .NET writes the
request in some "shorter but semantically identical" binary format (as .NET
outputs the binary what mono also does from the same binary input). So it's not
very intuitive issue.
// listener.cs ----
using System;
using System.IO;
using System.Net;
using System.ServiceModel;
using System.ServiceModel.Channels;
public class Test
{
public static void Main ()
{
var l = new HttpListener ();
l.Prefixes.Add ("http://localhost:8080/");
l.Start ();
var ctx = l.GetContext ();
var enc = new BinaryMessageEncodingBindingElement
().CreateMessageEncoderFactory ().Encoder;
var stream = ctx.Request.InputStream;
//var msg = enc.ReadMessage (stream, 0x1000,
"application/soap+msbin1");
//Console.WriteLine (msg);
byte [] buf = new byte [10000];
int size = stream.Read (buf, 0, 10000);
for (int i = 0; i < size; i++)
Console.Write ("{0:X02}{1}", buf [i], i % 16 == 15 ?
"\n" : " ");
}
}
// driver.cs ----
using System;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
public class Test
{
public static void Main ()
{
var binding = new CustomBinding (
new BinaryMessageEncodingBindingElement (),
new HttpTransportBindingElement () {
MaxReceivedMessageSize = 0x100000});
Console.WriteLine
(binding.CanBuildChannelFactory<IRequestSessionChannel> ());
//var address = new EndpointAddress
("http://memorabilia.hardrock.com/MemoService.svc");
var address = new EndpointAddress ("http://localhost:8080");
var cli = new MemoServiceClient (binding, address);
cli.Endpoint.Behaviors.Add (new Behavior ());
cli.GetCollectionData ();
}
}
public class Inspector : IClientMessageInspector
{
public void AfterReceiveReply (ref Message reply, object correlationState)
{
}
public object BeforeSendRequest (ref Message request, IClientChannel
channel)
{
Console.WriteLine (channel.OutputSession);
var mb = request.CreateBufferedCopy (0x10000);
request = mb.CreateMessage ();
Console.WriteLine (mb.CreateMessage ());
return new object ();
}
}
public class Behavior : IEndpointBehavior
{
public void AddBindingParameters (ServiceEndpoint endpoint,
BindingParameterCollection bindingParameters) {}
public void ApplyClientBehavior (ServiceEndpoint endpoint, ClientRuntime
clientRuntime)
{
clientRuntime.MessageInspectors.Add (new Inspector ());
}
public void ApplyDispatchBehavior (ServiceEndpoint endpoint,
EndpointDispatcher endpointDispatcher) {}
public void Validate (ServiceEndpoint endpoint) {}
}
--
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
More information about the mono-bugs
mailing list