DotNetXMLSerializer & BinarySerializer

170 views
Skip to first unread message

madmonkey

unread,
Feb 3, 2010, 1:01:41 PM2/3/10
to masstransit-discuss
I've modified the Pub-Sub 2008 sample (to make in work with the new
signatures) in a better attempt to understand how the serialization
works. Coincidentally, modifying on both the client and the server.
The only lines changed in all three tests is:

x.SetDefaultSerializer<T>();

Using the default XMLSerializer works fine - messages exchanged (back
and forth).

Using the DotNetXMLSerializer causes an error [System.Uri cannot be
serialized because it does not have a parameterless constructor.]

Using the BinarySerializer, the services do not start; gets stuck on
Starting Subordinate Service

Am I missing something obvious? Thanks.

The changes (server):
...
s.HowToBuildService(service =>
{
var container = new
DefaultMassTransitContainer();
IEndpointFactory endpointFactory =
EndpointFactoryConfigurator
.New(x =>
{
x.SetObjectBuilder(

ServiceLocator.Current.GetInstance<IObjectBuilder>());

x.RegisterTransport<MsmqEndpoint>();

x.SetDefaultSerializer<DotNotXmlMessageSerializer>();
});
container.Kernel.AddComponentInstance
("endpointFactory", typeof (IEndpointFactory),

endpointFactory);

container.AddComponent<PasswordUpdateService>(typeof
(PasswordUpdateService).Name);
return
container.Resolve<PasswordUpdateService>(typeof
(PasswordUpdateService).Name);
});

the changes (client):
...
s.HowToBuildService(service =>
{
var container = new
DefaultMassTransitContainer();
IEndpointFactory endpointFactory =
EndpointFactoryConfigurator.New(e =>
{
e.SetObjectBuilder
(ServiceLocator.Current.GetInstance<IObjectBuilder>());

e.RegisterTransport<MsmqEndpoint>();

e.SetDefaultSerializer<DotNotXmlMessageSerializer>();
});
container.Kernel.AddComponentInstance
("endpointFactory", typeof(IEndpointFactory), endpointFactory);
container.AddComponent<ClientService>
(typeof(ClientService).Name);
container.AddComponent<PasswordUpdater>
();
return container.Resolve<ClientService>
(typeof (ClientService).Name);
});

dru

unread,
Feb 3, 2010, 2:14:20 PM2/3/10
to masstransit-discuss
any logs?
-d

madmonkey

unread,
Feb 3, 2010, 2:43:39 PM2/3/10
to masstransit-discuss
Methinks that I should be using a ControlBus. Is that a correct
assumption?

INFO 01:02:33 Loading MassTransit.RuntimeServices Services...
INFO 01:02:37 Subscription Service Starting
INFO 01:02:37 Subscription Service Started
INFO 01:02:39 Subscription Client Added: msmq://magni/mt_health_control?tx=false
[099c591c-a04b-4600-9600-9d1200d6f4bf]
INFO 01:02:39 Subscription Removed:
MassTransit.Services.Timeout.Messages.TimeoutRescheduled, MassTransit
msmq://magni/mt_timeout?tx=false [1e51c1d5-cf94-4360-
bae9-9d120093a540] []
INFO 01:02:39 Unknown message type
SecurityMessages.RequestPasswordUpdate, SecurityMessages, unable to
add subscription
INFO 01:02:39 Unknown message type
SecurityMessages.PasswordUpdateComplete, SecurityMessages, unable to
add subscription
INFO 01:02:39 Subscription Removed:
MassTransit.Services.Timeout.Messages.TimeoutExpired, MassTransit
msmq://magni/mt_timeout?tx=false [d3e287ef-181f-45d1-
a627-9d120093a54e] []
INFO 01:02:39 Health Service Starting
INFO 01:02:39 Subscription Removed:
MassTransit.Services.Timeout.Messages.ScheduleTimeout, MassTransit
msmq://magni/mt_timeout?tx=false [92a899de-
ab71-434c-8909-9d120093a560] []
INFO 01:02:39 Subscription Removed:
MassTransit.Services.Timeout.Messages.CancelTimeout, MassTransit
msmq://magni/mt_timeout?tx=false [08b80d3d-bbef-4b20-
b7c6-9d120093a562] []
INFO 01:02:39 Subscription Removed:
MassTransit.Services.HealthMonitoring.Messages.HealthUpdateRequest,
MassTransit msmq://magni/mt_health?tx=false [3f5e0acb-78d8-48f1-
ad00-9d120093a3ed] []
INFO 01:02:39 Health Service Started
INFO 01:02:39 Subscription Removed:
MassTransit.Services.Timeout.Messages.TimeoutExpired, MassTransit
msmq://magni/mt_health?tx=false [104afb8b-55e9-4da1-8756-9d120093a404]
[]
INFO 01:02:39 Subscription Removed:
MassTransit.Services.HealthMonitoring.Messages.EndpointCameOnline,
MassTransit msmq://magni/mt_health?tx=false [4dabdf8e-5498-46df-
aa73-9d120093a40a] []
INFO 01:02:39 Subscription Removed:
MassTransit.Services.HealthMonitoring.Messages.PingEndpointResponse,
MassTransit msmq://magni/mt_health?tx=false
[a668fca7-562e-4858-8853-9d120093a40e] []
INFO 01:02:40 Subscription Removed:
MassTransit.Services.HealthMonitoring.Messages.EndpointWentOffline,
MassTransit msmq://magni/mt_health?tx=false
[1290e232-68c1-4f65-8c64-9d120093a421] []
INFO 01:02:40 Subscription Removed:
MassTransit.Services.HealthMonitoring.Messages.Heartbeat, MassTransit
msmq://magni/mt_health?tx=false [41409abe-2472-4016-9bd4-9d120093a429]
[]
INFO 01:02:40 Subscription Client Removed: msmq://magni/mt_health_control?tx=false
[ce6bb6e5-47e4-4199-9b7e-9d120093a1d0]
INFO 01:02:41 Subscription Added:
MassTransit.Services.HealthMonitoring.Messages.HealthUpdateRequest,
MassTransit msmq://magni/mt_health?tx=false [0a6d16f4-
d595-4f8c-9e59-9d1200d6f6a0] []
INFO 01:02:41 Subscription Added:
MassTransit.Services.HealthMonitoring.Messages.PingEndpointResponse,
MassTransit msmq://magni/mt_health?tx=false
[0e10ec5a-8274-4d05-9f6b-9d1200d6f6b1] []
INFO 01:02:41 Subscription Added:
MassTransit.Services.HealthMonitoring.Messages.EndpointCameOnline,
MassTransit msmq://magni/mt_health?tx=false [58d2fdee-
e40a-46cb-96fe-9d1200d6f6b8] []
INFO 01:02:41 Subscription Added:
MassTransit.Services.HealthMonitoring.Messages.Heartbeat, MassTransit
msmq://magni/mt_health?tx=false [80cc7752-d0ac-4917-9f1a-9d1200d6f6c1]
[]
INFO 01:02:41 Subscription Added:
MassTransit.Services.Timeout.Messages.TimeoutExpired, MassTransit
msmq://magni/mt_health?tx=false [8fa98340-0593-4f9c-9877-9d1200d6f6c5]
[]
INFO 01:02:41 Subscription Added:
MassTransit.Services.HealthMonitoring.Messages.EndpointWentOffline,
MassTransit msmq://magni/mt_health?tx=false [32997967-3fa8-4dc1-
b262-9d1200d6f6c9] []
INFO 01:02:41 Subscription Client Added: msmq://magni/mt_timeout_control?tx=false
[22e6a30c-ab23-4b2c-a3cb-9d1200d6f6e5]
INFO 01:02:41 Subscription Client Removed: msmq://magni/mt_timeout_control?tx=false
[f0285990-baf2-422f-84ba-9d120093a442]
INFO 01:02:41 Subscription Removed:
MassTransit.Services.HealthMonitoring.Messages.PingEndpoint,
MassTransit msmq://magni/mt_timeout_control?tx=false
[955caea7-5450-4504-a326-9d120093a4c9] []
INFO 01:02:41 Unknown message type
SecurityMessages.RequestPasswordUpdate, SecurityMessages, unable to
add subscription
INFO 01:02:41 Unknown message type
SecurityMessages.PasswordUpdateComplete, SecurityMessages, unable to
add subscription
INFO 01:02:41 Timeout Service Starting
INFO 01:02:41 Subscription Added:
MassTransit.Services.HealthMonitoring.Messages.PingEndpoint,
MassTransit msmq://magni/mt_timeout_control?tx=false
[81fc6c4a-9d86-495b-8676-9d1200d6f914] []
INFO 01:02:41 Subscription Added:
MassTransit.Services.Timeout.Messages.TimeoutScheduled, MassTransit
msmq://magni/mt_timeout?tx=false
[d4c75852-4cad-4084-8d44-9d1200d6f938] []
INFO 01:02:41 Subscription Added:
MassTransit.Services.Timeout.Messages.TimeoutRescheduled, MassTransit
msmq://magni/mt_timeout?tx=false [de91c23e-a89a-4afe-
a6a8-9d1200d6f93f] []
INFO 01:02:41 Subscription Added:
MassTransit.Services.Timeout.Messages.CancelTimeout, MassTransit
msmq://magni/mt_timeout?tx=false [244f3de5-
a5f3-4014-9d60-9d1200d6f950] []
INFO 01:02:41 Timeout Service Started
INFO 01:02:41 Subscription Added:
MassTransit.Services.Timeout.Messages.ScheduleTimeout, MassTransit
msmq://magni/mt_timeout?tx=false [6ebe5b30-202d-45f7-
bafb-9d1200d6f958] []
INFO 01:02:41 Subscription Added:
MassTransit.Services.Timeout.Messages.TimeoutExpired, MassTransit
msmq://magni/mt_timeout?tx=false [92f41884-da8a-496a-
bc78-9d1200d6f963] []
ERROR 01:02:43 Unrecognized message
msmq://magni/mt_subscriptions?tx=false:27ce2a85-8f0d-4254-94d0-e42ff0ab88d2\460434
System.Runtime.Serialization.SerializationException: Failed to
serialize message ---> System.Xml.XmlException: '.', hexadecimal value
0x00, is an invalid character. Line 1, position 1.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
at System.Xml.XmlTextReaderImpl.Throw(Int32 pos, String res, String
[] args)
at System.Xml.XmlTextReaderImpl.ThrowInvalidChar(Int32 pos, Char
invChar)
at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderImpl.Read()
at MassTransit.Serialization.Custom.DeserializerContext.Deserialize
() in C:\Users\Andrew\Documents\MassTransit.git\src\MassTransit
\Serialization\Custom\DeserializerContext.cs:line 70
at
MassTransit.Serialization.Custom.CustomXmlSerializer.DeserializeMessage
(XmlReader reader) in C:\Users\Andrew\Documents\MassTransit.git\src
\MassTransit\Serialization\Custom\CustomXmlSerializer.cs:line 128
at MassTransit.Serialization.Custom.CustomXmlSerializer.Deserialize
(Stream input) in C:\Users\Andrew\Documents\MassTransit.git\src
\MassTransit\Serialization\Custom\CustomXmlSerializer.cs:line 95
at MassTransit.Serialization.XmlMessageSerializer.Deserialize
(Stream stream) in C:\Users\Andrew\Documents\MassTransit.git\src
\MassTransit\Serialization\XmlMessageSerializer.cs:line 57
--- End of inner exception stack trace ---
at MassTransit.Serialization.XmlMessageSerializer.Deserialize
(Stream stream) in C:\Users\Andrew\Documents\MassTransit.git\src
\MassTransit\Serialization\XmlMessageSerializer.cs:line 79
at
MassTransit.Transports.Msmq.MsmqEndpoint.<>c__DisplayClass5.<ReceiveFromTransport>b__3
(Message message) in C:\Users\Andrew\Documents\MassTransit.git\src
\Transports\MassTransit.Transports.Msmq\MsmqEndpoint.cs:line 116
ERROR 01:02:43 Unrecognized message
msmq://magni/mt_subscriptions?tx=false:27ce2a85-8f0d-4254-94d0-e42ff0ab88d2\460459
System.Runtime.Serialization.SerializationException: Failed to
serialize message ---> System.Xml.XmlException: '.', hexadecimal value
0x00, is an invalid character. Line 1, position 1.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
at System.Xml.XmlTextReaderImpl.Throw(Int32 pos, String res, String
[] args)
at System.Xml.XmlTextReaderImpl.ThrowInvalidChar(Int32 pos, Char
invChar)
at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderImpl.Read()
at MassTransit.Serialization.Custom.DeserializerContext.Deserialize
() in C:\Users\Andrew\Documents\MassTransit.git\src\MassTransit
\Serialization\Custom\DeserializerContext.cs:line 70
at
MassTransit.Serialization.Custom.CustomXmlSerializer.DeserializeMessage
(XmlReader reader) in C:\Users\Andrew\Documents\MassTransit.git\src
\MassTransit\Serialization\Custom\CustomXmlSerializer.cs:line 128
at MassTransit.Serialization.Custom.CustomXmlSerializer.Deserialize
(Stream input) in C:\Users\Andrew\Documents\MassTransit.git\src
\MassTransit\Serialization\Custom\CustomXmlSerializer.cs:line 95
at MassTransit.Serialization.XmlMessageSerializer.Deserialize
(Stream stream) in C:\Users\Andrew\Documents\MassTransit.git\src
\MassTransit\Serialization\XmlMessageSerializer.cs:line 57
--- End of inner exception stack trace ---
at MassTransit.Serialization.XmlMessageSerializer.Deserialize
(Stream stream) in C:\Users\Andrew\Documents\MassTransit.git\src
\MassTransit\Serialization\XmlMessageSerializer.cs:line 79
at
MassTransit.Transports.Msmq.MsmqEndpoint.<>c__DisplayClass5.<ReceiveFromTransport>b__3
(Message message) in C:\Users\Andrew\Documents\MassTransit.git\src
\Transports\MassTransit.Transports.Msmq\MsmqEndpoint.cs:line 116

> >                                                            });- Hide quoted text -
>
> - Show quoted text -

madmonkey

unread,
Feb 3, 2010, 4:36:33 PM2/3/10
to masstransit-discuss
Perhaps conflicting serialization with the Subscription Service?

> MassTransit.Transports.Msmq.MsmqEndpoint.<>c__DisplayClass5.<ReceiveFromTra­nsport>b__3

> MassTransit.Transports.Msmq.MsmqEndpoint.<>c__DisplayClass5.<ReceiveFromTra­nsport>b__3


> (Message message) in C:\Users\Andrew\Documents\MassTransit.git\src
> \Transports\MassTransit.Transports.Msmq\MsmqEndpoint.cs:line 116
>
> On Feb 3, 2:14 pm, dru <d...@drusellers.com> wrote:
>
>
>
> > any logs?
> > -d
>
> > On Feb 3, 12:01 pm, madmonkey <adelpre...@gmail.com> wrote:
>
> > > I've modified the Pub-Sub 2008 sample (to make in work with the new
> > > signatures) in a better attempt to understand how the serialization
> > > works. Coincidentally, modifying on both the client and the server.
> > > The only lines changed in all three tests is:
>

> ...
>
> read more »- Hide quoted text -

Dru Sellers

unread,
Feb 3, 2010, 4:49:59 PM2/3/10
to masstrans...@googlegroups.com
Well currently EVERYTHING has to be on the same serializer, so if even one piece is off that would be an issue. :(
-d

--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To post to this group, send email to masstrans...@googlegroups.com.
To unsubscribe from this group, send email to masstransit-dis...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/masstransit-discuss?hl=en.


madmonkey

unread,
Feb 3, 2010, 5:18:26 PM2/3/10
to masstransit-discuss
By everything - do you mean just the publisher and subscriber
exchanging messages? Or one serializer to rule them all?

Dru Sellers

unread,
Feb 3, 2010, 5:19:52 PM2/3/10
to masstrans...@googlegroups.com
the same 'TYPE' of serializer, different instances of course. cuz that would just be silly.
the publisher
the sender
all RuntimeServices etc

-d

madmonkey

unread,
Feb 3, 2010, 5:24:00 PM2/3/10
to masstransit-discuss
That would be silly (I did mean Type though - the Highlander reference
didn't fit quite the way I expected).
So, if I wanted to rig RuntimeServices to use say - the
BinarySerializer, what switch would I have to throw?

Dru Sellers

unread,
Feb 3, 2010, 5:25:51 PM2/3/10
to masstrans...@googlegroups.com
recompile. currently this isn't configurable from XML or the commandline
but we take patches. ;)
-d

madmonkey

unread,
Feb 3, 2010, 5:33:22 PM2/3/10
to masstransit-discuss
Expanding the message headers may help the cause...is this an idea
worth pursuing or have you ruled it out for some reason?

Dru Sellers

unread,
Feb 3, 2010, 5:38:48 PM2/3/10
to masstrans...@googlegroups.com
it hasn't been a big issue yet. so neither of us have driven it out.
the problem is, could be, we serialize the headers too.

I believe MSMQ might have some transport level headers
RabbitMQ does
ActiveMQ might

would just have to look at every transport.

-d

Dru Sellers

unread,
Feb 3, 2010, 5:39:01 PM2/3/10
to masstrans...@googlegroups.com
i am down though

madmonkey

unread,
Feb 3, 2010, 5:46:14 PM2/3/10
to masstransit-discuss
Just shot you an e-mail with a few questions been mulling about.
Mostly about wireless and encryption...which in my environment has to
be there. Let me know. And thanks for the moment of clarity at the end
of a long day.

On Feb 3, 5:39 pm, Dru Sellers <d...@drusellers.com> wrote:
> i am down though
>
>
>
> On Wed, Feb 3, 2010 at 4:38 PM, Dru Sellers <d...@drusellers.com> wrote:
> > it hasn't been a big issue yet. so neither of us have driven it out.
> > the problem is, could be, we serialize the headers too.
>
> > I believe MSMQ might have some transport level headers
> > RabbitMQ does
> > ActiveMQ might
>
> > would just have to look at every transport.
>
> > -d
>

Dru Sellers

unread,
Feb 3, 2010, 6:35:20 PM2/3/10
to masstrans...@googlegroups.com
ok MSMQ fail, it doesn't appear to have any headers. :(
ActiveMQ and RabbitMQ do though.

-d

Udi Dahan

unread,
Feb 4, 2010, 6:36:32 AM2/4/10
to masstrans...@googlegroups.com

In NServiceBus we use the Extension property of the MSMQ Message class to pass our headers around.

It's been working very well for us.

 

-- Udi Dahan

Dru Sellers

unread,
Feb 4, 2010, 7:00:51 AM2/4/10
to masstrans...@googlegroups.com
thanks udi!!

I see that it is a byte[] so we would just need to pick a default serializer for this and we should be good to go I believe.

neaters!

-d
Reply all
Reply to author
Forward
0 new messages