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

axis - soap::lite interoperability

Expand Messages
  • jimmi1232002
    Hello, I am a newbie to soap::lite. I am trying to interoperate axis java server and soap::lite client. At this point, I already tested the interoperability of
    Message 1 of 3 , May 3 9:11 AM
    • 0 Attachment
      Hello, I am a newbie to soap::lite. I am trying to interoperate axis
      java server and soap::lite client. At this point, I already tested the
      interoperability of simple datatypes (it works) and now I want to pass
      complex datatype, array of structures.

      all my server datatypes are in custom namespace
      (http://datatypes.portal.creator.syndesis.com), this is from axis
      deployment descriptor, note xmlns attribute:

      ------snip-------
      <typeMapping
      xmlns:ns="http://datatypes.portal.creator.syndesis.com"
      qname="ns:SearchCriteria"

      type="java:com.syndesis.creator.portal.datatypes.SearchCriteriaItem[]"

      serializer="org.apache.axis.encoding.ser.ArraySerializerFactory"

      deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory"
      encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      />
      ------snip-------

      This is the client source code (I tried both SOAP::Data approach and
      plain perl structure approach):

      ------snip-------
      use Class::Struct;
      struct( SearchCriteriaItem => {
      Name => '$',
      Value => '$',
      });

      my $sc = new SearchCriteriaItem;
      $sc->Name("srname");
      $sc->Value("*");

      my $dt = [SOAP::Data->name("SearchCriteriaItem" => $sc)];
      use SOAP::Lite +trace => all;

      my $soap = SOAP::Lite ->
      service('file:/disk2/act41/WebGUI/tomcat/webapps/axis/test.wsdl');


      #$soap->serializer->prefix("http://test.portal.creator.syndesis.com");

      #$soap->serializer->uri("http://test.portal.creator.syndesis.com");


      #print $soap ->
      query('SRntNetwork',[SOAP::Data->name("SearchCriteriaItem" =>
      [SOAP::Data->name("Name" => "srname"), SOAP::Data->name("Value" =>
      "*")])]);
      $a = [{Name => 'srname', Value => '*'}];
      print $soap -> query('SRntNetwork',$dt);
      ------snip-------

      All fails because of the following problem:
      Namespaces coming from perl (client side):

      xmlns:namesp2="http://xml.apache.org/xml-soap" (for SOAPStruct, this
      namespace is hardcoded)
      xmlns:namesp2="http://namespaces.soaplite.com/perl (for any other
      generic SOAP::Data array or structure coming from perl side)

      This is what we get as a result of namespace incompatibility on server
      side:
      <faultstring>org.xml.sax.SAXException: No deserializer defined for
      array type
      http://namespaces.soaplite.com/perl:SearchCriteriaItem</faultstring>

      As far as I understand, I have two options:

      1) on server-side, generate all datatypes to be in soap::lite
      namespace, so that they can be properly deserialized. But this
      approach means that for every client I want to support I need a
      different server with different namespace, and this is not real
      interoperability.

      2) make soap::lite specify server-side namespace in serialization
      somehow.

      Could someone please clarify on that, because right now
      interoperability seems no more than a hype to me.

      Thanks, Anton.
    • Paul Kulchenko
      Hi, Anton! Probably something like this should work: # define SearchCriteriaItem object my $sci = bless { Name = srname , Value = * , } =
      Message 2 of 3 , May 3 10:24 AM
      • 0 Attachment
        Hi, Anton!

        Probably something like this should work:

        # define SearchCriteriaItem object
        my $sci = bless {
        Name => 'srname',
        Value => '*',
        } => 'SearchCriteriaItem';

        # define SearchCriteria object
        my $sc = bless [
        $sci,
        ] => 'SearchCriteria';

        my $s = SOAP::Lite
        -> proxy("http://localhost/")
        -> uri('http://foo/')

        # map SearchCriteriaItem and SearchCriteria object to namespaces
        -> maptype({
        SearchCriteriaItem => 'http://test.portal.creator.syndesis.com',
        SearchCriteria => 'http://test.portal.creator.syndesis.com',
        })
        ;

        # call
        $s->query(SRntNetwork => $sc);

        > 2) make soap::lite specify server-side namespace in serialization
        > somehow.
        You can use maptype() method to specify namespace associated with
        datatype. Let me know if you still have problems.

        Best wishes, Paul.

        --- jimmi1232002 <kraev@...> wrote:
        > Hello, I am a newbie to soap::lite. I am trying to interoperate
        > axis
        > java server and soap::lite client. At this point, I already tested
        > the
        > interoperability of simple datatypes (it works) and now I want to
        > pass
        > complex datatype, array of structures.
        >
        > all my server datatypes are in custom namespace
        > (http://datatypes.portal.creator.syndesis.com), this is from axis
        > deployment descriptor, note xmlns attribute:
        >
        > ------snip-------
        > <typeMapping
        > xmlns:ns="http://datatypes.portal.creator.syndesis.com"
        > qname="ns:SearchCriteria"
        >
        >
        type="java:com.syndesis.creator.portal.datatypes.SearchCriteriaItem[]"
        >
        > serializer="org.apache.axis.encoding.ser.ArraySerializerFactory"
        >
        >
        deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory"
        > encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        > />
        > ------snip-------
        >
        > This is the client source code (I tried both SOAP::Data approach
        > and
        > plain perl structure approach):
        >
        > ------snip-------
        > use Class::Struct;
        > struct( SearchCriteriaItem => {
        > Name => '$',
        > Value => '$',
        > });
        >
        > my $sc = new SearchCriteriaItem;
        > $sc->Name("srname");
        > $sc->Value("*");
        >
        > my $dt = [SOAP::Data->name("SearchCriteriaItem" => $sc)];
        > use SOAP::Lite +trace => all;
        >
        > my $soap = SOAP::Lite ->
        > service('file:/disk2/act41/WebGUI/tomcat/webapps/axis/test.wsdl');
        >
        >
        >
        #$soap->serializer->prefix("http://test.portal.creator.syndesis.com");
        >
        > #$soap->serializer->uri("http://test.portal.creator.syndesis.com");
        >
        >
        > #print $soap ->
        > query('SRntNetwork',[SOAP::Data->name("SearchCriteriaItem" =>
        > [SOAP::Data->name("Name" => "srname"), SOAP::Data->name("Value" =>
        > "*")])]);
        > $a = [{Name => 'srname', Value => '*'}];
        > print $soap -> query('SRntNetwork',$dt);
        > ------snip-------
        >
        > All fails because of the following problem:
        > Namespaces coming from perl (client side):
        >
        > xmlns:namesp2="http://xml.apache.org/xml-soap" (for SOAPStruct,
        > this
        > namespace is hardcoded)
        > xmlns:namesp2="http://namespaces.soaplite.com/perl (for any other
        > generic SOAP::Data array or structure coming from perl side)
        >
        > This is what we get as a result of namespace incompatibility on
        > server
        > side:
        > <faultstring>org.xml.sax.SAXException: No deserializer defined
        > for
        > array type
        >
        http://namespaces.soaplite.com/perl:SearchCriteriaItem</faultstring>
        >
        > As far as I understand, I have two options:
        >
        > 1) on server-side, generate all datatypes to be in soap::lite
        > namespace, so that they can be properly deserialized. But this
        > approach means that for every client I want to support I need a
        > different server with different namespace, and this is not real
        > interoperability.
        >
        > 2) make soap::lite specify server-side namespace in serialization
        > somehow.
        >
        > Could someone please clarify on that, because right now
        > interoperability seems no more than a hype to me.
        >
        > Thanks, Anton.
        >
        >
        > ------------------------ 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! Health - your guide to health and wellness
        http://health.yahoo.com
      • Anton Kraev
        ... Paul, Thanks a lot for your support! maptype works perfectly for me. This should be put in some kind of FAQ :) Thanks, Anton.
        Message 3 of 3 , May 3 12:05 PM
        • 0 Attachment
          Paul Kulchenko wrote:

          > Hi, Anton!
          >
          > Probably something like this should work:
          >
          > # define SearchCriteriaItem object
          > my $sci = bless {
          > Name => 'srname',
          > Value => '*',
          > } => 'SearchCriteriaItem';
          >
          > # define SearchCriteria object
          > my $sc = bless [
          > $sci,
          > ] => 'SearchCriteria';
          >
          > my $s = SOAP::Lite
          > -> proxy("http://localhost/")
          > -> uri('http://foo/')
          >
          > # map SearchCriteriaItem and SearchCriteria object to namespaces
          > -> maptype({
          > SearchCriteriaItem => 'http://test.portal.creator.syndesis.com',
          > SearchCriteria => 'http://test.portal.creator.syndesis.com',
          > })
          > ;
          >
          > # call
          > $s->query(SRntNetwork => $sc);
          >
          > > 2) make soap::lite specify server-side namespace in serialization
          > > somehow.
          > You can use maptype() method to specify namespace associated with
          > datatype. Let me know if you still have problems.

          Paul,

          Thanks a lot for your support! maptype works perfectly for me.
          This should be put in some kind of FAQ :)

          Thanks, Anton.

          >
          >
          > Best wishes, Paul.
          >
          > --- jimmi1232002 <kraev@...> wrote:
          > > Hello, I am a newbie to soap::lite. I am trying to interoperate
          > > axis
          > > java server and soap::lite client. At this point, I already tested
          > > the
          > > interoperability of simple datatypes (it works) and now I want to
          > > pass
          > > complex datatype, array of structures.
          > >
          > > all my server datatypes are in custom namespace
          > > (http://datatypes.portal.creator.syndesis.com), this is from axis
          > > deployment descriptor, note xmlns attribute:
          > >
          > > ------snip-------
          > > <typeMapping
          > > xmlns:ns="http://datatypes.portal.creator.syndesis.com"
          > > qname="ns:SearchCriteria"
          > >
          > >
          > type="java:com.syndesis.creator.portal.datatypes.SearchCriteriaItem[]"
          > >
          > > serializer="org.apache.axis.encoding.ser.ArraySerializerFactory"
          > >
          > >
          > deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory"
          > > encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
          > > />
          > > ------snip-------
          > >
          > > This is the client source code (I tried both SOAP::Data approach
          > > and
          > > plain perl structure approach):
          > >
          > > ------snip-------
          > > use Class::Struct;
          > > struct( SearchCriteriaItem => {
          > > Name => '$',
          > > Value => '$',
          > > });
          > >
          > > my $sc = new SearchCriteriaItem;
          > > $sc->Name("srname");
          > > $sc->Value("*");
          > >
          > > my $dt = [SOAP::Data->name("SearchCriteriaItem" => $sc)];
          > > use SOAP::Lite +trace => all;
          > >
          > > my $soap = SOAP::Lite ->
          > > service('file:/disk2/act41/WebGUI/tomcat/webapps/axis/test.wsdl');
          > >
          > >
          > >
          > #$soap->serializer->prefix("http://test.portal.creator.syndesis.com");
          > >
          > > #$soap->serializer->uri("http://test.portal.creator.syndesis.com");
          > >
          > >
          > > #print $soap ->
          > > query('SRntNetwork',[SOAP::Data->name("SearchCriteriaItem" =>
          > > [SOAP::Data->name("Name" => "srname"), SOAP::Data->name("Value" =>
          > > "*")])]);
          > > $a = [{Name => 'srname', Value => '*'}];
          > > print $soap -> query('SRntNetwork',$dt);
          > > ------snip-------
          > >
          > > All fails because of the following problem:
          > > Namespaces coming from perl (client side):
          > >
          > > xmlns:namesp2="http://xml.apache.org/xml-soap" (for SOAPStruct,
          > > this
          > > namespace is hardcoded)
          > > xmlns:namesp2="http://namespaces.soaplite.com/perl (for any other
          > > generic SOAP::Data array or structure coming from perl side)
          > >
          > > This is what we get as a result of namespace incompatibility on
          > > server
          > > side:
          > > <faultstring>org.xml.sax.SAXException: No deserializer defined
          > > for
          > > array type
          > >
          > http://namespaces.soaplite.com/perl:SearchCriteriaItem</faultstring>
          > >
          > > As far as I understand, I have two options:
          > >
          > > 1) on server-side, generate all datatypes to be in soap::lite
          > > namespace, so that they can be properly deserialized. But this
          > > approach means that for every client I want to support I need a
          > > different server with different namespace, and this is not real
          > > interoperability.
          > >
          > > 2) make soap::lite specify server-side namespace in serialization
          > > somehow.
          > >
          > > Could someone please clarify on that, because right now
          > > interoperability seems no more than a hype to me.
          > >
          > > Thanks, Anton.
          > >
          > >
          > > ------------------------ 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! Health - your guide to health and wellness
          > http://health.yahoo.com
        Your message has been successfully submitted and would be delivered to recipients shortly.