PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : SOAP-Request mit curl


rencarl
07.09.2009, 23:00:40
Hi,

ich bin von nusoap über PHP5 bei curl gelandet und sitze vor dem nächsten Problem. Wie bekomme ich einen Request hin? Mit dem Tool soapUI funktioniert ein Request. Ich erhalte zwar einen Fehler 200, aber das ist ok. Wie bekomme ich aber den gleichen Request mit curl hin? Mit curl erhalte ich nämlich als Response eine leere Seite, kein XML-Code.

Das ist der Request aus soapUI kopiert:POST https://dspone.deltavista.com/dspone/services/OrderCheckService HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "urn:orderCheck"
User-Agent: Jakarta Commons-HttpClient/3.1
Host: dspone.deltavista.com
Content-Length: 1385

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v001="http://www.deltavista.com/dspone/ordercheck-if/V001">
<soapenv:Header>
<messageContext xmlns="http://www.deltavista.com/dspone/ordercheck-if/V001">
<credentials>
<user>USERNAME</user>
<password>PASSWORD</password>
</credentials>
</messageContext>
</soapenv:Header>
<soapenv:Body>
<orderCheckRequest xmlns="http://www.deltavista.com/dspone/ordercheck-if/V001">
<product>
<name>CreditCheckConsumer</name>
<country>DEU</country>
</product>
<searchedCandidate>
<legalForm>PERSON</legalForm>
<address>
<!--Optional:-->
<name>Tamlin</name>
<!--Optional:-->
<firstName>Wallder</firstName>
<location>
<!--Optional:-->
<street>Wanderweg</street>
<!--Optional:-->
<house>6</house>
<!--Optional:-->
<city>Borgwedel</city>
<!--Optional:-->
<zip>24857</zip>
</location>
</address>
</searchedCandidate>
</orderCheckRequest>
</soapenv:Body>
</soapenv:Envelope>

Das ist der Response aus soapUI kopiert<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Server</faultcode>
<faultstring>ErrorMessage</faultstring>
<detail>
<ns1:error xmlns:ns1="http://www.deltavista.com/dspone/ordercheck-if/V001">
<ns1:code>200</ns1:code>
<ns1:messageText>Authorization exception for user USERNAME No access for product CreditCheckConsumer ErrorId=1252353036429</ns1:messageText>
</ns1:error>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>

Und das ist der PHP-Code, den ich bisher habe:<?php
$body = '<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v001="http://www.deltavista.com/dspone/ordercheck-if/V001">
<soapenv:Header>
<messageContext xmlns="http://www.deltavista.com/dspone/ordercheck-if/V001">
<credentials>
<user>USERNAME</user>
<password>PASSWORD</password>
</credentials>
</messageContext>
</soapenv:Header>
<soapenv:Body>
<orderCheckRequest xmlns="http://www.deltavista.com/dspone/ordercheck-if/V001">
<product>
<name>CreditCheckConsumer</name>
<country>DEU</country>
</product>
<searchedCandidate>
<legalForm>PERSON</legalForm>
<address>
<!--Optional:-->
<name>Tamlin</name>
<!--Optional:-->
<firstName>Wallder</firstName>
<location>
<!--Optional:-->
<street>Wanderweg</street>
<!--Optional:-->
<house>6</house>
<!--Optional:-->
<city>Borgwedel</city>
<!--Optional:-->
<zip>24857</zip>
</location>
</address>
</searchedCandidate>
</orderCheckRequest>
</soapenv:Body>
</soapenv:Envelope>';

$headers = array("POST https://dspone.deltavista.com/dspone/services/OrderCheckService HTTP/1.1\n",
"Accept-Encoding: gzip,deflate\n",
"Content-Type: text/xml;charset=UTF-8\n",
"SOAPAction: \"urn:orderCheck\"\n",
"User-Agent: Jakarta Commons-HttpClient/3.1\n",
"Host: dspone.deltavista.com\n");

//Die Session initialisieren
$ch = curl_init();

//Session Optionen setzen
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

//Ausführen der Aktionen
curl_exec($ch);

//Session beenden
curl_close($ch);

?>

Ausgabe siehe http://www.tob-tee.de/client.php

Was mache ich nur falsch?