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

serialize new data types.

Expand Messages
  • sid james
    Hi, I m having difficulty understanding and implementing SOAP::Lite for the xml I need to produce for the SOAP server. I have searched for examples but have
    Message 1 of 3 , Oct 21, 2002
      Hi,
      I'm having difficulty understanding and implementing
      SOAP::Lite for the xml I need to produce for the SOAP
      server. I have searched for examples but have come up
      with very little. I hope someone can help me.

      I need to produce the following xml.

      <mydatatype xmlns:ns2="urn:aa:bb:mydata1"
      xsi:type="ns2:mydata1">
      <Name xsi:type="xsd:string" xsi:null="true"/>
      <Address
      xmlns:ns5="http://schemas.xmlsoap.org/soap/encoding/"
      xsi:type="ns5:Array" xmlns:ns6="urn:aa:bb:myaddress"
      ns5:arrayType="ns6:Address[]" xsi:null="true"/>
      </mydatatype>

      Since I will have my own data type I thought I should
      add typelookup for these data types.

      my @parameters = (
      SOAP::Data->name("Name" => "Me"),

      SOAP::Data->uri('urn:aa:bb:mydata1')->type(mydata1 =>
      [
      SOAP::Data->name("Address")-> type(Address => [
      SOAP::Data->name("MyRoad")
      ])
      ])
      }

      my $client = SOAP::Lite
      ->uri("urn:aa:bb")
      ->proxy("http://.................");

      $client->typelookup->{mydata1} =
      [11, sub { $_[0] =~ Address }, 'as_mydata1'];

      $response = $client->GetMydata(@parameters);

      sub SOAP::Serializer::as_mydata1 {
      my $self = shift;
      my($value, $name, $type, $attr) = @_;
      return [$name, {'xsi:type' => 'xsd:mydata1',
      %$attr}, $value];
      }
      This generates the following xml for mydata1
      <namesp2:c-gensym4 xmlns:namesp2="urn:aa:bb:mydata1
      SOAP-ENC:arrayType="xsd:string[1]"
      xsi:type="namesp3:mydata1">

      I can't get the SOAP server to accept this format with
      the arrayType="xsd:string[1]" in the xml.
      I also need to add the code to generate the Address
      array within the mydata1 datatype.

      Best Regards
      David


      _____________________________________________________
      Gratis e-mail resten av livet på www.yahoo.se/mail
      Busenkelt!
    • sid james
      I ve managed to fix the array problem with SOAP::Data- uri( urn:aa:bb:mydata1 )- type( mydata1 )- name( myname = SOAP::Data- value(SOAP::Data- name( Name
      Message 2 of 3 , Oct 22, 2002
        I've managed to fix the array problem with

        SOAP::Data->uri('urn:aa:bb:mydata1')->type('mydata1')->name("myname"
        => \
        SOAP::Data->value(SOAP::Data->name("Name" =>
        "name"))).........etc

        The remaining problem is that the xml produced for the
        datatype mydata1 has a namespace that refers to
        soaplite, the SOAP server doesn't like this (
        xmlns:namesp3="http://namespaces.soaplite.com/perl")

        This namespace in turn produces the error
        <faultstring>No Deserializer found to deserialize a
        'http://namespaces.soaplite.
        com/perl:TRUpdate' using encoding style
        'http://schemas.xmlsoap.org/soap/encodin
        g/'.</faultstring>

        I have tried
        ->encodingStyle('http://schemas.xlmsoap.org/soap/encoding/')with
        no success, Ideas please folks.

        /David



        --- sid james <sid69se@...> skrev:
        <HR>
        <html><body>


        <tt>
        Hi,<BR>
        I'm having difficulty understanding and
        implementing<BR>
        SOAP::Lite for the xml I need to produce for the
        SOAP<BR>
        server. I have searched for examples but have come
        up<BR>
        with very little. I hope someone can help me.<BR>
        <BR>
        I need to produce the following xml.<BR>
        <BR>
        <mydatatype
        xmlns:ns2="urn:aa:bb:mydata1"<BR>
        xsi:type="ns2:mydata1"><BR>
        <Name xsi:type="xsd:string"
        xsi:null="true"/><BR>
        <Address<BR>
        xmlns:ns5="<a
        href="http://schemas.xmlsoap.org/soap/encoding/">http://schemas.xmlsoap.org/soap/encoding/</a>"<BR>
        xsi:type="ns5:Array"
        xmlns:ns6="urn:aa:bb:myaddress"<BR>
        ns5:arrayType="ns6:Address[]"
        xsi:null="true"/><BR>
        </mydatatype><BR>
        <BR>
        Since I will have my own data type I thought I
        should<BR>
        add typelookup for these data types.<BR>
        <BR>
        my @parameters = (<BR>
             
        SOAP::Data->name("Name" =>
        "Me"),<BR>
               <BR>
        SOAP::Data->uri('urn:aa:bb:mydata1')->type(mydata1
        =><BR>
        [<BR>
             
             
        SOAP::Data->name("Address")->
        type(Address => [<BR>
                       
        SOAP::Data->name("MyRoad")<BR>
                ])<BR>
        ])<BR>
        }<BR>
        <BR>
        my $client = SOAP::Lite<BR>
                       
        ->uri("urn:aa:bb")<BR>
                       
        ->proxy("<a
        href="http://.................">http://.................</a>");<BR>
                   
        <BR>
             
        $client->typelookup->{mydata1} =<BR>
                
             
              [11, sub { $_[0] =~
        Address }, 'as_mydata1'];   <BR>
                    
        <BR>
              $response =
        $client->GetMydata(@parameters);<BR>
        <BR>
        sub SOAP::Serializer::as_mydata1 {<BR>
                 
              my $self = shift;<BR>
                 
              my($value, $name,
        $type, $attr) = @_;<BR>
                 
              return [$name,
        {'xsi:type' => 'xsd:mydata1',<BR>
        %$attr}, $value];<BR>
                }<BR>
        This generates the following xml for mydata1<BR>
        <namesp2:c-gensym4
        xmlns:namesp2="urn:aa:bb:mydata1<BR>
        SOAP-ENC:arrayType="xsd:string[1]"<BR>
        xsi:type="namesp3:mydata1"><BR>
        <BR>
        I can't get the SOAP server to accept this format
        with<BR>
        the arrayType="xsd:string[1]" in the
        xml.<BR>
        I also need to add the code to generate the
        Address<BR>
        array within the mydata1 datatype.<BR>
        <BR>
        Best Regards<BR>
        David<BR>
        <BR>
        <BR>
        _____________________________________________________<BR>
        Gratis e-mail resten av livet på www.yahoo.se/mail<BR>
        Busenkelt!<BR>
        </tt>

        <br>

        <!-- |**|begin egp html banner|**| -->

        <table border=0 cellspacing=0 cellpadding=2>
        <tr bgcolor=#FFFFCC>
        <td align=center><font size="-1"
        color=#003399><b>Yahoo! Groups Sponsor</b></font></td>
        </tr>
        <tr bgcolor=#FFFFFF>
        <td align=center width=470><table border=0
        cellpadding=0 cellspacing=0> <tr> <td
        align=center><font face=arial
        size=-2>ADVERTISEMENT</font><br><a
        href="http://rd.yahoo.com/M=237459.2482214.3917349.2146399/D=egroupweb/S=1705701014:HM/A=1267611/R=0/*http://ad.doubleclick.net/jump/N2524.Yahoo/B1071650;sz=300x250;ord=1035266908539055?"
        target =_blank><img
        src="http://ad.doubleclick.net/ad/N2524.Yahoo/B1071650;sz=300x250;ord=1035266908539055?"
        alt="" width="300" height="250"
        border="0"></a></td></tr></table></td>
        </tr>
        <tr><td><img alt="" width=1 height=1
        src="http://us.adserver.yahoo.com/l?M=237459.2482214.3917349.2146399/D=egroupmail/S=:HM/A=1267611/rand=250731911"></td></tr>
        </table>

        <!-- |**|end egp html banner|**| -->


        <br>
        <tt>
        To unsubscribe from this group, send an email to:<BR>
        soaplite-unsubscribe@yahoogroups.com<BR>
        <BR>
        </tt>
        <br>

        <br>
        <tt>Your use of Yahoo! Groups is subject to the <a
        href="http://docs.yahoo.com/info/terms/">Yahoo! Terms
        of Service</a>.</tt>
        </br>

        </body></html>


        _____________________________________________________
        Gratis e-mail resten av livet på www.yahoo.se/mail
        Busenkelt!
      • sid69se
        I ve managed to fix the problem myself, thanks. ... href= http://schemas.xmlsoap.org/soap/encoding/ http://schemas.xmlsoa p.org/soap/encoding/ ...
        Message 3 of 3 , Oct 28, 2002
          I've managed to fix the problem myself, thanks.

          --- In soaplite@y..., sid james <sid69se@y...> wrote:
          > I've managed to fix the array problem with
          >
          > SOAP::Data->uri('urn:aa:bb:mydata1')->type('mydata1')->name("myname"
          > => \
          > SOAP::Data->value(SOAP::Data->name("Name" =>
          > "name"))).........etc
          >
          > The remaining problem is that the xml produced for the
          > datatype mydata1 has a namespace that refers to
          > soaplite, the SOAP server doesn't like this (
          > xmlns:namesp3="http://namespaces.soaplite.com/perl")
          >
          > This namespace in turn produces the error
          > <faultstring>No Deserializer found to deserialize a
          > 'http://namespaces.soaplite.
          > com/perl:TRUpdate' using encoding style
          > 'http://schemas.xmlsoap.org/soap/encodin
          > g/'.</faultstring>
          >
          > I have tried
          > ->encodingStyle('http://schemas.xlmsoap.org/soap/encoding/')with
          > no success, Ideas please folks.
          >
          > /David
          >
          >
          >
          > --- sid james <sid69se@y...> skrev:
          > <HR>
          > <html><body>
          >
          >
          > <tt>
          > Hi,<BR>
          > I'm having difficulty understanding and
          > implementing<BR>
          > SOAP::Lite for the xml I need to produce for the
          > SOAP<BR>
          > server. I have searched for examples but have come
          > up<BR>
          > with very little. I hope someone can help me.<BR>
          > <BR>
          > I need to produce the following xml.<BR>
          > <BR>
          > <mydatatype
          > xmlns:ns2="urn:aa:bb:mydata1"<BR>
          > xsi:type="ns2:mydata1"><BR>
          > <Name xsi:type="xsd:string"
          > xsi:null="true"/><BR>
          > <Address<BR>
          > xmlns:ns5="<a
          >
          href="http://schemas.xmlsoap.org/soap/encoding/">http://schemas.xmlsoa
          p.org/soap/encoding/</a>"<BR>
          > xsi:type="ns5:Array"
          > xmlns:ns6="urn:aa:bb:myaddress"<BR>
          > ns5:arrayType="ns6:Address[]"
          > xsi:null="true"/><BR>
          > </mydatatype><BR>
          > <BR>
          > Since I will have my own data type I thought I
          > should<BR>
          > add typelookup for these data types.<BR>
          > <BR>
          > my @parameters = (<BR>
          >      
          > SOAP::Data->name("Name" =>
          > "Me"),<BR>
          >        <BR>
          > SOAP::Data->uri('urn:aa:bb:mydata1')->type(mydata1
          > =><BR>
          > [<BR>
          >      
          >      
          > SOAP::Data->name("Address")->
          > type(Address => [<BR>
          >
                     &nbs
          p;   
          > SOAP::Data->name("MyRoad")<BR>
          >         ])<BR>
          > ])<BR>
          > }<BR>
          > <BR>
          > my $client = SOAP::Lite<BR>
          >
                     &nbs
          p;   
          > ->uri("urn:aa:bb")<BR>
          >
                     &nbs
          p;   
          > ->proxy("<a
          >
          href="http://.................">http://.................</a>");<B
          R>
          >            
          > <BR>
          >      
          > $client->typelookup->{mydata1} =<BR>
          >         
          >      
          >       [11, sub { $_[0] =~
          > Address }, 'as_mydata1'];   <BR>
          >
                     &nbs
          p;
          > <BR>
          >       $response =
          > $client->GetMydata(@parameters);<BR>
          > <BR>
          > sub SOAP::Serializer::as_mydata1 {<BR>
          >          
          >       my $self = shift;<BR>
          >          
          >       my($value, $name,
          > $type, $attr) = @_;<BR>
          >          
          >       return [$name,
          > {'xsi:type' => 'xsd:mydata1',<BR>
          > %$attr}, $value];<BR>
          >         }<BR>
          > This generates the following xml for mydata1<BR>
          > <namesp2:c-gensym4
          > xmlns:namesp2="urn:aa:bb:mydata1<BR>
          > SOAP-ENC:arrayType="xsd:string[1]"<BR>
          > xsi:type="namesp3:mydata1"><BR>
          > <BR>
          > I can't get the SOAP server to accept this format
          > with<BR>
          > the arrayType="xsd:string[1]" in the
          > xml.<BR>
          > I also need to add the code to generate the
          > Address<BR>
          > array within the mydata1 datatype.<BR>
          > <BR>
          > Best Regards<BR>
          > David<BR>
          > <BR>
          > <BR>
          > _____________________________________________________<BR>
          > Gratis e-mail resten av livet på www.yahoo.se/mail<BR>
          > Busenkelt!<BR>
          > </tt>
          >
          > <br>
          >
          > <!-- |**|begin egp html banner|**| -->
          >
          > <table border=0 cellspacing=0 cellpadding=2>
          > <tr bgcolor=#FFFFCC>
          > <td align=center><font size="-1"
          > color=#003399><b>Yahoo! Groups Sponsor</b></font></td>
          > </tr>
          > <tr bgcolor=#FFFFFF>
          > <td align=center width=470><table border=0
          > cellpadding=0 cellspacing=0> <tr> <td
          > align=center><font face=arial
          > size=-2>ADVERTISEMENT</font><br><a
          >
          href="http://rd.yahoo.com/M=237459.2482214.3917349.2146399/D=egroupweb
          /S=1705701014:HM/A=1267611/R=0/*http://ad.doubleclick.net/jump/N2524.Y
          ahoo/B1071650;sz=300x250;ord=1035266908539055?"
          > target =_blank><img
          >
          src="http://ad.doubleclick.net/ad/N2524.Yahoo/B1071650;sz=300x250;ord=
          1035266908539055?"
          > alt="" width="300" height="250"
          > border="0"></a></td></tr></table></td>
          > </tr>
          > <tr><td><img alt="" width=1 height=1
          > src="http://us.adserver.yahoo.com/l?
          M=237459.2482214.3917349.2146399/D=egroupmail/S=:HM/A=1267611/rand=250
          731911"></td></tr>
          > </table>
          >
          > <!-- |**|end egp html banner|**| -->
          >
          >
          > <br>
          > <tt>
          > To unsubscribe from this group, send an email to:<BR>
          > soaplite-unsubscribe@y...<BR>
          > <BR>
          > </tt>
          > <br>
          >
          > <br>
          > <tt>Your use of Yahoo! Groups is subject to the <a
          > href="http://docs.yahoo.com/info/terms/">Yahoo! Terms
          > of Service</a>.</tt>
          > </br>
          >
          > </body></html>
          >
          >
          > _____________________________________________________
          > Gratis e-mail resten av livet på www.yahoo.se/mail
          > Busenkelt!
        Your message has been successfully submitted and would be delivered to recipients shortly.