質問

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

役に立ちましたか?

解決 2

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

他のヒント

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top