On Mon, Mar 29, 2010 at 11:36 AM, Jeff Peng <jeffp...@netzero.net> 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: > > 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. > > Jeff. > > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > For additional commands, e-mail: beginners-h...@perl.org > http://learn.perl.org/ > > > I would start by asking the developers or well their web server what was actually sent by your code if you are not able to catch this your self (using a Data::Dumper on the SOAP object should print this though ;-) With that in hand you have a place to start poking at: Accept: text/xml Accept: multipart/* Accept: application/soap Content-Length: 531 Content-Type: text/xml; charset=utf-8 SOAPAction: http://tempuri.org/DataUpLoad <?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/"> <INDICATORSNUMBER xsi:type="xsd:long">1010101010101210</INDICATORSNUMBER> <FVALUE xsi:type="xsd:int">50</FVALUE> </DataUpLoad> </soap:Body> </soap:Envelope> I got this by adding use Data::Dumper; print Dumper $soap; at the end of your script. I am sure that you can take it from there...