in reply to convert SOAP message to perl data structure

Hi caribesoft, Maybe someone else knows exactly, but i need more information if I am going to be able to help you. What kind of data are you getting back in your "Response"? It is possible to get information back from a SOAP::Lite service and put it into a MySQL table. For example:
#makes the new SOAP::Lite object my $soap_obj = new SOAP::Lite -> uri ('http://') -> proxy ('http://') -> service(); #gets the response and stores it in a scalar my $response = $soap_obj->get_response(); #creates the statement for the SQL insert my $statement = $bdbi->form_push_SQL ($response); #if bdbi is a database connection then it does $statement $bdbi->{'database_handle'}->Query($statement);
I hope this helps even if it is just a little, and if anyone else has anything to say I would definately take their comments into consideration since I am no expert by any means and this is just a general case that worked for me since you didn't provide much to go on.

Replies are listed 'Best First'.
Re^2: convert SOAP message to perl data structure
by caribesoft (Initiate) on Jul 12, 2006 at 03:35 UTC

    Hi mav3067 :

    Thanks for your help, this is what I get as "Response" :

    <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" +xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance " xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body><consultaUnManifiestoResponse xmlns="http://Recintos/Servic +iosWebXml/"><consultaUnManifiestoResult> <error>0</error> <descripError /><registros>1</registros> <man><nTrans>465</nTrans> <cTransp>HYBU</cTransp> <idTransp>7116834 </idTransp> <nomBuque>ARGOSY</nomBuque> <numViaje>416 SB MEX</numViaje> <fecEstimada>15/12/2004 12:00:00 AM</fecEstimada> <tipoOper>1</tipoOper> <lineaNaviera>NAVIERA VICANE</lineaNaviera> <fecRecibe>14/12/2004 4:09:46 PM</fecRecibe> <cuAduana>53</cuAduana> <cuPais>ATG</cuPais> <cuPuerto>PMS</cuPuerto> <cuEntidadMan>1158</cuEntidadMan> <casos /></man><manifiestos><a nyType xsi:type="ObjManifiesto"> <nTrans>465</nTrans> <cTransp>HYBU</cTransp> <idTransp>7116834 </idTransp> <nomBuque>ARGOSY</nomBuque> <numViaje>416 SB MEX</numViaje> <fecEstimada>15/12/2004 12:00:00 AM</fecEstimada> <tipoOper>1</tipoOper> <lineaNaviera>NAVIERA VICANE</lineaNaviera> <fecRecibe>14/12/2004 4:09:46 PM</fecRecibe> <cuAduana>53</cuAduana> <cuPais>ATG</cuPais><cuPuerto>PMS</cuPuerto> <cuEntidadMan>1158</cuEntidadMan> <casos /></anyType></manifiestos> </consultaUnManifiestoR esult></consultaUnManifiestoResponse></soap:Body></soap:Envelope>

    How can I convert to Perl data structure or insert into a Mysql table ??

    Again, thanks for your help,

    Caribesoft.

    20060712 Janitored by Corion: Added formatting, code tags, as per Writeup Formatting Tips

      Is that really what you are getting back? This doesn't appear to "well formed XML" as there is a closing </anyType> without a corresponding opening one. If it really is what you are getting back then you will need to fix that problem before attempting to process it.

      /J\

        HI : Thanks for your comments, I have read a lot of SOAP and XML but I cannont undertand yet how can I get the data and transfer to Perl data stucture. If you see the label <anytype xsi:type="objManifiesto"> exist after <manifiestos> ... In my script I have the above line, is this the one that display the dat ? code if($response->code == 200) { print $response->as_string; } How can I get each field from $response-> ? Best regards, Caribesoft /code