Hallo, Momenteel ben ik bezig met een PHP SOAP API. Het is de bedoeling dat het script een sale order aanmaakt. Helaas doet hij dit niet. Weet iemand waar de fout kan zitten?
Volgende informatie is het voorbeeld vanaf de locatie waar de sale order geopend moet worden:
Dit is mijn huidige PHP script:PHP Code:
The following is a sample SOAP 1.1 request and response. The placeholders shown need to be replaced with actual values.
POST /egmb/GMBDataHandler.asmx HTTP/1.1
Host: www.gembird.nl
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://microsoft.com/webservices/CreateSalesOrder"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<CreateSalesOrder xmlns="http://microsoft.com/webservices/">
<login>string</login>
<password>string</password>
<warehouse>string</warehouse>
</CreateSalesOrder>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<CreateSalesOrderResponse xmlns="http://microsoft.com/webservices/">
<CreateSalesOrderResult>xml</CreateSalesOrderResult>
</CreateSalesOrderResponse>
</soap:Body>
</soap:Envelope>
PHP Code:
<?php
//Data, connection, auth
$dataFromTheForm = $_POST['CreateSalesOrder']; // request data from the form
$soapUrl = "http://www.gembird.nl/egmb/GMBDataHandler.asmx"; // asmx URL of WSDL
$soapUser = "dagaanbieding"; // username
$soapPassword = "2551ma"; // password
$soapWarehouse = "Gembird Almere"; // warehouse
// xml post structure
$xml_post_string = '<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<CreateSalesOrder xmlns="http://microsoft.com/webservices/">
<login>'.$soapUser.'</login>
<password>'.$soapPassword.'</password>
<warehouse>'.$soapWarehouse.'</warehouse>
</CreateSalesOrder >
</soap:Body>
</soap:Envelope>';
$headers = array(
"Content-type: text/xml;charset=\"utf-8\"",
"Accept: text/xml",
"Cache-Control: no-cache",
"Pragma: no-cache",
"SOAPAction: http://microsoft.com/webservices/CreateSalesOrder",
"Content-length: length",
"POST /egmb/GMBDataHandler.asmx HTTP/1.1",
"Host: www.gembird.nl",
);
$url = $soapUrl;
// PHP cURL for https connection with auth
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, $soapUser.":".$soapPassword); // username and password - declared at the top of the doc
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_post_string); // the SOAP request
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
// converting
$response = curl_exec($ch);
curl_close($ch);
// converting
$response1 = str_replace("<soap:Body>","",$response);
$response2 = str_replace("</soap:Body>","",$response1);
// convertingc to XML
$parser = simplexml_load_string($response2);
// user $parser to get your data out of XML response and to display it.
?>
- Php soap api
-
29-03-2013, 09:27 #1
- Berichten
- 57
- Lid sinds
- 19 Jaar
Php soap api
-
In de schijnwerper
Backlinks.nl - Groot assortiment | Bekijk NR. 1 voorbeelden <---Advertentieruimte5 PBN/Backlink Sites, Goede DAWebsite te koopAutoriteit links aangeboden | Hoge DR & DA + Duizenden bezoekers. Alle NICHES vrijwelOverige dealsWebsitedown.nl - Controleren of jou of andere websites online of offline zijnWebsite te koop -
18-05-2013, 08:21 #2
Control Alt Delete
- Berichten
- 73
- Lid sinds
- 13 Jaar
Re: Php soap api
Gebruik de standaard soapclient van php, dan gaat dit veel makkelijker. Overigens staat je wachtwoord in de bron code.
Plaats een
- + Advertentie
- + Onderwerp
Marktplaats
Webmasterforum
- Websites algemeen
- Sitechecks
- Marketing
- Domeinen algemeen
- Waardebepaling
- CMS
- Wordpress
- Joomla
- Magento
- Google algemeen
- SEO
- Analytics
- Adsense
- Adwords
- HTML / XHTML
- CSS
- Programmeren
- PHP
- Javascript
- JQuery
- MySQL
- Ondernemen algemeen
- Belastingen
- Juridisch
- Grafisch ontwerp
- Hosting Algemeen
- Hardware Info
- Offtopic