Another DPWS/MfSvcUtil bug with byte-arrays (?)

Skip to first unread message

Tim G.

May 25, 2010, 4:51:01 AM5/25/10

(this one especially goes to Zach Libbby)

Here's my setup:
I have a service running on an MF device and I am consuming it from a WCF
client. When the client sends a request, the service answers with a reply
that contains a complex type - within that type there is a byte-array.
Now the communication works fine and all elements of the complex type get
transmitted properly - except for the byte-array.

I tracked it down, and it seems as if the deserializer on the WCF-side is
expecting a Base64 encoded string. The service however converts each byte of
the array into a string (and appends them to a resulting string, where each
converted byte is seperated by a whitespace). So the service does a
"plain-string" conversion and the WCF client expects a Base64-encoding.

Now I would not neccessarily call this a bug on either the WCF- or the
MF-side, but an interoperability issue. (see this post for a similar issue,
regarding only WCF services and clients:

It seems as if you were currently working on DPWS-Bugs and interoperability
and I simply wanted to contribute this issue. If you need a sample project, I
am happy to provide my code.

Fortunatley there is a quite simple solution, to get the problem fixed,
however it requires modifications of the generated code which is kind of
inconvenient in a productive project stage. The solution is to modify the
corresponding DataContractSerializer (WriteObject-method) and use the
following method for the conversion of the byte-array:

However, in the long run it would be even nicer to transmit the byte-array
using an MTOM-encoding and I hope to be able to use that after your next
release (including the bugfixes).


Reply all
Reply to author
0 new messages