From: Robert L. <Rob...@co...> - 2009-02-17 16:31:13
|
Try this... my $header = SOAP::Header->name('web:APICredentials') ->value(\SOAP::Header->value( SOAP::Header->name('web:DeveloperKey') ->value('XXXX'), SOAP::Header->name('web:Password') ->value('XXXX') ) ); my $ca = SOAP::Lite->new( service => 'channel_advisor.wsdl', proxy => 'https://api.channeladvisor.com/ChannelAdvisorAPI/v1/ShippingService.asmx', ); $ca->uri('http://api.channeladvisor.com/webservices'); $ca->call('Ping' => $header); if($ca->fault) { print "SOAP fault: ".$ca->faultstring; } else { print $ca->result; } Egor Shipovalov wrote: > Hi everyone! > > I'm trying to get SOAP::Lite to generate proper XML to connect to > channeladvisor.com SOAP interface which is known to be written in .NET > In the simplest case (a ping request) what I'm aiming to get is this: > > <soapenv:Envelope > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" > xmlns:web="http://api.channeladvisor.com/webservices/"> > <soapenv:Header> > <web:APICredentials> > <web:DeveloperKey>XXXX</web:DeveloperKey> > <web:Password>XXX</web:Password> > </web:APICredentials> > </soapenv:Header> > <soapenv:Body> > <web:Ping/> > </soapenv:Body> > </soapenv:Envelope> > > And here's what SOAP::Lite generates: > > <?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> > <Ping xmlns="http://api.channeladvisor.com/webservices" > xsi:nil="true" /> > </soap:Body> > </soap:Envelope> > > My code is as as follows: > > my $ca = SOAP::Lite->new( > service => 'channel_advisor.wsdl', > proxy => > 'https://api.channeladvisor.com/ChannelAdvisorAPI/v1/ShippingService.asmx', > ); > > $ca->uri('http://api.channeladvisor.com/webservices'); > $ca->on_action(sub { join '/', @_ }); # setup SOAPaction header for .NET > > Best regards, > Egor Shipovalov. > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA > -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise > -Strategies to boost innovation and cut costs with open source participation > -Receive a $600 discount off the registration fee with the source code: SFAD > http://p.sf.net/sfu/XcvMzF8H > _______________________________________________ > Soaplite-devel mailing list > Soa...@li... > https://lists.sourceforge.net/lists/listinfo/soaplite-devel > |