Consuming REST service

  • Thread starter Thread starter Nick
  • Start date Start date
N

Nick

I wasn't sure if this belonged in the C# group or not, but here goes. When I
call the service (not one I created - or have any control over) I get this
error:

Unrecognized charSet 'ISO-8859-1' in contentType.

Here is the calling code:

ChannelFactory<IMyInterface> factory = new
ChannelFactory<IMyInterface>("endpoint");
var proxy = factory.CreateChannel();
var response = proxy.MyFunction(param1);
((IDisposable)proxy).Dispose();

I'm using webHttpBinding. Any ideas? Thanks for any help, I really
appreciate it.

Thanks,
Nick
 
Hi Andrei,

Thank you very much for your help. Is there any way to set
WebMessageEncodingBindingElement in the .config file instead of doing it in
code?

I tried using that code, but now I get a new error:

Unable to deserialize XML body with root name 'Binary' and root namespace ''
(for operation 'MyFunction' and contract ('IMyInterface',
'http://tempuri.org/')) using XmlSerializer. Ensure that the type
corresponding to the XML is added to the known types collection of the
service.


Any ideas? I didn't find much when I searched. I don't have a great deal of
experience with all of this, so I really appreciate your help.

Thanks,
Nick


Andrei Varanovich said:
Hello Nick,

It was discussed here http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3270310&SiteID=1
Hope this help you.

Regards,
Andrei Varanovich [C# MVP]
I wasn't sure if this belonged in the C# group or not, but here goes.
When I call the service (not one I created - or have any control over)
I get this error:

Unrecognized charSet 'ISO-8859-1' in contentType.

Here is the calling code:

ChannelFactory<IMyInterface> factory = new
ChannelFactory<IMyInterface>("endpoint");
var proxy = factory.CreateChannel();
var response = proxy.MyFunction(param1);
((IDisposable)proxy).Dispose();
I'm using webHttpBinding. Any ideas? Thanks for any help, I really
appreciate it.

Thanks,
Nick
 
Hello Nick,

Honestly I didn't played much with this stuff, so can only guess.

Which type you are trying to serialize? I mean what is a return value of
the service method?

Can you please provide a complete stack trace for the exception you got?

Thanks,
Andrei
 
Hi Andrei,

Turns out I had an error in my config file when I first started. I haven't
had a chance to finish, but when I get it all figured out I'll let you know.

Thanks for your help, I really appreciate it.

Thanks,
Nick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top