Search code examples
wcfsoapprotocolexception

Receiving an image from a SOAP service results in ProtocolException


I'm trying to access a SOAP service that returns an image for a request. The content-type is image/png. Now I get the following ProtocolException when invoking the method:

The content type image/png of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were:

After that a few bytes follow that probably belong to the image.

I generated the service reference using the VS 2012 'add service reference' dialog. I found several similar questions, however none of these seem to be targeted at actually getting an image from a service.

How can I change the content-type of my binding?

Edit: Added the WSDL here: http://pastebin.com/NRvJfstU, I'm trying to invoke the operation 'GetChannelIcon'

I think these are all


Solution

  • I ended up using a normal WebRequest to retrieve the image.