Loading ...
Sorry, an error occurred while loading the content.

RE: [soaplite] SOAP::Transport::MAILTO - Heck, I'm stumped

Expand Messages
  • Chris Davies
    Arrggh is it really that simple? [later...] I have now a server! I have had to strip the mail headers, so that only Content-Transfer-Encoding, Content-Type,
    Message 1 of 8 , Dec 17, 2001
    • 0 Attachment
      Arrggh is it really that simple?

      [later...] I have now a server!

      I have had to strip the mail headers, so that only
      Content-Transfer-Encoding, Content-Type, MIME-Version, and Soapaction were
      included - otherwise I get a SOAP Fault, "Application failed during request
      deserialization: syntax error at line 1, column 0, byte 0 at
      /usr/lib/perl5/site_perl/5.005/i386-linux/XML/Parser.pm line 185"

      Is SOAP over SMTP intended to be unidirectional, and if so, how does the
      client know that the server received and processed the request? If not, then
      how do I then transmit the SOAP response back to the client? Turn about and
      use an SMTP SOAP *client* at the server, or MIME::Lite, or what?

      Cheers,
      Chris
      --
      Chris Davies, Manheim Online
      Tel. 0113 393-2004 Fax. 0870 444-0482. Mobile 07778 199069


      -----Original Message-----
      From: Paul Kulchenko [mailto:paulclinger@...]
      Sent: Monday, December 17, 2001 5:07 PM
      To: Chris Davies
      Cc: soaplite@yahoogroups.com
      Subject: RE: [soaplite] SOAP::Transport::MAILTO - Heck, I'm stumped


      Hi, Chris!

      Shouldn't be difficult. You can directly invoke IO server with this:

      ioserver.pl

      use SOAP::Transport::IO;

      SOAP::Transport::IO::Server->dispatch_to('MyClass')->handle();

      package MyClass; sub hello { print "Hello, ", $_[1] }

      and then do:

      | ioserver.pl

      by default IO server will read STDIN and output to STDOUT. You can
      change that if you want. Every server (IO, FTP, HTTP and others) can
      deal with MIME payload as well as XML payload, so you can just feed
      it to it. Let me know if you have any questions.

      Best wishes, Paul.

      --- Chris Davies <Chris.Davies@...> wrote:
      > OK, one related question. How do you then process the inbound email
      > (as a
      > server) at the time of delivery?
      >
      > The only mail based server I can see is Transport::POP3, and I'd
      > really be
      > interested in something that could accept the email as a pipe, like
      > you'd
      > get if you put "| /home/chdavies/soapstuff/mySMTPSoapServer.pl" in
      > your
      > .forward file.
      >
      > I had a play with MIME::Parser and SOAP::Transport::IO but haven't
      > got very
      > far yet. (I can decode the inbound file, but I haven't worked out
      > how to
      > feed it straight to S::T::IO yet.)
      >
      > Chris
      > --
      > Chris Davies, Manheim Online
      > Tel. 0113 393-2004 Fax. 0870 444-0482. Mobile 07778 199069
      >
      >
      > -----Original Message-----
      > From: Paul Kulchenko [mailto:paulclinger@...]
      > Sent: Monday, December 17, 2001 3:20 PM
      > To: dduuggllaa; soaplite@yahoogroups.com
      > Subject: Re: [soaplite] SOAP::Transport::MAILTO - Heck, I'm stumped
      >
      >
      > Hi, Douglass!
      >
      > > SOAP::Lite. I don't see how this code can do anything at all
      > other
      > > then send a blank email:
      > Why do you think email is blank? I added
      >
      > use SOAP::Lite +trace => 'debug';
      >
      > and here is the output:
      >
      > SOAP::Transport::MAILTO::Client::send_receive: Content-Disposition:
      > inline
      > Content-Transfer-Encoding: base64
      > Content-Type: text/xml
      > MIME-Version: 1.0
      > To: destination.email@address
      > From: your.email
      > Subject: SOAP message
      > X-Mailer: SOAP::Lite/Perl/0.52
      > Soapaction: "http://www.soaplite.com/My/Examples#getStateName"
      >
      >
      PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48U09BUC1FTlY6RW52ZWxvcGUg
      >
      eG1sbnM6U09BUC1FTkM9Imh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3NvYXAvZW5jb2Rpbmcv
      >
      IiBTT0FQLUVOVjplbmNvZGluZ1N0eWxlPSJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy9zb2Fw
      >
      L2VuY29kaW5nLyIgeG1sbnM6U09BUC1FTlY9Imh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3Nv
      >
      YXAvZW52ZWxvcGUvIiB4bWxuczp4c2k9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvWE1MU2NoZW1h
      >
      LWluc3RhbmNlIiB4bWxuczp4c2Q9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvWE1MU2NoZW1hIj48
      >
      U09BUC1FTlY6Qm9keT48bmFtZXNwMTpnZXRTdGF0ZU5hbWUgeG1sbnM6bmFtZXNwMT0iaHR0cDov
      >
      L3d3dy5zb2FwbGl0ZS5jb20vTXkvRXhhbXBsZXMiPjxjLWdlbnN5bTMgeHNpOnR5cGU9InhzZDpp
      >
      bnQiPjEyPC9jLWdlbnN5bTM+PC9uYW1lc3AxOmdldFN0YXRlTmFtZT48L1NPQVAtRU5WOkJvZHk+
      > PC9TT0FQLUVOVjpFbnZlbG9wZT4=
      >
      > If you specify Encoding => 'binary', you'll get the same payload
      > without base64 encoding:
      >
      > -> proxy('mailto:destination.email@address', smtp =>
      > 'smtp.server',
      >
      > From => 'your.email', Subject => 'SOAP message', Encoding =>
      > 'binary')
      >
      > SOAP::Transport::MAILTO::Client::send_receive: Content-Disposition:
      > inline
      > Content-Length: 533
      > Content-Transfer-Encoding: binary
      > Content-Type: text/xml
      > MIME-Version: 1.0
      > To: destination.email@address
      > From: your.email
      > Subject: SOAP message
      > X-Mailer: SOAP::Lite/Perl/0.52
      > Soapaction: "http://www.soaplite.com/My/Examples#getStateName"
      >
      > <?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:getStat
      > eName
      > xmlns:namesp1="http://www.soaplite.com/My/Examples"><c-gensym3
      >
      xsi:type="xsd:int">12</c-gensym3></namesp1:getStateName></SOAP-ENV:Body></SO
      > AP-ENV:Envelope>
      >
      > As you can see it's usual payload, only headers and transport are
      > different. Doesn't it work for you?
      >
      > Best wishes, Paul.
      >
      > --- dduuggllaa <turner@...> wrote:
      > > Hello,
      > >
      > > I want to use an SMTP protocol for an SOAP service that will run
      > > for
      > > a looonnnggg time before it returns a result. I figure using SMTP
      > > as
      > > my scheme is more appropriate then HTTP since my task is more
      > > messaging style (mail, IM) then call/response (http).
      > >
      > > I rummaged through the examples in the SOAP::Lite distribution
      > and
      > > there is indeed an SMTP example, but after staring at the code I
      > am
      > >
      > > still unable to grasp where the code in fact messages the
      > intended
      > > service to do it's thing. Where is the pointer the the actual
      > class
      > >
      > > calling it's method? All I see is email addresses, and the URL of
      > > the
      > > SMTP server. Below is the source for the SMTP example provided
      > with
      > >
      > > SOAP::Lite. I don't see how this code can do anything at all
      > other
      > > then send a blank email:
      > >
      > >
      > > #!perl -w
      > > #!/usr/bin/perl.exe
      > >
      > > use SOAP::Lite;
      > >
      > > SOAP::Lite
      > > -> uri('http://www.soaplite.com/My/Examples')
      > > -> proxy('mailto:destination.email@address', smtp =>
      > > 'smtp.server',
      > > From => 'your.email', Subject => 'SOAP message')
      > > -> getStateName(12);
      > >
      > >
      > > What am I missing here? Thanks for your time.
      > >
      > > Cheers,
      > > Douglass Turner
      > > email: turner@...
      > >
      > >
      > >
      > > ------------------------ Yahoo! Groups Sponsor
      > >
      > > To unsubscribe from this group, send an email to:
      > > soaplite-unsubscribe@yahoogroups.com
      > >
      > >
      > >
      > > Your use of Yahoo! Groups is subject to
      > > http://docs.yahoo.com/info/terms/
      > >
      > >
      >
      >
      > __________________________________________________
      > Do You Yahoo!?
      > Check out Yahoo! Shopping and Yahoo! Auctions for all of
      > your unique holiday gifts! Buy at http://shopping.yahoo.com
      > or bid at http://auctions.yahoo.com
      >
      >
      > To unsubscribe from this group, send an email to:
      > soaplite-unsubscribe@yahoogroups.com
      >
      >
      >
      > Your use of Yahoo! Groups is subject to
      > http://docs.yahoo.com/info/terms/
      >
      >
      >
      > ------------------------ Yahoo! Groups Sponsor
      >
      > To unsubscribe from this group, send an email to:
      > soaplite-unsubscribe@yahoogroups.com
      >
      >
      >
      > Your use of Yahoo! Groups is subject to
      > http://docs.yahoo.com/info/terms/
      >
      >


      __________________________________________________
      Do You Yahoo!?
      Check out Yahoo! Shopping and Yahoo! Auctions for all of
      your unique holiday gifts! Buy at http://shopping.yahoo.com
      or bid at http://auctions.yahoo.com

      To unsubscribe from this group, send an email to:
      soaplite-unsubscribe@yahoogroups.com



      Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    • Paul Kulchenko
      Hi, Chris! ... ;) I hope it is ... It shouldn t give you any error when MIME message is well-formed. Would you mail me full envelope that gives you a problem?
      Message 2 of 8 , Dec 17, 2001
      • 0 Attachment
        Hi, Chris!

        --- Chris Davies <Chris.Davies@...> wrote:
        > Arrggh is it really that simple?
        ;) I hope it is

        > I have had to strip the mail headers, so that only
        > Content-Transfer-Encoding, Content-Type, MIME-Version, and
        > Soapaction were
        > included - otherwise I get a SOAP Fault, "Application failed during
        > request
        > deserialization: syntax error at line 1, column 0, byte 0 at
        > /usr/lib/perl5/site_perl/5.005/i386-linux/XML/Parser.pm line 185"
        It shouldn't give you any error when MIME message is well-formed.
        Would you mail me full envelope that gives you a problem?

        > Is SOAP over SMTP intended to be unidirectional, and if so, how
        > does the
        > client know that the server received and processed the request? If
        > not, then
        > how do I then transmit the SOAP response back to the client? Turn
        > about and
        > use an SMTP SOAP *client* at the server, or MIME::Lite, or what?
        It doesn't know. We published recently SOAP over SMTP spec and
        section 4 covers it briefly. What I plan to do is to add to POP3
        server ability to reply (using SMTP client) with the response message
        if reply-to header is present or if configured to reply on from
        address. However it allows you to communicate only between mail
        nodes. As an alternative, for SMTP transport you can send response
        back using *client* call. You don't have access to From address
        though and I don't plan to give you one, so it should be resolved on
        application level. Let me know if you need an example on that.

        Best wishes, Paul.

        __________________________________________________
        Do You Yahoo!?
        Check out Yahoo! Shopping and Yahoo! Auctions for all of
        your unique holiday gifts! Buy at http://shopping.yahoo.com
        or bid at http://auctions.yahoo.com
      • dduuggllaa
        Ok, I ve almost got things working ... I just resurfaced from hacking on sendmail (alias mucking) and I am still a bit shaken by the unpleasant experience.
        Message 3 of 8 , Dec 18, 2001
        • 0 Attachment
          Ok,

          I've almost got things working ... I just resurfaced from hacking on
          sendmail (alias mucking) and I am still a bit shaken by the
          unpleasant experience. Lord have mercy, sendmail hacking can make a
          man weep.

          Anyway here's where I'm at.

          my aliases file from sendmail:
          soapserver.soap: "| /home/turner/play/soap/smtp-soap-server.pl"

          my client:
          use SOAP::Lite +trace => qw(debug);

          my $client = SOAP::Lite->uri('HiByeLanguages');
          $client->proxy('mailto:soapserver.soap', smtp => 'lalla.uvs.is', From
          => 'turner@...', Subject => 'SOAP message');

          $client->hi();

          exit;

          my server:
          #!/usr/bin/perl -w
          #
          use strict;
          use diagnostics;
          use SOAP::Transport::IO;

          my $dispatch = SOAP::Transport::IO::Server->new();

          $dispatch->dispatch_to('/usr/local/soap/modules');
          $dispatch->handle;

          exit;

          My problem stems from my general ingnorance (well actually fear) of
          sendmail. Since soapserver.soap is merely a fictitious name used as
          an entry point to smtp-soap-server.pl how do I direct the response to
          the intended email destination (turner@...)?

          Is it possible to capture the result of the $dispatch->handle call
          within smtp-soap-server.pl? If so, I can just add some code that uses
          Mail::Sendmail to get the mail where I want it, right?

          Cheers,
          Doug
        Your message has been successfully submitted and would be delivered to recipients shortly.