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

Re: [soaplite] Serialization problem with ArrayOfdouble

Expand Messages
  • Paul Kulchenko
    Hi Darla, It seems like your best bet is to disable autotyping since the most of the information is generated from WSDL anyway. Something like this might work:
    Message 1 of 3 , Nov 24, 2002
      Hi Darla,

      It seems like your best bet is to disable autotyping since the most
      of the information is generated from WSDL anyway. Something like this
      might work:

      my $service = SOAP::Lite->service('....')->autotype(0);

      Best wishes, Paul.

      --- tigerdarla <dweiss@...> wrote:
      > Hello all,
      >
      > I am using SOAP::Lite for my client and GLUE (using Java) as my
      > server. I created some simple tests on the server that just return
      > the argument they are called with. (The point of this is to test
      > that
      > the Perl and Java data types are playing nicely with each other.)
      >
      > I am pretty new to SOAP::Lite and Perl in general, so pardon me if
      > my
      > code looks like Java. :) Hopefully I am overlooking something
      > simple
      > here.
      >
      > I am working with 2 methods: testDouble and testDoubleArray. Here
      > is
      > a snippet of the code SOAP::Lite generated from the WSDL:
      >
      > my %methods = (
      > testDouble => {
      > endpoint => 'http://localhost:8004/fit/urn:cdctest',
      > soapaction => 'testDouble',
      > uri => 'http://tempuri.org/fit.soaplets.test.CdcApiTest',
      > parameters => [
      > SOAP::Data->new(name => 'x', type => 'ns:double', attr =>
      > {'xmlns:ns' => 'http://www.w3.org/2001/XMLSchema'}),
      > ],
      > },
      > testDoubleArray => {
      > endpoint => 'http://localhost:8004/fit/urn:cdctest',
      > soapaction => 'testDoubleArray',
      > uri => 'http://tempuri.org/fit.soaplets.test.CdcApiTest',
      > parameters => [
      > SOAP::Data->new(name => 'x', type => 'ns:ArrayOfdouble', attr
      > =>
      > {'xmlns:ns' => 'http://www.w3.org/2001/XMLSchema'}),
      > ],
      > },
      > );
      >
      > Calling testDouble works fine. Here is the body of the SOAP
      > message
      > that the client sends to the server:
      >
      > <namesp1:testDouble
      > xmlns:namesp1='http://tempuri.org/fit.soaplets.test.CdcApiTest'>
      > <x xmlns:ns='http://www.w3.org/2001/XMLSchema'
      > xsi:type='ns:double'>5.555555555555</x>
      > </namesp1:testDouble>
      >
      > The server returns as expected:
      >
      > <n:testDoubleResponse
      > xmlns:n='http://tempuri.org/fit.soaplets.test.CdcApiTest'>
      > <Result xsi:type='xsd:double'>5.555555555555</Result>
      > </n:testDoubleResponse>
      >
      > The problem is with the double array. Here is the SOAP sent from
      > the
      > client:
      >
      > <namesp2:testDoubleArray
      > xmlns:namesp2='http://tempuri.org/fit.soaplets.test.CdcApiTest'>
      > <x SOAP-ENC:arrayType='xsd:float[3]'
      > xmlns:ns='http://www.w3.org/2001/XMLSchema'
      > xsi:type='ns:ArrayOfdouble'>
      > <item xsi:type='xsd:float'>1.333333333333</item>
      > <item xsi:type='xsd:float'>2.444444444444</item>
      > <item xsi:type='xsd:float'>3.555555555555</item>
      > </x>
      > </namesp2:testDoubleArray>
      >
      > It correctly gets the main type "ArrayOfdouble", I assume from the
      > specification in the Perl code shown above. But the elements of
      > the
      > array are floats, which causes a Java exception on the server:
      >
      > java.lang.IllegalArgumentException: argument type mismatch
      >
      > Is there a convenient way to get the array elements to have the
      > right
      > type? I have managed to get this working with a custom Double
      > class,
      > serializer, and deserializer on the client. But since I have to
      > repeat this for many other Java types (float, char, short, long,
      > etc.)
      > I'm hoping there's a more general solution.
      >
      > Thanks!
      >
      > => Darla
      >
      >
      >
      > 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! Mail Plus � Powerful. Affordable. Sign up now.
      http://mailplus.yahoo.com
    • Darla Weiss
      Thanks, but that didn t seem to help. Now the SOAP message looks like this:
      Message 2 of 3 , Nov 25, 2002
        Thanks, but that didn't seem to help. Now the SOAP message looks like this:

        <namesp2:testDoubleArray
        xmlns:namesp2='http://tempuri.org/fit.soaplets.test.CdcApiTest'>
        <x SOAP-ENC:arrayType='xsd:ur-type[3]'
        xmlns:ns='http://www.w3.org/2001/XMLSchema' xsi:type='ns:ArrayOfdouble'>
        <item>1.333333333333</item>
        <item>2.444444444444</item>
        <item>3.555555555555</item>
        </x>
        </namesp2:testDoubleArray>

        And I get a different error message:

        java.rmi.UnmarshalException: electric.xml.io.schema.SchemaException:
        could not find a type with qname http://www.w3.org/1999/XMLSchema:ur-type

        Any other ideas? Thanks,

        => Darla


        Paul Kulchenko wrote:
        > Hi Darla,
        >
        > It seems like your best bet is to disable autotyping since the most
        > of the information is generated from WSDL anyway. Something like this
        > might work:
        >
        > my $service = SOAP::Lite->service('....')->autotype(0);
        >
        > Best wishes, Paul.
        >
        > --- tigerdarla <dweiss@...> wrote:
        >
        >>Hello all,
        >>
        >>I am using SOAP::Lite for my client and GLUE (using Java) as my
        >>server. I created some simple tests on the server that just return
        >>the argument they are called with. (The point of this is to test
        >>that
        >>the Perl and Java data types are playing nicely with each other.)
        >>
        >>I am pretty new to SOAP::Lite and Perl in general, so pardon me if
        >>my
        >>code looks like Java. :) Hopefully I am overlooking something
        >>simple
        >>here.
        >>
        >>I am working with 2 methods: testDouble and testDoubleArray. Here
        >>is
        >>a snippet of the code SOAP::Lite generated from the WSDL:
        >>
        >>my %methods = (
        >> testDouble => {
        >> endpoint => 'http://localhost:8004/fit/urn:cdctest',
        >> soapaction => 'testDouble',
        >> uri => 'http://tempuri.org/fit.soaplets.test.CdcApiTest',
        >> parameters => [
        >> SOAP::Data->new(name => 'x', type => 'ns:double', attr =>
        >>{'xmlns:ns' => 'http://www.w3.org/2001/XMLSchema'}),
        >> ],
        >> },
        >> testDoubleArray => {
        >> endpoint => 'http://localhost:8004/fit/urn:cdctest',
        >> soapaction => 'testDoubleArray',
        >> uri => 'http://tempuri.org/fit.soaplets.test.CdcApiTest',
        >> parameters => [
        >> SOAP::Data->new(name => 'x', type => 'ns:ArrayOfdouble', attr
        >>=>
        >>{'xmlns:ns' => 'http://www.w3.org/2001/XMLSchema'}),
        >> ],
        >> },
        >>);
        >>
        >>Calling testDouble works fine. Here is the body of the SOAP
        >>message
        >>that the client sends to the server:
        >>
        >> <namesp1:testDouble
        >>xmlns:namesp1='http://tempuri.org/fit.soaplets.test.CdcApiTest'>
        >> <x xmlns:ns='http://www.w3.org/2001/XMLSchema'
        >>xsi:type='ns:double'>5.555555555555</x>
        >> </namesp1:testDouble>
        >>
        >>The server returns as expected:
        >>
        >> <n:testDoubleResponse
        >>xmlns:n='http://tempuri.org/fit.soaplets.test.CdcApiTest'>
        >> <Result xsi:type='xsd:double'>5.555555555555</Result>
        >> </n:testDoubleResponse>
        >>
        >>The problem is with the double array. Here is the SOAP sent from
        >>the
        >>client:
        >>
        >> <namesp2:testDoubleArray
        >>xmlns:namesp2='http://tempuri.org/fit.soaplets.test.CdcApiTest'>
        >> <x SOAP-ENC:arrayType='xsd:float[3]'
        >>xmlns:ns='http://www.w3.org/2001/XMLSchema'
        >>xsi:type='ns:ArrayOfdouble'>
        >> <item xsi:type='xsd:float'>1.333333333333</item>
        >> <item xsi:type='xsd:float'>2.444444444444</item>
        >> <item xsi:type='xsd:float'>3.555555555555</item>
        >> </x>
        >> </namesp2:testDoubleArray>
        >>
        >>It correctly gets the main type "ArrayOfdouble", I assume from the
        >>specification in the Perl code shown above. But the elements of
        >>the
        >>array are floats, which causes a Java exception on the server:
        >>
        >> java.lang.IllegalArgumentException: argument type mismatch
        >>
        >>Is there a convenient way to get the array elements to have the
        >>right
        >>type? I have managed to get this working with a custom Double
        >>class,
        >>serializer, and deserializer on the client. But since I have to
        >>repeat this for many other Java types (float, char, short, long,
        >>etc.)
        >>I'm hoping there's a more general solution.
        >>
        >>Thanks!
        >>
        >>=> Darla
        >>
        >>
        >>
        >>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! Mail Plus – Powerful. Affordable. Sign up now.
        > http://mailplus.yahoo.com
        >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.