none
uritemplate for restful service; syntax question RRS feed

  • Question

  • Hi,

    I have the following service:

            //POST Operation
            [OperationContract]
            [WebInvoke(Method = "POST", UriTemplate = "svcrVCIWriteValueAny?sType={sType}&sPtName={sPtName}&sVECName={sVECName}&sField={sField}&sUserName={sUserName}&sVal={sVal}&to_ccf={to_ccf} ")]
            String svcrVCIWriteValueAny(String sType, String sPtName, String sVECName,
                                            String sField, String sUserName, String sVal, Boolean to_ccf);
    

    When trying to use any service within the namespace, I get the following error:

    Server Error in '/' Application.
    
    The UriTemplate 'svcrVCIWriteValueAny?sType={sType}&sPtName={sPtName}&sVECName={sVECName}&sField={sField}&sUserName={sUserName}&sVal={sVal}&to_ccf={to_ccf} ' is not valid; each portion of the query string must be of the form 'name=value', when value cannot be a compound segment. See the documentation for UriTemplate for more details. 
      Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
    
     Exception Details: System.InvalidOperationException: The UriTemplate 'svcrVCIWriteValueAny?sType={sType}&sPtName={sPtName}&sVECName={sVECName}&sField={sField}&sUserName={sUserName}&sVal={sVal}&to_ccf={to_ccf} ' is not valid; each portion of the query string must be of the form 'name=value', when value cannot be a compound segment. See the documentation for UriTemplate for more details.
    
    Source Error: 
    
    
     An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  
    
    Stack Trace: 
    
    
    
    [InvalidOperationException: The UriTemplate 'svcrVCIWriteValueAny?sType={sType}&sPtName={sPtName}&sVECName={sVECName}&sField={sField}&sUserName={sUserName}&sVal={sVal}&to_ccf={to_ccf} ' is not valid; each portion of the query string must be of the form 'name=value', when value cannot be a compound segment. See the documentation for UriTemplate for more details.]
       System.UriTemplateQueryValue.CreateFromUriTemplate(String value, UriTemplate template) +3113514
       System.UriTemplate..ctor(String template, Boolean ignoreTrailingSlash, IDictionary`2 additionalDefaults) +975
       System.ServiceModel.Dispatcher.UriTemplateClientFormatter.Populate(Dictionary`2& pathMapping, Dictionary`2& queryMapping, Int32& totalNumUTVars, UriTemplate& uriTemplate, OperationDescription operationDescription, QueryStringConverter qsc, String contractName) +143
       System.ServiceModel.Web.WebServiceHost.IsRawContentMapperCompatibleDispatchOperation(OperationDescription operation, Int32& numStreamOperations) +184
       System.ServiceModel.Web.WebServiceHost.SetRawContentTypeMapperIfNecessary(ServiceEndpoint endpoint, Boolean isDispatch) +244
       System.ServiceModel.Web.WebServiceHost.OnOpening() +434
       System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) +265
       System.ServiceModel.Channels.CommunicationObject.Open() +36
       System.ServiceModel.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity) +90
       System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +598
    
    [ServiceActivationException: The service '/VCIWCFRServices' cannot be activated due to an exception during compilation.  The exception message is: The UriTemplate 'svcrVCIWriteValueAny?sType={sType}&sPtName={sPtName}&sVECName={sVECName}&sField={sField}&sUserName={sUserName}&sVal={sVal}&to_ccf={to_ccf} ' is not valid; each portion of the query string must be of the form 'name=value', when value cannot be a compound segment. See the documentation for UriTemplate for more details..]
       System.Runtime.AsyncResult.End(IAsyncResult result) +485948
       System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +174
       System.ServiceModel.Activation.AspNetRouteServiceHttpHandler.EndProcessRequest(IAsyncResult result) +6
       System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +129
    
      
    
    
    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34212  

    I don't see a syntax error.

    Please help.

    Boyd


    BDM

    Tuesday, February 24, 2015 6:32 PM

Answers

All replies