tdldp Posted March 27, 2009 Share Posted March 27, 2009 Hello everyone... First say, i've search forum on "curl logging" "curl multipart" "curl Boundary" with no success in regards problems i'm facing... So my problem is the following : I send already in a synchronous process normal XML messages to a private Webservice (no url can be for moment provided), and manage to cope returns may it be simple xml answers or multipart/related answers : body (Soap xml message) and File (Pdf attachement) I must now send in an asynchronous process a multipart message, using cURL. It must send a Body (soap XML message) and a file (XML message attachement) to the same webservice, and i will receive in response a ticket which will allow me to grab response a few hours later... My problem is that i get an Error 500 through curl process, and i have no log that will allow me to analyse the problem... To start with here is my cURL Code : $this->headers[] = 'Accept: */*'; $this->headers[] = 'Connection: Keep-Alive'; $this->headers[] = 'Content-Type: multipart/related; type="text/xml"; charset=utf-8'; if (isset($_GET["action"])) {$this->headers[] = 'SOAPAction: '.$_GET["action"]; } $this->user_agent = 'IA/CODE'; $this->compression= 'gzip'; function post($url,$data,$fichier_xml,$mode, $prop, $ticket) { if (isset($mode) && $mode=="dep") { $Xpost_data=array(); $Xpost_data['body']='@/home/www/curl/'.$data; $Xpost_data['fichierDepot']='@/home/www/curl/'.$fichier_xml; } $process = curl_init($url); curl_setopt($process, CURLOPT_VERBOSE, '1'); $error_FH = fopen(getcwd()."/log_async_curl_verbose.log","a"); fwrite($error_FH,"\r\n".'=========================================='."\r\n"); fwrite($error_FH,"\r\n".date("r - ") .' Transaction'."\r\n"); curl_setopt($process, CURLOPT_STDERR, $error_FH); curl_setopt($process, CURLOPT_SSL_VERIFYHOST, '1'); curl_setopt($process, CURLOPT_SSL_VERIFYPEER, '1'); curl_setopt($process, CURLOPT_SSLCERT, getcwd().'/cert/cert.pem'); curl_setopt($process, CURLOPT_SSLKEY, getcwd().'/cert/cert.key'); curl_setopt($process, CURLOPT_HTTPHEADER, $this->headers); curl_setopt($process, CURLOPT_USERAGENT, $this->user_agent); curl_setopt($process, CURLOPT_ENCODING , $this->compression); curl_setopt($process, CURLOPT_TIMEOUT, 30); curl_setopt($process, CURLOPT_POST, 1); curl_setopt($process, CURLOPT_POSTFIELDS, $Xpost_data); curl_setopt($process, CURLOPT_RETURNTRANSFER, 1); curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($process, CURLOPT_FAILONERROR, 1); $return['code'] = curl_getinfo($process,CURLINFO_HTTP_CODE); $return['cr'] = curl_exec($process); $return['ce'] = curl_errno($process); $return['error'] = curl_error($process); curl_close($process); fclose($error_FH); return $return; } Here is my curl verbose log : * About to connect() to [HOST] port 443 (#0) * Trying xxx.xxx.x.xx... * connected * Connected to [HOST] (xxx.xxx.x.xx) port 443 (#0) * successfully set certificate verify locations: * CAfile: none CApath: /etc/ssl/certs * SSL connection using RC4-MD5 * Server certificate: * subject: /C=FR/ST=PARIS/L=PARIS/OU=something/O=something/CN=somehost * start date: 2008-07-16 08:30:44 GMT * expire date: 2009-07-17 08:30:37 GMT * common name: somehost (matched) * issuer: /OU=Organization Validation CA/O=GlobalSign/CN=GlobalSign Organization Validation CA * SSL certificate verify ok. > POST /axis/services/service HTTP/1.1 User-Agent: IA/CODE Host: [HOST] Accept-Encoding: gzip Accept: */* Connection: Keep-Alive SOAPAction: ActionGet Content-Length: 34646 Expect: 100-continue Content-Type: multipart/related; type="text/xml"; charset=utf-8; boundary=----------------------------87d5f513ea0a < HTTP/1.1 100 Continue * The requested URL returned error: 500 * Closing connection #0 And that's all i have concerning logs, and debugs... Just an error 500 without any other explanation... My questions are : 1- How do i debug this problem ??? What have i false 2- How can i know the exact content sent via cURL and do extensible debugging ??? 3- How do i solve this ??? Thks for any help provided... Tdldp Link to comment https://forums.phpfreaks.com/topic/151367-curl-several-problems-and-questions/ Share on other sites More sharing options...
tdldp Posted March 27, 2009 Author Share Posted March 27, 2009 Little up on this problem... I've made several checks on this problem : I've tried to check after curl process what was containing the $Xpost_data It contains strickly : $Xpost_data['body'] : @/home/www/curl/filename_body.xml $Xpost_data['fichierDepot'] : @/home/www/curl/filename_message.xml filename_body.xml (size : 446 bytes) contains following code : <?xml version='1.0' encoding='utf-8'?> <soapenv:Envelope xmlns:ns="http://[HOST]/DefinitionsServices" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body> <m:Service> <m:control> <m:code_partner>1324</m:code_partner> <m:code_service>IVS</m:code_service> <m:num_pack>8</m:num_pack> </m:control> </m:Service> </soapenv:Body> </soapenv:Envelope> filename_message.xml (size 33765 bytes) contains : <?xml version='1.0' encoding='utf-8'?> <m:Service xmlns:siv="http://[HOST]/DefinitionsServices" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://[HOST]/DefinitionsServices/brq_service.xsd "> <m:pack_header_control> <m:code_partner>1262</m:code_partenaire> <m:code_service>QSIV</m:code_miat> <m:file_name>filename_message.xml</m:file_name> <m:ref_schema_gb>frq_service_gb.xsd</m:ref_schema_gb> <m:ref_schema>frq_service.xsd</m:ref_schema> <m:num_pack>9</m:num_pack> <m:total_mess_numb>12</m:mess_numb> <m:date_trans>2009-03-27T16:14:02</m:date_trans> </m:pack_header_control> <m:msg_content> <m:msg_header_control> <m:mess_numb>1</m:mess_numb> <m:date>2008-12-01</m:date> </m:entete_control_msg> <m:msg_content_control> <m:name>Nanard</m:name> ...... <m:company>12345678912345</m:company> </m:msg_content_control> </m:msg_content> <m:msg_content> <m:msg_header_control> <m:mess_numb>1</m:mess_numb> <m:date>2008-12-01</m:date> </m:entete_control_msg> <m:msg_content_control> <m:name>Nanard</m:name> ...... <m:company>12345678912345</m:company> </m:msg_content_control> </m:msg_content> </m:Service> Webservice runs under AXISS 1.4 I've run wireshark (ethereal), to trace what's happening... And strangely, SSL Data sent (encrypted) is very light in comparison to data sent for SSL handshake... It would seem as of the size of the packet containing post data, that it sent Post_Vars not in multipart, but simply as a "plain text" file name message. Is this normal and how do i solve this ??? Another point that bothers me is that this webservice works perfectly when it is to send a simple xml $post var, not multipart... Let me therefore give you WSDL scheme... <message name="Service"> <part name="body" element="m:Service" /> <part name="fichierDepot" element="m:xmlMessageFichier" /> </message> <message name="ticket_Service"> <part name="body" element="m:ticket_Service" /> </message> <operation name="Service"> <input message="m:Service" /> <output message="m:ticket_Service" /> </operation> <operation name="Service"> <soap:operation soapAction="ActionGet" /> <input> <soap:body parts="body" use="literal" /> <mime:multipartRelated> <mime:part> <mime:content part="fichierDepot" type="application/octet-stream" /> </mime:part> </mime:multipartRelated> </input> <output> <soap:body parts="body" use="literal" /> </output> </operation> Am i doing things wrong regarding construction of my post data vars ??? Please do help me ... i'm turning nervous on this ... Tdldp Link to comment https://forums.phpfreaks.com/topic/151367-curl-several-problems-and-questions/#findComment-795308 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.