I ended up using a normal WebRequest to retrieve the image.
Receiving an image from a SOAP service results in ProtocolException
-
01-12-2021 - |
質問
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'
- /Guide/xsd?type=Program: http://pastebin.com/mF8N35Hm
- /Guide/xsd?type=ProgramGuide: http://pastebin.com/rxscA3uT
- /Guide/xsd?type=ArrayOfChannelInfo&name=ChannelInfo: http://pastebin.com/sRJmQp3R
- /Guide/xsd?type=ChannelInfo: http://pastebin.com/3Y3StCEW
- /Guide/xsd?type=ArrayOfProgram&name=Program: http://pastebin.com/sPaywD2J
- /Guide/xsd?type=ArtworkInfoList: http://pastebin.com/24bLSiKg
- /Guide/xsd?type=ArrayOfArtworkInfo&name=ArtworkInfo: http://pastebin.com/HDjFvNFR
- /Guide/xsd?type=ArtworkInfo: http://pastebin.com/0YMWMWig
I think these are all
解決 2
他のヒント
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.