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

Re: [soaplite] Re: long in Java Server

Expand Messages
  • Paul Kulchenko
    Hi, Simon! ... Why would it? Could you show your code? That s code for serializer (not for deserializer). Here is the code that works for me: my $long =
    Message 1 of 7 , Nov 23, 2001
    View Source
    • 0 Attachment
      Hi, Simon!

      --- eat_lemon@... wrote:
      > I tried using SOAP::Data->type(long => 123);
      > SOAP::Lite complained saying no deserializer found. It only stops
      Why would it? Could you show your code? That's code for serializer
      (not for deserializer). Here is the code that works for me:

      my $long = SOAP::Serializer
      ->serialize(SOAP::Data->name('mylong')->type(long => 123));

      print $long;
      print SOAP::Deserializer->deserialize($long)->root;

      and here is output it generates:

      <?xml version="1.0" encoding="UTF-8"?><mylong
      xmlns:SOAP-ENC="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"
      xsi:type="xsd:long">123</mylong>

      123

      As you see, long type is there and it's deserialized. Though
      SOAP::Lite WILL complain (Unspecified namespace for type 'long') if
      you have xsi:type="long" rather than "xsd:long" (and there is no
      default namespace), because there is no namespace associated with
      long type. Could you show XML code that deserializer complains on?

      > complaining after I added a SOAP::Serializer::as_long method. I
      > scanned through Lite.pm and I didn't find any as_long implemented
      > either. Is it because I have an old version? I downloaded the
      > newest version and looked through that Lite.pm and found no as_long
      > in there as well though.
      It's there. there are classes like
      SOAP::XMLSchemaSOAP1_1::Deserializer, SOAP::XMLSchema1999::Serializer
      and others. They have list of all types defined in SOAP specification
      or XML Schemas. You can override those, or add your handler in
      SOAP::Serializer, but by default all classes from XML Schema (and
      long also) should be handled without problem.

      Best wishes, Paul.

      __________________________________________________
      Do You Yahoo!?
      Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
      http://geocities.yahoo.com/ps/info1
    • eat_lemon@yahoo.ca
      Hi Paul, I tried what you did and I was able to serialize long properly, but my problem was the serialization of a method parameter that is of type long . I
      Message 2 of 7 , Nov 26, 2001
      View Source
      • 0 Attachment
        Hi Paul,

        I tried what you did and I was able to serialize long properly, but
        my problem was the serialization of a method parameter that is of
        type "long". I checked out the xml and found that it used the wrong
        namespace, but I don't know why. My code is as follows:

        my $lite = SOAP::Lite->uri('MyNameSpace')->proxy(...);
        my $param = SOAP::Data->type(long => 123);
        $lite->myMethod($param);

        Here is the xml:

        SOAPAction: "MyNameSpace#myMethod"

        <?xml version="1.0" encoding="UTF-8"?>
        <SOAP-ENV:Envelope xmlns:namesp2="MyNameSpace"
        xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
        SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
        xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsd="http://www.w3.org/1999/XMLSchema">
        <SOAP-ENV:Body>
        <namesp3:myMethod xmlns:namesp3="MyNameSpace">
        <c-gensym18 xsi:type="namesp2:long">123</c-gensym18>
        </namesp3:myMethod></SOAP-ENV:Body>

        As you can see, soaplite appends "namesp2" instead of "xsd" for long
        in a method call. Why did this happen? I know I can fix this by
        adding an as_long method, but is this the proper way to tackle this
        problem?

        Thanks a lot for your help!

        Simon

        --- In soaplite@y..., Paul Kulchenko <paulclinger@y...> wrote:
        > Hi, Simon!
        >
        > --- eat_lemon@y... wrote:
        > > I tried using SOAP::Data->type(long => 123);
        > > SOAP::Lite complained saying no deserializer found. It only
        stops
        > Why would it? Could you show your code? That's code for serializer
        > (not for deserializer). Here is the code that works for me:
        >
        > my $long = SOAP::Serializer
        > ->serialize(SOAP::Data->name('mylong')->type(long => 123));
        >
        > print $long;
        > print SOAP::Deserializer->deserialize($long)->root;
        >
        > and here is output it generates:
        >
        > <?xml version="1.0" encoding="UTF-8"?><mylong
        > xmlns:SOAP-ENC="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"
        > xsi:type="xsd:long">123</mylong>
        >
        > 123
        >
        > As you see, long type is there and it's deserialized. Though
        > SOAP::Lite WILL complain (Unspecified namespace for type 'long') if
        > you have xsi:type="long" rather than "xsd:long" (and there is no
        > default namespace), because there is no namespace associated with
        > long type. Could you show XML code that deserializer complains on?
        >
        > > complaining after I added a SOAP::Serializer::as_long method. I
        > > scanned through Lite.pm and I didn't find any as_long implemented
        > > either. Is it because I have an old version? I downloaded the
        > > newest version and looked through that Lite.pm and found no
        as_long
        > > in there as well though.
        > It's there. there are classes like
        > SOAP::XMLSchemaSOAP1_1::Deserializer,
        SOAP::XMLSchema1999::Serializer
        > and others. They have list of all types defined in SOAP
        specification
        > or XML Schemas. You can override those, or add your handler in
        > SOAP::Serializer, but by default all classes from XML Schema (and
        > long also) should be handled without problem.
        >
        > Best wishes, Paul.
        >
        > __________________________________________________
        > Do You Yahoo!?
        > Yahoo! GeoCities - quick and easy web site hosting, just
        $8.95/month.
        > http://geocities.yahoo.com/ps/info1
      • Paul Kulchenko
        Hi, Simon! Here is what your code generates for me (SOAP::Lite v0.52): SOAPAction: MyNameSpace#myMethod
        Message 3 of 7 , Nov 26, 2001
        View Source
        • 0 Attachment
          Hi, Simon!

          Here is what your code generates for me (SOAP::Lite v0.52):

          SOAPAction: "MyNameSpace#myMethod"

          <?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:myMethod
          xmlns:namesp1="MyNameSpace"><c-gensym3
          xsi:type="xsd:long">123</c-gensym3></namesp1:myMethod></SOAP-ENV:Body></SOAP-ENV:Envelope>

          For some previous versions you may need to specify 'xsd:long' instead
          of 'long' type, because not all types described in XML Schema were
          recognized. I believe I've added them all in v0.51. If you're using
          older version you may need to specify full type as 'xsd:long' or
          consider upgrade. Let me know if you still have a problem.

          Best wishes, Paul.

          --- eat_lemon@... wrote:
          > Hi Paul,
          >
          > I tried what you did and I was able to serialize long properly, but
          >
          > my problem was the serialization of a method parameter that is of
          > type "long". I checked out the xml and found that it used the
          > wrong
          > namespace, but I don't know why. My code is as follows:
          >
          > my $lite = SOAP::Lite->uri('MyNameSpace')->proxy(...);
          > my $param = SOAP::Data->type(long => 123);
          > $lite->myMethod($param);
          >
          > Here is the xml:
          >
          > SOAPAction: "MyNameSpace#myMethod"
          >
          > <?xml version="1.0" encoding="UTF-8"?>
          > <SOAP-ENV:Envelope xmlns:namesp2="MyNameSpace"
          > xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
          > SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
          > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
          > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
          > xmlns:xsd="http://www.w3.org/1999/XMLSchema">
          > <SOAP-ENV:Body>
          > <namesp3:myMethod xmlns:namesp3="MyNameSpace">
          > <c-gensym18 xsi:type="namesp2:long">123</c-gensym18>
          > </namesp3:myMethod></SOAP-ENV:Body>
          >
          > As you can see, soaplite appends "namesp2" instead of "xsd" for
          > long
          > in a method call. Why did this happen? I know I can fix this by
          > adding an as_long method, but is this the proper way to tackle this
          >
          > problem?
          >
          > Thanks a lot for your help!
          >
          > Simon
          >
          > --- In soaplite@y..., Paul Kulchenko <paulclinger@y...> wrote:
          > > Hi, Simon!
          > >
          > > --- eat_lemon@y... wrote:
          > > > I tried using SOAP::Data->type(long => 123);
          > > > SOAP::Lite complained saying no deserializer found. It only
          > stops
          > > Why would it? Could you show your code? That's code for
          > serializer
          > > (not for deserializer). Here is the code that works for me:
          > >
          > > my $long = SOAP::Serializer
          > > ->serialize(SOAP::Data->name('mylong')->type(long => 123));
          > >
          > > print $long;
          > > print SOAP::Deserializer->deserialize($long)->root;
          > >
          > > and here is output it generates:
          > >
          > > <?xml version="1.0" encoding="UTF-8"?><mylong
          > > xmlns:SOAP-ENC="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"
          > > xsi:type="xsd:long">123</mylong>
          > >
          > > 123
          > >
          > > As you see, long type is there and it's deserialized. Though
          > > SOAP::Lite WILL complain (Unspecified namespace for type 'long')
          > if
          > > you have xsi:type="long" rather than "xsd:long" (and there is no
          > > default namespace), because there is no namespace associated with
          > > long type. Could you show XML code that deserializer complains
          > on?
          > >
          > > > complaining after I added a SOAP::Serializer::as_long method.
          > I
          > > > scanned through Lite.pm and I didn't find any as_long
          > implemented
          > > > either. Is it because I have an old version? I downloaded the
          >
          > > > newest version and looked through that Lite.pm and found no
          > as_long
          > > > in there as well though.
          > > It's there. there are classes like
          > > SOAP::XMLSchemaSOAP1_1::Deserializer,
          > SOAP::XMLSchema1999::Serializer
          > > and others. They have list of all types defined in SOAP
          > specification
          > > or XML Schemas. You can override those, or add your handler in
          > > SOAP::Serializer, but by default all classes from XML Schema (and
          > > long also) should be handled without problem.
          > >
          > > Best wishes, Paul.
          > >
          > > __________________________________________________
          > > Do You Yahoo!?
          > > Yahoo! GeoCities - quick and easy web site hosting, just
          > $8.95/month.
          > > http://geocities.yahoo.com/ps/info1
          >
          >
          > ------------------------ 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!?
          Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
          http://geocities.yahoo.com/ps/info1
        • eat_lemon@yahoo.ca
          Hi Paul, You are right! It s because I m using 0.50. I upgraded it to 0.51 and it worked. Thank you so much for your time! Best wishes, Simon ...
          Message 4 of 7 , Nov 26, 2001
          View Source
          • 0 Attachment
            Hi Paul,

            You are right! It's because I'm using 0.50. I upgraded it to 0.51
            and it worked. Thank you so much for your time!

            Best wishes,

            Simon

            --- In soaplite@y..., Paul Kulchenko <paulclinger@y...> wrote:
            > Hi, Simon!
            >
            > Here is what your code generates for me (SOAP::Lite v0.52):
            >
            > SOAPAction: "MyNameSpace#myMethod"
            >
            > <?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:myMethod
            > xmlns:namesp1="MyNameSpace"><c-gensym3
            > xsi:type="xsd:long">123</c-gensym3></namesp1:myMethod></SOAP-
            ENV:Body></SOAP-ENV:Envelope>
            >
            > For some previous versions you may need to specify 'xsd:long'
            instead
            > of 'long' type, because not all types described in XML Schema were
            > recognized. I believe I've added them all in v0.51. If you're using
            > older version you may need to specify full type as 'xsd:long' or
            > consider upgrade. Let me know if you still have a problem.
            >
            > Best wishes, Paul.
            >
            > --- eat_lemon@y... wrote:
            > > Hi Paul,
            > >
            > > I tried what you did and I was able to serialize long properly,
            but
            > >
            > > my problem was the serialization of a method parameter that is of
            > > type "long". I checked out the xml and found that it used the
            > > wrong
            > > namespace, but I don't know why. My code is as follows:
            > >
            > > my $lite = SOAP::Lite->uri('MyNameSpace')->proxy(...);
            > > my $param = SOAP::Data->type(long => 123);
            > > $lite->myMethod($param);
            > >
            > > Here is the xml:
            > >
            > > SOAPAction: "MyNameSpace#myMethod"
            > >
            > > <?xml version="1.0" encoding="UTF-8"?>
            > > <SOAP-ENV:Envelope xmlns:namesp2="MyNameSpace"
            > > xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
            > > SOAP-
            ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
            > > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
            > > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
            > > xmlns:xsd="http://www.w3.org/1999/XMLSchema">
            > > <SOAP-ENV:Body>
            > > <namesp3:myMethod xmlns:namesp3="MyNameSpace">
            > > <c-gensym18 xsi:type="namesp2:long">123</c-gensym18>
            > > </namesp3:myMethod></SOAP-ENV:Body>
            > >
            > > As you can see, soaplite appends "namesp2" instead of "xsd" for
            > > long
            > > in a method call. Why did this happen? I know I can fix this by
            > > adding an as_long method, but is this the proper way to tackle
            this
            > >
            > > problem?
            > >
            > > Thanks a lot for your help!
            > >
            > > Simon
            > >
            > > --- In soaplite@y..., Paul Kulchenko <paulclinger@y...> wrote:
            > > > Hi, Simon!
            > > >
            > > > --- eat_lemon@y... wrote:
            > > > > I tried using SOAP::Data->type(long => 123);
            > > > > SOAP::Lite complained saying no deserializer found. It only
            > > stops
            > > > Why would it? Could you show your code? That's code for
            > > serializer
            > > > (not for deserializer). Here is the code that works for me:
            > > >
            > > > my $long = SOAP::Serializer
            > > > ->serialize(SOAP::Data->name('mylong')->type(long => 123));
            > > >
            > > > print $long;
            > > > print SOAP::Deserializer->deserialize($long)->root;
            > > >
            > > > and here is output it generates:
            > > >
            > > > <?xml version="1.0" encoding="UTF-8"?><mylong
            > > > xmlns:SOAP-ENC="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"
            > > > xsi:type="xsd:long">123</mylong>
            > > >
            > > > 123
            > > >
            > > > As you see, long type is there and it's deserialized. Though
            > > > SOAP::Lite WILL complain (Unspecified namespace for type 'long')
            > > if
            > > > you have xsi:type="long" rather than "xsd:long" (and there is no
            > > > default namespace), because there is no namespace associated
            with
            > > > long type. Could you show XML code that deserializer complains
            > > on?
            > > >
            > > > > complaining after I added a SOAP::Serializer::as_long method.
            > > I
            > > > > scanned through Lite.pm and I didn't find any as_long
            > > implemented
            > > > > either. Is it because I have an old version? I downloaded
            the
            > >
            > > > > newest version and looked through that Lite.pm and found no
            > > as_long
            > > > > in there as well though.
            > > > It's there. there are classes like
            > > > SOAP::XMLSchemaSOAP1_1::Deserializer,
            > > SOAP::XMLSchema1999::Serializer
            > > > and others. They have list of all types defined in SOAP
            > > specification
            > > > or XML Schemas. You can override those, or add your handler in
            > > > SOAP::Serializer, but by default all classes from XML Schema
            (and
            > > > long also) should be handled without problem.
            > > >
            > > > Best wishes, Paul.
            > > >
            > > > __________________________________________________
            > > > Do You Yahoo!?
            > > > Yahoo! GeoCities - quick and easy web site hosting, just
            > > $8.95/month.
            > > > http://geocities.yahoo.com/ps/info1
            > >
            > >
            > > ------------------------ Yahoo! Groups Sponsor
            > >
            > > To unsubscribe from this group, send an email to:
            > > soaplite-unsubscribe@y...
            > >
            > >
            > >
            > > Your use of Yahoo! Groups is subject to
            > > http://docs.yahoo.com/info/terms/
            > >
            > >
            >
            >
            > __________________________________________________
            > Do You Yahoo!?
            > Yahoo! GeoCities - quick and easy web site hosting, just
            $8.95/month.
            > http://geocities.yahoo.com/ps/info1
          Your message has been successfully submitted and would be delivered to recipients shortly.