1

When I run my sample WCF application I get the following error in WCF Test Client window

This operation is not supported in the wcf test client because it uses type system.io.stream

I have ping method that uses Stream in my service implementation.

 public string Ping(Stream input)
        {
            var streamReader = new StreamReader(input);
            string streamString = streamReader.ReadToEnd();
            streamReader.Close();
            NameValueCollection nvc = HttpUtility.ParseQueryString(streamString);
            return string.IsNullOrEmpty(nvc["message"])
                ? "The 'message' key value pair was not received."
                : nvc["message"];
        }

in my web.config file I added

<basicHttpBinding>
        <binding name="HttpStreaming" maxReceivedMessageSize="67108864" transferMode="Streamed" > </binding>
      </basicHttpBinding>

To allow streaming. now when I run the application I get the above error. I googled and researched quite a bit. I used fiddler to track down the error and it was http error 415 which is confirming the above error coming from WCF Test Client.

Update: Here is my service contract

[ServiceContract]
public interface IService1
{
    [OperationContract]
    [WebInvoke(UriTemplate = "ping")]
    string Ping(Stream input);
}

Curl command I used

curl -x 127.0.0.1:8888 http://localhost:8000/Service1.svc/ping -d message=pong

Notice -x 127.0.0.1:8888 is for fiddler to capture the traffic

Here is fiddler result

# Result Protocol Host URL Body Caching Content-Type    Process Comments    Custom  
1 415   HTTP    localhost:8000  /Service1.svc/ping  0   private     curl:7440
DoodleKana
  • 2,106
  • 4
  • 27
  • 45
  • 1
    Have you tried using a generated proxy instead of the WCF test client? – Marc Gravell Aug 29 '13 at 23:52
  • Can you post the Raw request that you have captured using Fiddler. Also please do show us your Interface declaration – Rajesh Aug 30 '13 at 12:57
  • 1
    A list of features not supported by WCF Test Client http://stackoverflow.com/a/8568078/1160780 – Alberto Spelta Aug 30 '13 at 15:16
  • @AlbertoSpelta Most places I have read it supports Streaming. Here is one example http://msdn.microsoft.com/en-us/library/ms731913.aspx – DoodleKana Aug 30 '13 at 16:00
  • @Rajesh I have updated the post with fiddler response and the contract. – DoodleKana Aug 30 '13 at 16:01
  • Please refer to this SO post http://stackoverflow.com/questions/9451141/uploading-an-image-using-wcf-restful-service-full-working-example/9464778#9464778 for more information – Rajesh Aug 30 '13 at 16:08
  • So I used .Net webservice studio tool and found out that my service was expecting Byte array input and also @Alberto you are right WCF test client did not support Stream. I got pong back when I send byte array. But I want to be able to use Curl post method to send data to my service not Byte array. It needs to be in the post body as string. like Curl POST -d message=pong http://localhost:8000/Service1.svc/ping – DoodleKana Aug 30 '13 at 17:35

0 Answers0