Tuesday, September 20, 2011

WCF: enable rest operation

I need to call a WCF service through Get, Put and Post operation. And there are some settings needed  in the service contract and web.config.

Methods can be called  through the following URL:

http://ip/sitename/Service1.svc/user/post/{value}

For service contract:
 [ServiceContract]
    public interface IService1
    {
        [OperationContract]
        [WebGet(UriTemplate = "?value={value}")]
        string GetData(int value);
        [OperationContract]
        [WebInvoke(Method = "POST", UriTemplate = "post/{value}")]
        string PostData(String value);
        [OperationContract]
        [WebInvoke(Method = "PUT", UriTemplate = "put/{value}")]
        string PutData(string value);
    }
For web.config:

      
          
              
              
              
          
      
     
        
            
                
            
        
        
        
          
          
        
      
    
    
  

SSH SCP put command workflow: unable to put file

I run the default SCP put command workflow in the orchestrator and the workflow finishes without any error code. But I cannot find the file in the destination.

In the API Explorer, I do some searching. I discover the description of SSHSession which is used to replace SSHCommand.



//original code
var sshCmd = new SSHCommand(ip,username,password) ;
sshCmd.putFile("C:\\orchestrator\\hoho", "//") + "||");
var error = sshCmd.getError() ;
sshCmd.disconnect();


//updated code
var sshSession = new SSHSession(ip,username);
sshSession.connectWithPassword(password);
sshSession.putFile("C:\\orchestrator\\hoho", "hoho");
sshSession.disconnect();