\"magiic\": 123}";
Just something worth mentioning you are using /ii/.
Heres the controller and the object definition. As mentioned, it works fine with a test in postman.
@RestController public class SignalController { @PostMapping(value = "/postSignal", consumes = "application/json") public ResponseEntity<String> createSignal(@RequestBody Position position) { System.out.println(position); return new ResponseEntity<String>("Signal recieved", HttpStatus.OK); } } public class Position { private String signal; private double openPrice; private double sl; private double tp; private int magic; public Position(String signal, double openPrice, double sl, double tp, int magic) { this.signal = signal; this.openPrice = openPrice; this.sl = sl; this.tp = tp; this.magic = magic; } public String getSignal() { return signal; } public void setSignal(String signal) { this.signal = signal; } public double getOpenPrice() { return openPrice; } public void setOpenPrice(double openPrice) { this.openPrice = openPrice; } public double getSl() { return sl; } public void setSl(double sl) { this.sl = sl; } public double getTp() { return tp; } public void setTp(double tp) { this.tp = tp; } public int getMagic() { return magic; } public void setMagic(int magic) { this.magic = magic; } @Override public String toString() { return "Position{" + "signal='" + signal + '\'' + ", openPrice=" + openPrice + ", sl=" + sl + ", tp=" + tp + ", magic=" + magic + '}'; } }
The error 5039 occurs because you are calling printf in a wrong way - you're adding integers to strings (you should pass each value as parameter instead, separating the string to be formatted and each value by commas) and are not passing any format specifier so the function can actually convert the passed parameters to the specified format. It has nothing to do with an request error.
Use Print instead of printf for convenience and separate each value by commas in the function call. Then we can see which error the WebRequest function is actually returning.
The error 5039 occurs because you are calling printf in a wrong way - you're adding integers to strings (you should pass each value as parameter instead, separating the string to be formatted and each value by commas) and are not passing any format specifier so the function can actually convert the passed parameters to the specified format. It has nothing to do with an request error.
Use Print instead of printf for convenience and separate each value by commas in the function call. Then we can see which error the WebRequest function is actually returning.
Wow never thought about an error at the print function...... The error code is gone now, meaning its 0. But that does not give me any hint whats wrong:
Here is the full Print result:
2024.05.03 17:47:33.459 SignalSender (EURCAD,M1) Response Code: 400
2024.05.03 17:47:33.459 SignalSender (EURCAD,M1) LastError Code: 0
2024.05.03 17:47:33.459 SignalSender (EURCAD,M1) Result String: <!doctype html><html lang="en"><head><title>HTTP Status 400 – Bad Request</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 400 – Bad Request</h1></body></html>
Hey Guys,
I try to write my first EA with serverside communication. Ive wrote a simple java spring boot application with a rest controller working fine in testing with postman. If I try to send a POST with the WebRequest function I am facing an error.
input string url = "localhost:8080/postSignal";WebRequest is now allowing to use a non-standard port ?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hey Guys,
I try to write my first EA with serverside communication. Ive wrote a simple java spring boot application with a rest controller working fine in testing with postman. If I try to send a POST with the WebRequest function I am facing an error.
Response Code: 400
LastError Code: 5039
The code is documented as ERR_TOO_MANY_PARAMETERS. I dont get what I am doing wrong here.