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

14 views
Skip to first unread message

Tim G.

unread,
May 25, 2010, 4:51:01 AM5/25/10
to
Hello,

(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:
http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/fae9dbc5-c83e-42b2-808e-1a393e621bb8).

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:
System.ConvertBase64.ToBase64String(...);


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).


Regards,
Tim


Reply all
Reply to author
Forward
0 new messages