Hai
I am trying to access a .Net web service in perl, here is the code i have written
use SOAP::Lite +trace => all; $soap = SOAP::Lite -> uri('http://www.webservicex.net') -> on_action( sub { join '/', 'http://www.webserviceX.NET', $_[1] +} ) -> proxy('http://www.webservicex.net/globalweather.asmx'); my $method = SOAP::Data->name('GetCitiesByCountry') ->attr({xmlns => 'http://www.webserviceX.NET/'}); my $param = SOAP::Data->name("CountryName" =>"India"); $result= $soap->call($method,$param)->result();

Even though i am passing the parameter "CountryName" it gives an exception on it. I have observed that the soap requests generated by the above code are in the following format

<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:xsi="ht +tp://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-ENC="http://schem +as.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap +.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" SOA +P-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP +-ENV:Body><GetCitiesByCountry xmlns="http://www.webserviceX.NET/"><Co +untryName xsi:type="xsd:string">India</CountryName></GetCitiesByCount +ry></SOAP-ENV:Body></SOAP-ENV:Envelope>

where as the the the example soap request is in the following format
POST /globalweather.asmx HTTP/1.1 Host: www.webservicex.net Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://www.webserviceX.NET/GetCitiesByCountry" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" x +mlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schema +s.xmlsoap.org/soap/envelope/"> <soap:Body> <GetCitiesByCountry xmlns="http://www.webserviceX.NET"> <CountryName>string</CountryName> </GetCitiesByCountry> </soap:Body> </soap:Envelope>

Could you please help on this.. Regards, Siva

In reply to Accessing .Net Web Service by cs3p

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.