dfowler Posted October 15, 2008 Share Posted October 15, 2008 Hey guys, I have several SOAP requests that I have been asked to convert to cURL. How easy is this to do? Are there any shortcuts methods? Here is just one of the request: <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:con="Conferencing"> <soap:Header/> <soap:Body> <con:SecurityValidateEmployeeLogOn> <con:request> <con:WebId></con:WebId> <con:Password></con:Password> <con:EmployeeLogin></con:EmployeeLogin> <con:EmployeePassword></con:EmployeePassword> </con:request> </con:SecurityValidateEmployeeLogOn> </soap:Body> </soap:Envelope> Thanks for any help! Link to comment https://forums.phpfreaks.com/topic/128553-soap-with-curl/ Share on other sites More sharing options...
dfowler Posted October 15, 2008 Author Share Posted October 15, 2008 No help huh? If I just had an idea how to do this one request I know I could tackle the other ones easily. Link to comment https://forums.phpfreaks.com/topic/128553-soap-with-curl/#findComment-666352 Share on other sites More sharing options...
dfowler Posted October 16, 2008 Author Share Posted October 16, 2008 Hello? Could somebody just point me in the right direction, I'm not looking for a handout. Link to comment https://forums.phpfreaks.com/topic/128553-soap-with-curl/#findComment-667050 Share on other sites More sharing options...
dfowler Posted October 16, 2008 Author Share Posted October 16, 2008 Ok, I've been working on this by myself, and here is where I am now: <?php ini_set('error_reporting', E_ALL); $content = '<?xml version="1.0" encoding="utf-8" ?> <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"> <soap12:Body> <SecurityValidateEmployeeLogOn xmlns="Conferencing"> <request> <EmployeeLogin>?</EmployeeLogin> <EmployeePassword>?</EmployeePassword> </request> </SecurityValidateEmployeeLogOn> </soap12:Body> </soap12:Envelope>'; $content = utf8_encode($content); $content_length = strlen($content); $header = array( "POST ".$url." HTTP/1.1\r\n", "Host: ".$host."\r\n", "Content-Type: application/soap+xml; charset=utf-8\r\n", "Content-Length: ".$content_length."\r\n", $content ); $ch = curl_init($url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); curl_setopt($ch, CURLOPT_POSTFIELDS, $content); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($ch); curl_close($ch); echo $output; ?> I left off the $url and $host on purpose. I am getting a connect, but I keep getting the message "Length Required". Can anybody help me from here? Link to comment https://forums.phpfreaks.com/topic/128553-soap-with-curl/#findComment-667496 Share on other sites More sharing options...
DarkWater Posted October 16, 2008 Share Posted October 16, 2008 Try removing the CURL_POSTFIELDS curl_setopt() call. Link to comment https://forums.phpfreaks.com/topic/128553-soap-with-curl/#findComment-667500 Share on other sites More sharing options...
dfowler Posted October 17, 2008 Author Share Posted October 17, 2008 Try removing the CURL_POSTFIELDS curl_setopt() call. Still getting "Length Required" Link to comment https://forums.phpfreaks.com/topic/128553-soap-with-curl/#findComment-668012 Share on other sites More sharing options...
dfowler Posted October 20, 2008 Author Share Posted October 20, 2008 I took out the headers, and now I am getting a '1'. This is odd as I am supposed to get an xml response..... Link to comment https://forums.phpfreaks.com/topic/128553-soap-with-curl/#findComment-670043 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.