On Monday 29 Mar 2010 12:36:20 Jeff Peng wrote: > Hello, > > I want to post some data to a webservice which is .NET powered. > > The webservice's developer tell me the request should be: > > POST /Service/IndicatorsService.asmx HTTP/1.1 > Host: 192.168.1.100 > Content-Type: text/xml; charset=utf-8 > Content-Length: length > SOAPAction: "http://tempuri.org/DataUpLoad" > > <?xml version="1.0" encoding="utf-8"?> > <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> > <soap:Body> > <DataUpLoad xmlns="http://tempuri.org/"> > <input> > <User>string</User> > <UserIP>string</UserIP> > <NetType>string</NetType> > <OS>string</OS> > <Data> > <DataUpLoadInputData> > <INDICATORSNUMBER>decimal</INDICATORSNUMBER> > <RECORDINGTIME>dateTime</RECORDINGTIME> > <FVALUE>decimal</FVALUE> > <Valid>string</Valid> > <Info>string</Info> > </DataUpLoadInputData> > <DataUpLoadInputData> > <INDICATORSNUMBER>decimal</INDICATORSNUMBER> > <RECORDINGTIME>dateTime</RECORDINGTIME> > <FVALUE>decimal</FVALUE> > <Valid>string</Valid> > <Info>string</Info> > </DataUpLoadInputData> > </Data> > </input> > </DataUpLoad> > </soap:Body> > </soap:Envelope> > > > I wrote this script for requesting it: >
A few notes: 1. SOAP::Lite is no longer recommended. You should use SOAP::WSDL or XML::Compile::SOAP instead. (According to the perlbot factoid on irc.freenode.org ) 2. Always use "use strict;" and "use warnings;" in your script. 3. Good luck! SOAP is a can of worms, and I haven't encountered the need to use it until now (and would rather this remained this way.). In one of the war stories I heard, someone told me that after he went to a lot of trouble to interact with a .NET SOAP service (eventually opting to use curl), they discovered that even the equivalent .NET client could not interact with it. I've linked to these jokes about SOAP on http://www.shlomifish.org/links.html : * http://72.249.21.88/nonintersecting/?year=2006&monthnum=11&day=15&name=the- s-stands-for-simple&page= (short URL - http://xrl.us/bg28og ) * http://cafe.elharo.com/web/rest-vs-soap-a-parable/ > 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 @param = ( > > SOAP::Data->name('INDICATORSNUMBER')->value('1010101010101210'), > SOAP::Data->name('FVALUE')->value(50), > ); > > my $run = $soap->call($method => @param); > > > > But it run failed. > Can you help on this? Thanks. 1. How did it fail? What happened. 2. What does http://www.wireshark.org/ tell you? Regards, Shlomi Fish -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Rethinking CPAN - http://shlom.in/rethinking-cpan Deletionists delete Wikipedia articles that they consider lame. Chuck Norris deletes deletionists whom he considers lame. Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/