Hello,
I have an NVT IP Cam. On the PC i'am testing onvif soap traces on POSTMAN for the controling PTZ actions. Traces works perfectly. But i wanted to control it from arduino, i have ENC28j60 ethernet module, trying to post this soap request by modifiying twitter example skecth but not working, what am i doing wrong?
POSTMAN Request
Request Response
#include <EtherCard.h>
byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
const char website[] PROGMEM = "192.168.1.10";
static byte hisip[] = { 192,168,1,10 };
static byte session;
byte Ethernet::buffer[750];
Stash stash;
static void sendTo() {
Serial.println("Sending...");
byte sd = stash.create();
stash.print("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\r");
stash.print("<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:tptz=\"http://www.onvif.org/ver20/ptz/wsdl\" xmlns:tt=\"http://www.onvif.org/ver10/schema\">\n\r");
stash.print("<soap:Body>\n\r");
stash.print("<tptz:ContinuousMove>\n\r");
stash.print("<tptz:ProfileToken>000</tptz:ProfileToken>\n\r");
stash.print("<tptz:Velocity>\n\r");
stash.print("<tt:Zoom x=\"1\"/>\n\r");
stash.print("</tptz:Velocity>\n\r");
stash.print("</tptz:ContinuousMove>\n\r");
stash.print("</soap:Body>\n\r");
stash.println("</soap:Envelope>\n\r");
stash.save();
int stash_size = stash.size();
// Compose the http POST request, taking the headers below and appending
// previously created stash in the sd holder.
Stash::prepare(PSTR("POST http://$F:8899/onvif/PTZ HTTP/1.0" "\r\n"
"Host: $F" "\r\n"
"Content-Type: text/xml; charset=utf-8" "\r\n"
"SOAPAction: \"http://192.168.1.10:8899/onvif/PTZ" "\r\n"
"Content-Length: $D" "\r\n"
"\r\n"
"$H"),
website, website, stash_size, sd);
// send the packet - this also releases all stash buffers once done
// Save the session ID so we can watch for it in the main loop.
session = ether.tcpSend();
}
void setup () {
Serial.begin(57600);
Serial.println("\n[Twitter Client]");
if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
Serial.println(F("Failed to access Ethernet controller"));
if (!ether.dhcpSetup())
Serial.println(F("DHCP failed"));
ether.printIp("IP: ", ether.myip);
ether.printIp("GW: ", ether.gwip);
ether.printIp("DNS: ", ether.dnsip);
if (!ether.dnsLookup(website))
Serial.println(F("DNS failed"));
ether.printIp("SRV: ", ether.hisip);
sendTo();
}
void loop () {
ether.packetLoop(ether.packetReceive());
const char* reply = ether.tcpReply(session);
if (reply != 0) {
Serial.println("Got a response!");
Serial.println(reply);
}
}