![]() |
HTTP Post Wawision
Guten Abend,
ich würde gerne auf die Schnittstelle einer Warenwirtschaft (Wawision) zugreifen. Die Schnittstellenbeschreibung ist hier: ![]() und hier der Auszug aus der API Beschreibung um einen Auftrag anzulegen:
Code:
Mein Code ist wie folgt:
<?php
$hash = generateHash(); $xml = "<kundennummer>23243</kundennummer>"; $output_xml = SendRequest("AuftragCreate",$xml,$hash); function generateHash() { $initKey = 'neijfj38734hujfie'; $remoteDomain = 'http://192.168.0.28'; $date = gmdate('dmY'); $hash = ""; for($i = 0; $i <= 200; $i++) $hash = sha1($hash . $initKey . $remoteDomain . $date); return $hash; } function SendRequest($methodname,$xml,$hash) { $url = 'http://192.168.0.28/wawision/16.3/www/index.php?module=api&action='.$methodname.'&hash='.$hash; $xml = '<?xml version="1.0" encoding="UTF-8"?> <request> <status> <function>'.$methodname.'</function> </status> <xml>'.$xml.'</xml> </request>'; $data = array('xml' => $xml, 'md5sum' => md5($xml)); // use key 'http' even if you send the request to https://... $options = array( 'http' => array( 'header' => "Content-type: application/x-www-form-urlencoded\r\n", 'method' => 'POST', 'content' => http_build_query($data), ), ); $context = stream_context_create($options); $result = file_get_contents($url, false, $context); return $result; } $obj = simplexml_load_string($output_xml); echo "<pre>"; print_r($obj); echo "</pre>"; ?>
Delphi-Quellcode:
In das Memo2 habe ich jetzt testweise alle möglichen xml varianten eingetippt, um die kundennummer hinzuzfügen <kundennummer>10000</kundennummer>
XML := TStringlist.Create();
XML.Add(Memo2.Text); Methodname := 'AuftragCreate'; hash := 'xxxxxx'; http := TIdHTTP.Create(nil); http.HandleRedirects := true; http.ReadTimeout := 500000; http.Request.Accept := 'http'; http.Request.ContentType := 'application/x-www-form-urlencoded\r\n'; Memo1.Text := http.Post('http://www.wawision.biz/kis/RwN9rBC4B9PQDMtV5geAXcrxB9yKdE/www/index.php?module=api&action='+Methodname+'&hash='+hash+'', XML) Leider wird hier immer nur ein Auftrag ohne der Kundennummer angelegt. Bin wirklich ratlos und hoffe, jemand kann helfen. Lg |
AW: HTTP Post Wawision
Bin grade aus dem Kopf nicht sicher, wie das mit den Indys geht, aber im PHP wird das XML ja zuerst nochmal in ein zweites Array unter dem namen "xml" reingepackt. Daneben existiert noch der Wert "md5sum". Das hast du in deinem Delphi Code so bisher nicht abgebildet. Das "\r\n" im
Delphi-Quellcode:
ist auch falsch und solltest du einfach weglassen.
ContentType
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 16:50 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz