title: Is it possible to invoke a Java Webservice from a C# client (RestClient)
body: <p>I am trying to invoke a webservice using a C# client. The current code in C# is to create the RestClient and send the request. </p>
  
  <pre><code>string url = "http://test:8080/";
  var client = new RestClient(url);
  var req = new RestRequest("test/", Method.POST);
  req.AddParameter("", data, ParameterType.RequestBody);
  
  
  //Add authentication to request
  
  //execute client request
  IRestResponse testresponse = client.Execute(req);
  </code></pre>
  
  <p>The following is the code from the web service.</p>
  
  <pre><code>    @WebService(endpointInterface = "com.test.ws.test")
      public class TestServiceImpl implements TestService
      {
      private TestUpdater TestUpdater;
  
      private Posting1Status postingStatus;
  
      @Override
      public Posting1Status setTestentry(Testentry entry) 
      {
          MessageContext mctx = wsctx.getMessageContext();
          //get detail from request headers
          Map http_headers = (Map) mctx.get(MessageContext.HTTP_REQUEST_HEADERS);
          List userList = (List) http_headers.get("Username");
          List passList = (List) http_headers.get("Password");
  
          String username = "";
          String password = "";
  
          if(userList!=null){
                //get username
                username = userList.get(0).toString();
          }
  
          if(passList!=null){
                //get password
                password = passList.get(0).toString();
          }     
  
          if (username.equals("roji") &amp;&amp; password.equals("roji1"))
          {
          }
      }
  </code></pre>
  
  <p>Before adding this authentication code the C# client was able to access the webservice and run the code as expected. But i cannot seem to find the headers or i'm passing them in incorrectly. Does anyone have any solutions maybe, or if i'm doing this the correct way.  </p>