func callSOAP(body string, ordertype string) (string, error) {
	// reload properties in case details have changed
	props, err := file.LoadProperties(filepath.Join(currentfolder, "rclinvoices.json"))

	switch strings.ToLower(ordertype) {
	case "pod", "invoice":
		url = file.GetProperty(props, "url")
		username = file.GetProperty(props, "userid")
		passwd = file.GetProperty(props, "password")
	case "order":
		url = file.GetProperty(props, "order_url")
		username = file.GetProperty(props, "order_userid")
		passwd = file.GetProperty(props, "order_password")
	default:
		return "", errors.New("Invalid OrderType : " + ordertype)
	}

	Info.Println("Posting to " + url)
	client := &http.Client{}
	req, err := http.NewRequest("POST", url, strings.NewReader(body))
	if err != nil {
		panic(err)
	}
	Info.Printf("User: %s, Password:%s", username, passwd)
	req.SetBasicAuth(username, passwd)
	req.Header.Set("Content-Type", "text/xml")
	resp, err := client.Do(req)
	if err != nil {
		return "", err
	}
	Info.Printf("Response: %v", resp)
	if resp.StatusCode != 200 {
		return fmt.Sprint(resp), errors.New(resp.Status)
	}
	result := fmt.Sprintf("%v", resp)
	if strings.Contains(result, "com.sap.engine.security.authentication") {
		return result, errors.New(fmt.Sprint("Check rclinvoices.json, Seemed to receive authentication error when calling PI"))
	}
	return "", nil
}
// ===================== Generic code ======================
// Below is here for legacy purposes, should eventually use our tools, (as pioneer)
func main() {
	//_ = "breakpoint"
	// Get starting flags
	flag.BoolVar(&stdout, "stdout", false, "Log to stdout")
	flag.StringVar(&currentfolder, "folder", "", "Set current folder")
	flag.Parse()

	// initialise logs
	Info, Error = file.InitLogs(stdout, logfolder, swfTasklist)
	Info.Println("Starting " + swfIdentity + " Version:" + Version + " ==>")

	// Load properties json file	Info.Println("Loading properties from " + filepath.Join(currentfolder, "rclinvoices.json"))
	props, err := file.LoadProperties(filepath.Join(currentfolder, "rclinvoices.json"))
	if err != nil {
		Error.Fatal("Could not load properties" + filepath.Join(currentfolder, "rclinvoices.json"))
		return
	}
	swfTasklist = file.GetProperty(props, "supplierid")

	// Initialise workflow
	swfsvc := swf.New(session.New(), &aws.Config{Region: aws.String("us-east-1")})
	params := &swf.PollForActivityTaskInput{
		Domain: aws.String(swfDomain), //
		TaskList: &swf.TaskList{ //
			Name: aws.String(swfTasklist), //
		},
		Identity: aws.String(swfIdentity),
	}
	Info.Println(params)

	// loop forever while polling for work
	x := 0
	for {
		resp, err := swfsvc.PollForActivityTask(params)
		if err != nil {
			Error.Fatalf("error: unable to poll for decision: %v\n", err)
		}

		// if we do not receive a task token then 60 second time out occured so try again
		//_ = "breakpoint"
		if resp.TaskToken != nil {
			if *resp.TaskToken != "" {
				a := &activity{
					svc:   swfsvc,
					tt:    *resp.TaskToken,
					input: *resp.Input,
					name:  *resp.ActivityType.Name,
				}
				result, details, err := a.handleActivity()
				if err != nil {
					Info.Printf("Error sending POD: \n" + a.input)
					a.taskFailed(err.Error(), details)
				} else {
					Info.Println("Task completed OK")
					a.taskCompleted(result)
				}
			}
		} else {
			// Every 20 minutes check in, just so we have some log activity
			x++
			if x == 20 {
				Info.Printf("debug - no activity required\n")
				x = 0
			}
		}
	}
}