0

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

Coral Doe
  • 1,925
  • 3
  • 19
  • 36
cguedel
  • 1,092
  • 1
  • 14
  • 28

2 Answers2

0

Requests and responses to a SOAP service must be in SOAP. That is to say, it must be XML.

You may encode your image in the returned XML as base64.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
0

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

cguedel
  • 1,092
  • 1
  • 14
  • 28