Consuming REST service

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?Tmljaw==?=

    Consuming REST service

    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< IMyInterfacefac tory = new
    ChannelFactory< IMyInterface>(" endpoint");
    var proxy = factory.CreateC hannel();
    var response = proxy.MyFunctio n(param1);
    ((IDisposable)p roxy).Dispose() ;

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

    Thanks,
    Nick
  • Andrei Varanovich [C# MVP]

    #2
    Re: Consuming REST service

    Hello Nick,

    It was discussed here http://forums.microsoft.com/MSDN/Sho...70310&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< IMyInterfacefac tory = new
    ChannelFactory< IMyInterface>(" endpoint");
    var proxy = factory.CreateC hannel();
    var response = proxy.MyFunctio n(param1);
    ((IDisposable)p roxy).Dispose() ;
    I'm using webHttpBinding. Any ideas? Thanks for any help, I really
    appreciate it.
    >
    Thanks,
    Nick

    Comment

    • =?Utf-8?B?Tmljaw==?=

      #3
      Re: Consuming REST service

      Hi Andrei,

      Thank you very much for your help. Is there any way to set
      WebMessageEncod ingBindingEleme nt 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 [C# MVP]" wrote:
      Hello Nick,
      >
      It was discussed here http://forums.microsoft.com/MSDN/Sho...70310&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< IMyInterfacefac tory = new
      ChannelFactory< IMyInterface>(" endpoint");
      var proxy = factory.CreateC hannel();
      var response = proxy.MyFunctio n(param1);
      ((IDisposable)p roxy).Dispose() ;
      I'm using webHttpBinding. Any ideas? Thanks for any help, I really
      appreciate it.

      Thanks,
      Nick
      >
      >
      >

      Comment

      • Andrei Varanovich [C# MVP]

        #4
        Re: Consuming REST service

        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,
        >
        Thank you very much for your help. Is there any way to set
        WebMessageEncod ingBindingEleme nt 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

        Comment

        • =?Utf-8?B?Tmljaw==?=

          #5
          Re: Consuming REST service

          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

          "Andrei Varanovich [C# MVP]" wrote:
          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,

          Thank you very much for your help. Is there any way to set
          WebMessageEncod ingBindingEleme nt 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
          >
          >
          >

          Comment

          Working...