On Mon, Mar 29, 2010 at 12:29 PM, Rob Coops <rco...@gmail.com> wrote:
> > > On Mon, Mar 29, 2010 at 12:16 PM, Rob Coops <rco...@gmail.com> wrote: > >> >> >> On Mon, Mar 29, 2010 at 11:57 AM, Jeff Peng <jeffp...@netzero.net> wrote: >> >>> Thanks Rob. >>> I have enabled "trace => all" when new the object, so I have been able >>> to look what was happened. >>> I think what I don't know is that how to built-up that a XML request >>> package with the format they required for posting. >>> >>> Jeff. >>> >>> On Mon, Mar 29, 2010 at 5:49 PM, Rob Coops <rco...@gmail.com> wrote: >>> > >>> > >>> > On Mon, Mar 29, 2010 at 11:36 AM, Jeff Peng <jeffp...@netzero.net> >>> wrote: >>> >> >>> >>> -- >>> To unsubscribe, e-mail: beginners-unsubscr...@perl.org >>> For additional commands, e-mail: beginners-h...@perl.org >>> http://learn.perl.org/ >>> >>> >>> >> Fair enough. :-) >> >> Try the following: >> use SOAP::Lite +trace => 'all'; >> >> my $soap = SOAP::Lite->new( proxy => >> 'http://192.168.1.100/Service/IndicatorsService.asmx'); >> $soap->default_ns('http://tempuri.org/'); >> $soap->on_action(sub { join '', @_ }); >> >> >> my $method = SOAP::Data->name('DataUpLoad') >> ->attr({xmlns => >> 'http://tempuri.org/'}<http://tempuri.org/'%7D> >> ); >> my $test = ( >> SOAP::Data->name('input')->value( >> >> SOAP::Data->name('user')->value(string) >> ) >> ); >> my @param = ( >> $test, >> >> SOAP::Data->name('INDICATORSNUMBER')->value('1010101010101210'), >> SOAP::Data->name('FVALUE')->value(50), >> ); >> >> my $run = $soap->call($method => @param); >> >> That way you can build the whole thing exactly as the asked you to. >> SOAP::Lite is maybe no longer supported but it is the simplest way of >> working with SOAP I have found so far. >> > > Ok never mind that... I though that is what I was doing last time I used > SOAP::Lite (its been a few years...) I'll have another look I can't stand > not remembering this anymore :-) > Got it, I for got to indicate the arrays there. The code below will produce the following output. <?xml version="1.0" encoding="UTF-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd=" http://www.w3.org/2001/XMLSchema" soap:encodingStyle=" http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap=" http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <DataUpLoad xmlns="http://tempuri.org/"> <input soapenc:arrayType="xsd:anyType[5]" xsi:type="soapenc:Array"> <user xsi:type="xsd:string">string</user> <userip xsi:type="xsd:string">string</userip> <nettype xsi:type="xsd:string">string</nettype> <os xsi:type="xsd:string">string</os> <data soapenc:arrayType="soapenc:Array[1]" xsi:type="soapenc:Array"> <datauploadinputdata soapenc:arrayType="xsd:string[5]" xsi:type="soapenc:Array"> <INDICATORSNUMBER xsi:type="xsd:string">decimal</INDICATORSNUMBER> <recordingtime xsi:type="xsd:string">datetime</recordingtime> <FVALUE xsi:type="xsd:string">decimal</FVALUE> <valid xsi:type="xsd:string">string</valid> <info xsi:type="xsd:string">string</info> </datauploadinputdata> </data> </input> </DataUpLoad> </soap:Body> </soap:Envelope> CODE BELOW. use SOAP::Lite +trace => 'all'; my $soap = SOAP::Lite->new( proxy => 'http://192.168.1.100/Service/IndicatorsService.asmx'); $soap->default_ns('http://tempuri.org/'); $soap->on_action(sub { join '', @_ }); my $method = SOAP::Data->name('DataUpLoad') ->attr({xmlns => 'http://tempuri.org/'}); my @test = ( SOAP::Data->name('input')->value( [ SOAP::Data->name('user')->value('string'), SOAP::Data->name('userip')->value('string'), SOAP::Data->name('nettype')->value('string'), SOAP::Data->name('os')->value('string'), SOAP::Data->name('data')->value([ SOAP::Data->name('datauploadinputdata')->value([ SOAP::Data->name('INDICATORSNUMBER')->value('decimal'), SOAP::Data->name('recordingtime')->value('datetime'), SOAP::Data->name('FVALUE')->value('decimal'), SOAP::Data->name('valid')->value('string'), SOAP::Data->name('info')->value('string'), ]), ]), ])); my $run = $soap->call( $method => @test ); I knew it was easy just forgot one minor detail there. :-)