title: service/method request ill-formed
body: <p>I am new very to go and RPC and I can't seem to figure out what is causing my client to panic with:</p>
  
  <blockquote>
    <p>2020/01/04 14:34:29 rpc: service/method request ill-formed: API:Greeting</p>
  </blockquote>
  
  <h1>Here's what my client looks like:</h1>
  
  <h3>main.go</h3>
  
  <pre><code>func main() {
      serverAddress := "localhost"
      serverPort := "4040"
  
      client, err := rpc.DialHTTP("tcp", serverAddress+":"+serverPort)
      if err != nil{
          log.Fatal(err)
      }
  
      fmt.Println("start")
      var results string
  
      a := "www.google.com"
      err = client.Call("API:Greeting", a, &amp;results)
  
      if err != nil{
          log.Fatal(err)
      }
  
      fmt.Println(results)
      fmt.Println("end")
  }
  </code></pre>
  
  <h1>And here is what my server looks like (on a different project):</h1>
  
  <h3>main.go</h3>
  
  <pre><code>package main
  import (
      "fmt"
      "log"
      "net"
      "net/http"
      "net/rpc"
  )
  
  type API int
  
  func (api *API) Greeting(empty string, result *string) error {
      fmt.Println("called Greeting")
      *result = "Hello"
      fmt.Println("returning Greeting")
      return nil
  }
  
  func main() {
      serverPort := "8080"
      api := new(API)
      err := rpc.Register(api)
      if err != nil {
          log.Fatal("error registering API", err)
      }
  
      rpc.HandleHTTP()
  
      listener, err := net.Listen("tcp", ":"+serverPort)
  
      if err != nil {
          log.Fatal("Listener error", err)
      }
      log.Printf("serving rpc on port %s", serverPort)
      err = http.Serve(listener, nil)
  
      if err != nil {
          log.Fatal("error serving: ", err)
      }
  }
  </code></pre>
  
  <p>It would be great if someone could point out what I am doing wrong.</p>