using SOAP::Lite to call other services.

Ask a Question related to PERL Miscellaneous, Design and Development.

  1. #1

    Default Re: using SOAP::Lite to call other services.

    Eric Amick <eric-amick@comcast.net> writes:
    > On Mon, 23 Jun 2003 16:50:36 -0500, Yarden Katz <katz@underlevel.net>
    > wrote:
    >
    >>Hi,
    >>
    >> I'm using SOAP::Lite to write a few services. I managed to get a
    >> few clients/server running correctly.
    >>
    >> I'm having trouble getting SOAP::Lite to call external, non-Perl
    >> services, however. The service I am interested in is
    >> 'ValidateEmail' (see
    >> [url]http://www.webservicex.net/ValidateEmail.asmx[/url]).
    >>
    >> According to the SOAP::Lite documentation, it is perfectly valid to
    >> do:
    >>
    >> print "RESULT: ", SOAP::Lite
    >> -> uri('http://www.webserviceX.NET')
    >> -> proxy('http://www.webservicex.net/ValidateEmail.asmx')
    >> -> service('http://www.webservicex.net/ValidateEmail.asmx?WSDL')
    >> -> IsValidEMail($email) . "\n";
    >
    > None of their examples use both proxy() and service(). Try eliminating
    > the proxy().
    I've tried this before (I noticed the same thing with the examples)
    but have only one or only the other do not change the results. Any
    other ideas?

    Appreciate your help,
    --
    Yarden Katz <katz@underlevel.net> | Mind the gap
    Yarden Katz Guest

  2. Similar Questions and Discussions

    1. Writing a HTML/ASP SOAP client for a SOAP::Lite destination
      How would I go about writing a SOAP client in either HTML or classic asp? The SOAP "listener" was written in Perl with SOAP::Lite in Unix and I am...
    2. SOAP::Lite : Problem of # sign added by SOAP::Lite in the sent SOAPActionstring
      Hello, I have a problem with a SOAP client written in Perl (source at the end). I've tried both ways (by commenting TRIAL ONE or SECOND TRIAL),...
    3. SOAP::Lite : BUG somewhere
      I tried running the demo scripts given in the SOAP::Lite tutorial that appeared in http://www.perl.com/pub/a/2001/01/soap.html. According to this...
    4. SOAP::Lite HELP!
      I've written soap clients before but never anything this complicated. Here are the links PIRP: http://homer.meso.com/crap/PIRP_Schema_v1.xsd...
    5. soap::lite and dbd::csv
      sorry !! my english is very poor. i got some trouble ! please help ! if $vars is constant in Bridge.pm then the process is right! ps:DBD::CVS ...
  3. #2

    Default Re: using SOAP::Lite to call other services.

    Eric Amick <eric-amick@comcast.net> writes:
    > On Mon, 23 Jun 2003 16:50:36 -0500, Yarden Katz <katz@underlevel.net>
    > wrote:
    >
    >>Hi,
    >>
    >> I'm using SOAP::Lite to write a few services. I managed to get a
    >> few clients/server running correctly.
    >>
    >> I'm having trouble getting SOAP::Lite to call external, non-Perl
    >> services, however. The service I am interested in is
    >> 'ValidateEmail' (see
    >> [url]http://www.webservicex.net/ValidateEmail.asmx[/url]).
    >>
    >> According to the SOAP::Lite documentation, it is perfectly valid to
    >> do:
    >>
    >> print "RESULT: ", SOAP::Lite
    >> -> uri('http://www.webserviceX.NET')
    >> -> proxy('http://www.webservicex.net/ValidateEmail.asmx')
    >> -> service('http://www.webservicex.net/ValidateEmail.asmx?WSDL')
    >> -> IsValidEMail($email) . "\n";
    >
    > None of their examples use both proxy() and service(). Try eliminating
    > the proxy().
    I tried calling a different service with SOAP::Lite and I'm getting
    similarly weird results:

    use SOAP::Lite +autodispatch, +trace => debug;
    my $soap = SOAP::Lite
    -> uri('http://www.worldwidedesktop.com/spellcheck')
    -> on_action(sub {sprintf '%s/%s', @_})
    -> proxy('http://www.worldwidedesktop.com/spellcheck/spellcheckservice.asmx');

    $soap = $soap->SpellCheck( SOAP::Data->name(TextToCheck => 'foo') );


    The SOAP message I get back is:

    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
    <soap:Fault>
    <faultcode>soap:Server</faultcode>
    <faultstring>Server was unable to process request. --&gt; Object reference not set to an instance of an object.</faultstring>
    <detail />
    </soap:Fault>
    </soap:Body>
    </soap:Envelope>


    This makes no sense, because the message that my snippet above
    actually sent (as printed by +debug) was:

    SOAP::Transport::HTTP::Client::send_receive: POST [url]http://www.worldwidedesktop.com/spellcheck/spellcheckservice.asmx[/url]
    Accept: text/xml
    Accept: multipart/*
    Content-Length: 544
    Content-Type: text/xml; charset=utf-8

    SOAPAction: [url]http://www.worldwidedesktop.com/spellcheck/SpellCheck[/url]

    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
    SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/1999/XMLSchema">
    <SOAP-ENV:Body>
    <namesp1:SpellCheck
    xmlns:namesp1="http://www.worldwidedesktop.com/spellcheck">
    <TextToCheck xsi:type="xsd:string">foo</TextToCheck>
    </namesp1:SpellCheck>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>


    The message that this service expects, as written by its documentation
    (at
    [url]http://www.worldwidedesktop.com/spellcheck/spellcheckservice.asmx?op=SpellCheck[/url])
    is:

    POST /spellcheck/spellcheckservice.asmx HTTP/1.1
    Host: [url]www.worldwidedesktop.com[/url]
    Content-Type: text/xml; charset=utf-8
    Content-Length: length

    SOAPAction: "http://www.worldwidedesktop.com/spellcheck/SpellCheck"
    <?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>
    <SpellCheck xmlns="http://www.worldwidedesktop.com/spellcheck">
    <LicenseText>string</LicenseText>
    <TextToCheck>string</TextToCheck>
    </SpellCheck>
    </soap:Body>
    </soap:Envelope>


    As far as I can tell, the message the server documentation shows and
    the one sent by my client are almost identical. I see no reason why
    this call would fail.. the service itself is functioning, so the
    problem must be on my end.

    Thanks a lot,
    --
    Yarden Katz <katz@underlevel.net> | Mind the gap
    Yarden Katz Guest

  4. #3

    Default Re: using SOAP::Lite to call other services.

    Yarden Katz <katz@underlevel.net> wrote in message news:<86ptl3obqz.fsf@underlevel.net>...
    > James McIninch <james.mcininch@attbi.com> writes:
    >
    > > A few things: I'd suggest that you use the +trace option to SOAP::Lite to
    > > see what's going on under the covers -- It's very informative. Next, you
    > > are calling a Microsoft .Net service (.asmx), meaning that it's probably
    > > not strictly SOAP compliant. The SOAP::Lite documentation give pointers on
    > > how to compensate for the pecualiarities of the bugs in .Net. Finally, if
    > > you specify the service() to SOAP::Lite, you should leave off the proxy()
    > > and the uri() since the service() is supposed to set those things for you.
    >
    > A couple of things: I've been using +trace from the start (that's how
    > I knew what message my client was sending) and it is indeed very
    > useful. I've tried the combination you suggested (removing
    > uri()/proxy() and just using service()) but I get the same results.
    >
    > Additionally, for another .asmx service I was attempting to call,
    > removing proxy() and just pointing service to the WSDL file was not an
    > option. When I did that, I'd get the error: Transport not specified
    > (use proxy() or service method)
    I was able to get one response back by setting:
    the on_action callback and specifying the namespace
    for the method.

    (I needed the on_action so that the SOAPAction header had uri/method instead
    of uri#method.)

    If you look at the trace there are many results, but the result
    I get from perl only has 1 item.

    (You know I was able to hook perl almost seemlessly into some java
    web services using Apache Axis - I don't know why this is so
    difficult. Is it perl or .NET, or do I just not get this?
    I thought the beauty of remote method like frameworks was that
    you didn't have to really know the protocol, and that libraries would
    do the work for you).

    use strict;
    use warnings;
    use Data::Dumper;
    use SOAP::Lite +trace => 'all';
    #use SOAP::Lite;


    my $service = SOAP::Lite
    ->proxy('http://www.worldwidedesktop.com/spellcheck/spellcheckservice.asmx')
    ->uri('http://www.worldwidedesktop.com/spellcheck/SpellCheck')
    ->on_action(sub{ sprintf "%s/%s", @_ });

    my $xmlns = 'http://www.worldwidedesktop.com/spellcheck';
    my $method = SOAP::Data
    ->name('SpellCheck')
    ->attr({xmlns=>$xmlns});

    my $response = $service->call($method => _sd(
    LicenseText => '',
    TextToCheck => 'blonk'
    ));

    die "Error: getting response\n" unless defined($response);

    print "Response = ", Dumper($response->result), "\n";

    # convert key/values to SOAP::Data
    sub _sd {
    my @p;
    for (my $i=0; $i<$#_; $i+=2) {
    push(@p, SOAP::Data->name($_[$i]=>$_[$i+1]));
    }
    return @p;
    }
    Bryan Castillo Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139