What does my WCF URI Look like? RRS feed

  • Question

  • I have a WCF service in wich i can call a PTZ (Pan,Tilt,Zoom) function across a network. This works well but I am asked to describe the actual URI that is sent. The awesome thing about a WebInvoke is that I don't have to worry about all of that... until now.

    I open the host on my server:

    WebServiceHost host = new WebServiceHost((WCFServer.Instance), new Uri("http://" + localhost + ": " + Port + "/ProjectName"));

    And then I call the PTZ function from a client:

    [WebInvoke(Method = "POST", UriTemplate = "PTZ", BodyStyle = System.ServiceModel.Web.WebMessageBodyStyle.Wrapped), Description("")]

    void SelectCamera(UInt16 CameraID);

    Some code is missing here but it all works fine and I think this is all that's needed for my question.

    I know the looks of the uri can vary depending on what's defined in the UriTemplate but I am not allowed to change it anymore so I have to go with what's already used.

    I can call a parameterless function from my web browser without a problem but I get stuck on functions with parameters.

    How does the URI look when I call the PTZ function in my case?

    Thursday, February 26, 2015 10:05 AM


  • Hi RikG92,

    >>How does the URI look when I call the PTZ function in my case?

    I see that you have defined the following:

    [WebInvoke(Method = "POST", UriTemplate = "PTZ", BodyStyle = System.ServiceModel.Web.WebMessageBodyStyle.Wrapped), Description("")]

    Then when calling the PTZ function, the URI should be like this:

    http:// localhost:8080/ProjectName/PTZ

    Best Regards,
    Amy Peng

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, February 27, 2015 10:06 AM