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

Re: [soaplite] Re: New to SOAP:Lite: Can't use a WS written in Java with Axis...

Expand Messages
  • Ivan Venuti
    thanks Graham: it works! Unfortunatly the solution seems too much ad hoc one and pporly based on my WSDL :) Thank again, I open another thread for
    Message 1 of 7 , Apr 16, 2005
    • 0 Attachment
      thanks Graham: it works!
      Unfortunatly the solution seems too much "ad hoc" one
      and pporly based on my WSDL :)

      Thank again, I open another thread for
      document/literal support...

      -- Ivan

      --- Graham Irvine <graham@...> ha
      scritto:

      ---------------------------------

      mmm .. yes thats a tough one . Document Literal
      Encoding , no method
      element .

      Im not sure if SOAP::Lite can handle that yet ?
      perhaps someone else
      can help ?.

      I tried creating a new serializer object and sending
      in type "xml"
      creating the SOAP::DATA as an xml string but it
      wouldnt have it .

      In the end I had to do it by hand. (see below)

      I will keep trying to find a SOAP::Lite solution and
      post it if i do.

      meanwhile here is a big perl code you could use to do
      what you want.

      #!/usr/bin/perl -w

      use strict;

      use LWP::UserAgent;
      use HTTP::Request::Common;

      my $proxy =
      "http://www.caribel.it:8080/axis/services/ProductsExampleWSPort";
      my
      $uri='http://ivenuti.altervista.org/ProductsExampleWS.xsd1';
      my $action = "$uri/productsList";
      my $date = "2005-04-11";

      my $userAgent = LWP::UserAgent->new(agent => 'Perl
      SOAP');

      my $message = "<?xml version=\"1.0\"
      encoding=\"utf-8\"?>
      <soapenv:Envelope
      xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"
      xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
      xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">
      <soapenv:Body>
      <ElementDate
      xmlns=\"http://ivenuti.altervista.org/ProductsExampleWS.xsd1\">$date</ElementDate>
      </soapenv:Body>
      </soapenv:Envelope>";

      my $response = $userAgent->request(POST $proxy,
      Content_Type => 'text/xml',
      SOAPAction => $action,
      Content => $message);

      print $response->error_as_HTML unless
      $response->is_success;
      print $response->as_string;

      --- In soaplite@yahoogroups.com, Ivan Venuti
      <ivanvenuti@y...> wrote:
      > My forwarded message seems to be quite difficult to
      > read! here is a re-post much more easy to read.
      >
      > First of all seems that the generated SOAP message
      is
      > still unreadable by Axis; this is the message
      > generated by Perl:
      >
      > <?xml version="1.0" encoding="utf-8"?>
      > <soap:Envelope
      >
      soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      >
      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"
      >
      xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      > <soap:Body>
      > <productsList
      >
      xmlns="http://ivenuti.altervista.org/ProductsExampleWS.xsd1">
      > <ElementDate
      > xsi:type="xsd:date">2005-04-11</ElementDate>
      > </productsList>
      > </soap:Body>
      > </soap:Envelope>
      >
      > This one is generated by the Axis client:
      >
      > <?xml version="1.0" encoding="utf-8"?>
      > <soapenv:Envelope
      >
      >
      xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
      > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      >
      >
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      > <soapenv:Body>
      > <ElementDate
      >
      xmlns="http://ivenuti.altervista.org/ProductsExampleWS.xsd1">2005-04-14</ElementDate>
      > </soapenv:Body>
      > </soapenv:Envelope>
      >
      > They are quite similar but the second one hasn't the
      > element <productsList ..> in the SOAP:Body.
      >
      > The code, originated from the code given in the list
      > but with some corrections (e.g. made a date and not
      a
      > string in order to achieve the xsd type):
      >
      > use strict;
      > use SOAP::Lite +trace => qw (debug);
      >
      > # Your Variables - set accordingly
      > my
      >
      $proxy='http://www.caribel.it:8080/axis/services/ProductsExampleWSPort?wsdl';
      > my
      >
      $uri='http://ivenuti.altervista.org/ProductsExampleWS.xsd1';
      > my $date = "2005-04-11";
      >
      > my $soap = SOAP::Lite
      > ->uri($uri)
      > ->on_action( sub {join '/',$uri,$_[1]} )
      > ->proxy($proxy);
      >
      > my
      >
      $method=SOAP::Data->name('productsList')->attr({xmlns
      > => $uri});
      >
      > my @params;
      >
      > my $request=
      >
      SOAP::Data->name('ElementDate')->value($date)->type('date');
      >
      > push @params,$request;
      >
      > my $result = $soap->call($method => @params);
      >
      > if ($result->fault){
      > print $result->faultstring;
      > }
      > else{
      > print $result->result;
      > }
      >
      > The error trace is quite similar to the previous
      one:
      >
      >
      > SOAP::Transport::HTTP::Client::send_receive: POST
      > http://www.caribel.it:8080/axi
      > s/services/ProductsExampleWSPort?wsdl HTTP/1.1
      > Accept: text/xml
      > Accept: multipart/*
      > Accept: application/soap
      > Content-Length: 514
      > Content-Type: text/xml; charset=utf-8
      > SOAPAction:
      >
      http://ivenuti.altervista.org/ProductsExampleWS.xsd1/productsList
      >
      > <?xml version="1.0" encoding="UTF-8"?><soap:Envelope
      > xmlns:xsi="http://www.w3.or
      > g/2001/XMLSchema-instance"
      >
      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encodi
      > ng/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      > soap:encodingStyle="http://sch
      > emas.xmlsoap.org/soap/encoding/"
      > xmlns:soap="http://schemas.xmlsoap.org/soap/env
      > elope/"><soap:Body><productsList
      > xmlns="http://ivenuti.altervista.org/ProductsEx
      > ampleWS.xsd1"><ElementDate
      >
      xsi:type="xsd:date">2005-04-11</ElementDate></product
      > sList></soap:Body></soap:Envelope>
      > SOAP::Transport::HTTP::Client::send_receive:
      HTTP/1.1
      > 500 Internal
      > Server Error
      > Connection: close
      > Date: Fri, 15 Apr 2005 16:08:02 GMT
      > Server: Apache-Coyote/1.1
      > Content-Type: text/xml;charset=utf-8
      > Client-Date: Fri, 15 Apr 2005 16:06:42 GMT
      > Client-Peer: 151.4.110.70:8080
      > Client-Response-Num: 1
      >
      > <?xml version="1.0"
      > encoding="utf-8"?><soapenv:Envelope
      > xmlns:soapenv="http://sc
      > hemas.xmlsoap.org/soap/envelope/"
      > xmlns:xsd="http://www.w3.org/2001/XMLSchema" x
      >
      mlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      > <soapenv:Body><soapenv:Fault>
      > <faultcode>soapenv:Server.userException</faultcode>
      > <faultstring>org.xml.sax.SAXException:
      > SimpleDeserializer encountered a child element,
      which
      > is NOT expected, in something it was trying to
      > deserialize.</faultstring>
      > <detail><ns1:hostname
      >
      xmlns:ns1="http://xml.apache.org/axis/">alpha</ns1:hostname></detail></soapenv:
      > Fault></soapenv:Body></soapenv:Envelope>
      > org.xml.sax.SAXException: SimpleDeserializer
      > encountered a child
      > element, which
      > is NOT expected, in something it was trying to
      > deserialize.
      >
      >
      >
      >
      > ___________________________________
      > Nuovo Yahoo! Messenger: E' molto più divertente:
      Audibles, Avatar,
      Webcam, Giochi, Rubrica… Scaricalo ora!
      > http://it.messenger.yahoo.it





      ---------------------------------
      Yahoo! Groups Links

      To visit your group on the web, go to:
      http://groups.yahoo.com/group/soaplite/

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

      Your use of Yahoo! Groups is subject to the Yahoo!
      Terms of Service.




      ___________________________________
      Nuovo Yahoo! Messenger: E' molto più divertente: Audibles, Avatar, Webcam, Giochi, Rubrica… Scaricalo ora!
      http://it.messenger.yahoo.it
    • Graham Irvine
      Hi Ivan ... request so im not sure if there is much difference there ... However if you need to stick with soap::lite I have in the past had some joy with
      Message 2 of 7 , Apr 16, 2005
      • 0 Attachment
        Hi Ivan

        :) SOAP::Lite doesnt read from the WSDL either to generate its
        request so im not sure if there is much difference there ...

        However if you need to stick with soap::lite I have in the past had
        some joy with SOAP-WSDL module which does do that , and uses
        SOAP::Lite to make the calls. It might be of help.

        It was a useful way to get .NET compatibility for version <0.55 if you
        were connecting to a lot of service methods without hand coding them.

        Graham

        --- In soaplite@yahoogroups.com, Ivan Venuti <ivanvenuti@y...> wrote:
        > thanks Graham: it works!
        > Unfortunatly the solution seems too much "ad hoc" one
        > and pporly based on my WSDL :)
        >
        > Thank again, I open another thread for
        > document/literal support...
        >
        > -- Ivan
        >
        > --- Graham Irvine <graham@g...> ha
        > scritto:
        >
        > ---------------------------------
        >
        > mmm .. yes thats a tough one . Document Literal
        > Encoding , no method
        > element .
        >
        > Im not sure if SOAP::Lite can handle that yet ?
        > perhaps someone else
        > can help ?.
        >
        > I tried creating a new serializer object and sending
        > in type "xml"
        > creating the SOAP::DATA as an xml string but it
        > wouldnt have it .
        >
        > In the end I had to do it by hand. (see below)
        >
        > I will keep trying to find a SOAP::Lite solution and
        > post it if i do.
        >
        > meanwhile here is a big perl code you could use to do
        > what you want.
        >
        > #!/usr/bin/perl -w
        >
        > use strict;
        >
        > use LWP::UserAgent;
        > use HTTP::Request::Common;
        >
        > my $proxy =
        > "http://www.caribel.it:8080/axis/services/ProductsExampleWSPort";
        > my
        > $uri='http://ivenuti.altervista.org/ProductsExampleWS.xsd1';
        > my $action = "$uri/productsList";
        > my $date = "2005-04-11";
        >
        > my $userAgent = LWP::UserAgent->new(agent => 'Perl
        > SOAP');
        >
        > my $message = "<?xml version=\"1.0\"
        > encoding=\"utf-8\"?>
        > <soapenv:Envelope
        > xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"
        > xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
        > xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">
        > <soapenv:Body>
        > <ElementDate
        >
        xmlns=\"http://ivenuti.altervista.org/ProductsExampleWS.xsd1\">$date</ElementDate>
        > </soapenv:Body>
        > </soapenv:Envelope>";
        >
        > my $response = $userAgent->request(POST $proxy,
        > Content_Type => 'text/xml',
        > SOAPAction => $action,
        > Content => $message);
        >
        > print $response->error_as_HTML unless
        > $response->is_success;
        > print $response->as_string;
        >
        > --- In soaplite@yahoogroups.com, Ivan Venuti
        > <ivanvenuti@y...> wrote:
        > > My forwarded message seems to be quite difficult to
        > > read! here is a re-post much more easy to read.
        > >
        > > First of all seems that the generated SOAP message
        > is
        > > still unreadable by Axis; this is the message
        > > generated by Perl:
        > >
        > > <?xml version="1.0" encoding="utf-8"?>
        > > <soap:Envelope
        > >
        > soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        > >
        > 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"
        > >
        > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
        > > <soap:Body>
        > > <productsList
        > >
        > xmlns="http://ivenuti.altervista.org/ProductsExampleWS.xsd1">
        > > <ElementDate
        > > xsi:type="xsd:date">2005-04-11</ElementDate>
        > > </productsList>
        > > </soap:Body>
        > > </soap:Envelope>
        > >
        > > This one is generated by the Axis client:
        > >
        > > <?xml version="1.0" encoding="utf-8"?>
        > > <soapenv:Envelope
        > >
        > >
        > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
        > > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        > >
        > >
        > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        > > <soapenv:Body>
        > > <ElementDate
        > >
        >
        xmlns="http://ivenuti.altervista.org/ProductsExampleWS.xsd1">2005-04-14</ElementDate>
        > > </soapenv:Body>
        > > </soapenv:Envelope>
        > >
        > > They are quite similar but the second one hasn't the
        > > element <productsList ..> in the SOAP:Body.
        > >
        > > The code, originated from the code given in the list
        > > but with some corrections (e.g. made a date and not
        > a
        > > string in order to achieve the xsd type):
        > >
        > > use strict;
        > > use SOAP::Lite +trace => qw (debug);
        > >
        > > # Your Variables - set accordingly
        > > my
        > >
        >
        $proxy='http://www.caribel.it:8080/axis/services/ProductsExampleWSPort?wsdl';
        > > my
        > >
        > $uri='http://ivenuti.altervista.org/ProductsExampleWS.xsd1';
        > > my $date = "2005-04-11";
        > >
        > > my $soap = SOAP::Lite
        > > ->uri($uri)
        > > ->on_action( sub {join '/',$uri,$_[1]} )
        > > ->proxy($proxy);
        > >
        > > my
        > >
        > $method=SOAP::Data->name('productsList')->attr({xmlns
        > > => $uri});
        > >
        > > my @params;
        > >
        > > my $request=
        > >
        > SOAP::Data->name('ElementDate')->value($date)->type('date');
        > >
        > > push @params,$request;
        > >
        > > my $result = $soap->call($method => @params);
        > >
        > > if ($result->fault){
        > > print $result->faultstring;
        > > }
        > > else{
        > > print $result->result;
        > > }
        > >
        > > The error trace is quite similar to the previous
        > one:
        > >
        > >
        > > SOAP::Transport::HTTP::Client::send_receive: POST
        > > http://www.caribel.it:8080/axi
        > > s/services/ProductsExampleWSPort?wsdl HTTP/1.1
        > > Accept: text/xml
        > > Accept: multipart/*
        > > Accept: application/soap
        > > Content-Length: 514
        > > Content-Type: text/xml; charset=utf-8
        > > SOAPAction:
        > >
        > http://ivenuti.altervista.org/ProductsExampleWS.xsd1/productsList
        > >
        > > <?xml version="1.0" encoding="UTF-8"?><soap:Envelope
        > > xmlns:xsi="http://www.w3.or
        > > g/2001/XMLSchema-instance"
        > >
        > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encodi
        > > ng/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        > > soap:encodingStyle="http://sch
        > > emas.xmlsoap.org/soap/encoding/"
        > > xmlns:soap="http://schemas.xmlsoap.org/soap/env
        > > elope/"><soap:Body><productsList
        > > xmlns="http://ivenuti.altervista.org/ProductsEx
        > > ampleWS.xsd1"><ElementDate
        > >
        > xsi:type="xsd:date">2005-04-11</ElementDate></product
        > > sList></soap:Body></soap:Envelope>
        > > SOAP::Transport::HTTP::Client::send_receive:
        > HTTP/1.1
        > > 500 Internal
        > > Server Error
        > > Connection: close
        > > Date: Fri, 15 Apr 2005 16:08:02 GMT
        > > Server: Apache-Coyote/1.1
        > > Content-Type: text/xml;charset=utf-8
        > > Client-Date: Fri, 15 Apr 2005 16:06:42 GMT
        > > Client-Peer: 151.4.110.70:8080
        > > Client-Response-Num: 1
        > >
        > > <?xml version="1.0"
        > > encoding="utf-8"?><soapenv:Envelope
        > > xmlns:soapenv="http://sc
        > > hemas.xmlsoap.org/soap/envelope/"
        > > xmlns:xsd="http://www.w3.org/2001/XMLSchema" x
        > >
        > mlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        > > <soapenv:Body><soapenv:Fault>
        > > <faultcode>soapenv:Server.userException</faultcode>
        > > <faultstring>org.xml.sax.SAXException:
        > > SimpleDeserializer encountered a child element,
        > which
        > > is NOT expected, in something it was trying to
        > > deserialize.</faultstring>
        > > <detail><ns1:hostname
        > >
        >
        xmlns:ns1="http://xml.apache.org/axis/">alpha</ns1:hostname></detail></soapenv:
        > > Fault></soapenv:Body></soapenv:Envelope>
        > > org.xml.sax.SAXException: SimpleDeserializer
        > > encountered a child
        > > element, which
        > > is NOT expected, in something it was trying to
        > > deserialize.
        > >
        > >
        > >
        > >
        > > ___________________________________
        > > Nuovo Yahoo! Messenger: E' molto più divertente:
        > Audibles, Avatar,
        > Webcam, Giochi, Rubrica… Scaricalo ora!
        > > http://it.messenger.yahoo.it
        >
        >
        >
        >
        >
        > ---------------------------------
        > Yahoo! Groups Links
        >
        > To visit your group on the web, go to:
        > http://groups.yahoo.com/group/soaplite/
        >
        > To unsubscribe from this group, send an email to:
        > soaplite-unsubscribe@yahoogroups.com
        >
        > Your use of Yahoo! Groups is subject to the Yahoo!
        > Terms of Service.
        >
        >
        >
        >
        > ___________________________________
        > Nuovo Yahoo! Messenger: E' molto più divertente: Audibles, Avatar,
        Webcam, Giochi, Rubrica… Scaricalo ora!
        > http://it.messenger.yahoo.it
      • Ivan Venuti
        I ve given a look at SOAP::WSDL. This is my example (the same as previously posted but using only SOAP::Lite): use strict; use SOAP::WSDL; my
        Message 3 of 7 , Apr 16, 2005
        • 0 Attachment
          I've given a look at SOAP::WSDL. This is my example
          (the same as previously posted but using only
          SOAP::Lite):


          use strict;
          use SOAP::WSDL;

          my
          $wsdl_uri='http://127.0.0.1:8080/axis/services/ProductsExampleWSPort?wsdl';
          my
          $wsdl_proxy='http://127.0.0.1:8080/axis/services/ProductsExampleWSPort';

          my $soap=SOAP::WSDL->new( wsdl => $wsdl_uri)->proxy(
          $wsdl_proxy );
          $soap->wsdlinit;

          print $soap->call( "productsList", "2000-01-01" );


          The error is:

          Error processing WSDL: cannot find input message for
          method 'productsOrderConfirmation'
          (/wsdl:definitions/wsdl:portType[@name='ProductsExampleWSPort']/wsdl:operation[@name='productsOrderConfirmation']/wsdl:input/@message)
          at C:/Perl/site/lib/SOAP/WSDL.pm line 146.

          Any idea about this kind of error?

          I've also tried:

          use SOAP::WSDL +trace => qw (debug)
          but without any other message...

          p.s. is this the right place to ask about SOAP::WSDL?
          If this isn't the right place, please give me
          directions about more specific ML; thanks

          -- Ivan



          ___________________________________
          Nuovo Yahoo! Messenger: E' molto più divertente:
          Audibles, Avatar, Webcam, Giochi, Rubrica… Scaricalo
          ora!
          http://it.messenger.yahoo.it



          ___________________________________
          Nuovo Yahoo! Messenger: E' molto più divertente: Audibles, Avatar, Webcam, Giochi, Rubrica… Scaricalo ora!
          http://it.messenger.yahoo.it
        Your message has been successfully submitted and would be delivered to recipients shortly.