http://qs321.pair.com?node_id=598175

shonorio has asked for the wisdom of the Perl Monks concerning the following question:

Dear mongers, I got in trouble trying to help a friend of mime with a brazilian air company .NET webservices, because this work is hardest than I could imagine.

Trying to understand the complex wdsl available at http://200.185.23.93:8003/BWS/FlightInformation.asmx I wrote a C# code to access and debug the soap communication with TCPTrace basead on How to Call a .NET-based Web Service Using the SOAP::Lite Perl Library document that get the log bellow.

<?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> <FlightInformation xmlns="http://bws.voegol.com.br"> <valor> <header> <CodAgency>BR99076095</CodAgency> </header> <body> <getFlightInfo xmlns="urn:os:flifo"> <input> <CarrierAccount>G3</CarrierAccount> <CarrierCode>G3</CarrierCode> <Origin>CGH</Origin> <Destination>SDU</Destination> <DepartureDate>2007-02-07T00:00:00Z</DepartureDate> </input> </getFlightInfo> </body> </valor> </FlightInformation> </soap:Body> </soap:Envelope>
I couldn't figure out a way to serialize a soap envelope as like above, and now I'm asking to help with this webservices communication.
/* * C# code that access the air company .NET werbservices */ using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using Fly.FlighInformation; namespace Fly { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { Fly.FlighInformation.req_envelope Request = new re +q_envelope (); Fly.FlighInformation.resp_envelope Response = new re +sp_envelope(); Fly.FlighInformation.wsFlightInformation s = new wsFlight +Information(); Fly.FlighInformation.clsFlightInformationRequestHeader hea +der = new clsFlightInformationRequestHeader(); Fly.FlighInformation.clsFlightInfoRequestInput bod +y = new clsFlightInfoRequestInput(); Fly.FlighInformation.clsFlightInformationRequest inf +orequest = new clsFlightInformationRequest (); Fly.FlighInformation.clsFlightInformationRequestBody req +uestbody = new clsFlightInformationRequestBody(); header.CodAgency = "BR99076095"; body.CarrierAccount = "G3"; body.CarrierCode = "G3"; body.DepartureDate = "2007-02-07T00:00:00Z"; body.Origin = "CGH"; body.Destination = "SDU"; inforequest.input = body; requestbody.getFlightInfo = inforequest; Request.header = header; Request.body = requestbody; Response = s.FlightInformation( Request ) +; if (Response.body.getFlightInfoResponse.output.ResultCode +== 0) { label1.Text = "Finish with sucess"; } else { label1.Text = "Failed"; } } } }
I'll appreciate any help with this soap.

Thanks,

Solli Moreira Honorio
Sao Paulo - Brazil

Replies are listed 'Best First'.
Re: Help with SOAP::Lite client acessing a air company .NET webservices
by Herkum (Parson) on Feb 04, 2007 at 13:33 UTC

    You can find good examples Here for how to use Soap::Lite.

    I think the big difference between your C# code and the Perl implementation is that C# is auto encapsulating the data into XML for you. Soap::Lite is middle ware used to send the data to somewhere else. You will probably have to write some code to encapsulate the data yourself.

    You should also consider taking a look at XML::Simple or XML::Twig on how to generate a XML document. Or you can use a template if the document is simple enough.