Skip to content

Instantly share code, notes, and snippets.

@btfak
Created September 26, 2013 01:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save btfak/6708480 to your computer and use it in GitHub Desktop.
Save btfak/6708480 to your computer and use it in GitHub Desktop.
package main
import (
"net/http"
"encoding/xml"
"ieee1888"
"os"
"fmt"
"bytes"
"io/ioutil"
)
func main() {
t := new(ieee1888.SoapenvEnvelope)
t.Xmlns = "http://schemas.xmlsoap.org/soap/envelope/"
t.SoapenvBody.Ns2queryRQ.Xmlns = "http://soap.ieee1888.org/"
t.SoapenvBody.Ns2queryRQ.Transport.Xmlns = "http://www.biigroup.com"
t.SoapenvBody.Ns2queryRQ.Transport.Head.Query.Key.Id = "http://biigroup.com/room/2501/VA0"
t.SoapenvBody.Ns2queryRQ.Transport.Head.Query.Key.AttrName = "time"
t.SoapenvBody.Ns2queryRQ.Transport.Head.Query.Key.Select = "minimum"
output, err := xml.MarshalIndent(t, " ", " ")
req := []byte("<?xml version='1.0' encoding='UTF-8'?>\n")
req = append(req,output...)
if err != nil {
fmt.Printf("error: %v\n", err)
}
os.Stdout.Write(req)
buf := bytes.NewBuffer(req)
res,err := http.Post("http://10.1.1.166/axis2/services/IEEE1888Storage","text/xml;charset=UTF-8",buf)
if err ==nil{
h, _ := ioutil.ReadAll(res.Body)
fmt.Println()
os.Stdout.Write(h)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment