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

Problem using reference to object

Expand Messages
  • Trond Straume
    Hi! I have searched through the messagehistory in this mailgroup, but I ve not found the answer to my problem. This is what I need to create using SOAP::Lite:
    Message 1 of 6 , Oct 22, 2002
    • 0 Attachment
      Hi!
       
      I have searched through the messagehistory in this mailgroup, but I've not found the answer to my problem.
       
      This is what I need to create using SOAP::Lite:
       
      <?xml version="1.0" encoding="utf-8" ?>
      <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
       <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
        <q1:method xmlns:q1="urn:ourService">
         <myref href="#id1" />
        </q1:method>
        <q2:context id="id1" xsi:type="q2:context" xmlns:q2="http://myserver/my.xsd">
         <sess xsi:type="xsd:string">E45925</sess>
         <user xsi:type="xsd:string">user1</user>
         <appl xsi:type="xsd:string">23FF</appl>
         <lang xsi:type="xsd:int">4</lang>
        </q2:context>
       </soap:Body>
      </soap:Envelope>
      Everything is fine until I try to create a reference (href="#id1") in the soap:Body to another object ("context").
       
      My questions are therefore:
       
      - How do I make a reference?
      - Is there any elegant way to refer to an xsd-file (as in http://myserver/my.xsd)?
       
       
      Regard
      Trond Straume
    • trond_straume
      Hi! I ve managed to work around the problem using this code, and not using reference to any object, but a new problem has occured. This is my code: $result =
      Message 2 of 6 , Oct 24, 2002
      • 0 Attachment
        Hi!

        I've managed to work around the problem using this code, and not
        using reference to any object, but a new problem has occured. This is
        my code:

        $result = $soap->call(
        SOAP::Data
        -> uri ("urn:ourService")
        -> name('q1:method') => (
        SOAP::Data
        -> type('q2:context')
        -> uri('http://myserver/my.xsd')
        -> name('q2:context')
        -> value ([
        SOAP::Data
        -> name('user')
        -> value('user1')
        -> type('string'),
        SOAP::Data
        -> name('lang')
        -> value('4')
        -> type('int'),
        SOAP::Data
        -> name('appl')
        -> value('23FF')
        -> type('string'),
        SOAP::Data
        -> name('sess')
        -> value('E45925')
        -> type('string'),
        ]),
        ),
        );

        This XML-code is generated:

        <?xml version="1.0" encoding="UTF-8"?>
        <soap:Envelope
        soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
        <soap:Body>
        <q1:method xmlns:q1="urn:ourService">
        <q2:context soapenc:arrayType="xsd:anyType[4]"
        xsi:type="q2:context" xmlns:q2="http://myserver/my.xsd">
        <user xsi:type="xsd:string">user1</user>
        <lang xsi:type="xsd:int">4</lang>
        <appl xsi:type="xsd:string">23FF</appl>
        <sess xsi:type="xsd:string">E45925</sessionID>
        </q2:context>
        </q1:method>
        </soap:Body>
        </soap:Envelope>

        This works, but is in my opinion rather nasty, since SOAP::Lite
        translates the <q2:context..... into: soapenc:arrayType="xsd:anyType
        [4]"

        What can I do to make SOAP::Lite serialize
        this as xsi:type="q2:context"?

        PS! Thanks for making SOAP::Lite...

        Regards
        Trond

        --- In soaplite@y..., "Trond Straume" <trond.straume@o...> wrote:
        > Hi!
        >
        > I have searched through the messagehistory in this mailgroup, but
        I've not found the answer to my problem.
        >
        > This is what I need to create using SOAP::Lite:
        >
        > <?xml version="1.0" encoding="utf-8" ?>
        > <soap:Envelope
        xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        > <soap:Body
        soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
        > <q1:method xmlns:q1="urn:ourService">
        > <myref href="#id1" />
        > </q1:method>
        > <q2:context id="id1" xsi:type="q2:context"
        xmlns:q2="http://myserver/my.xsd">
        > <sess xsi:type="xsd:string">E45925</sess>
        > <user xsi:type="xsd:string">user1</user>
        > <appl xsi:type="xsd:string">23FF</appl>
        > <lang xsi:type="xsd:int">4</lang>
        > </q2:context>
        > </soap:Body>
        > </soap:Envelope>
        >
        > Everything is fine until I try to create a reference (href="#id1")
        in the soap:Body to another object ("context").
        >
        > My questions are therefore:
        >
        > - How do I make a reference?
        > - Is there any elegant way to refer to an xsd-file (as in
        http://myserver/my.xsd)?
        >
        >
        > Regard
        > Trond Straume
      • Paul Kulchenko
        Hi Trond, Hm, it doesn t need to be THAT complex ;); S::L should make it simple. Something like this may work. # make an object $data = bless { user =
        Message 3 of 6 , Oct 24, 2002
        • 0 Attachment
          Hi Trond,

          Hm, it doesn't need to be THAT complex ;); S::L should make it
          simple. Something like this may work.

          # make an object
          $data = bless {
          user => 'user1',
          lang => 4,
          appl => '23FF',
          sess => 'E45925'
          } => 'context';

          $som = SOAP::Lite
          ->uri("urn:ourService")
          # map type to namespace
          ->maptype({context => "http://myserver/my.xsd"})
          ->method($data)
          ->result;

          In general, if something is TOO complex, it means that either you do
          it the wrong way, or I didn't give it enough thought.

          Best wishes, Paul.

          P.S. It is still possible to do it the way you want; it just not the
          easiest way.

          --- trond_straume <trond.straume@...> wrote:
          > Hi!
          >
          > I've managed to work around the problem using this code, and not
          > using reference to any object, but a new problem has occured. This
          > is
          > my code:
          >
          > $result = $soap->call(
          > SOAP::Data
          > -> uri ("urn:ourService")
          > -> name('q1:method') => (
          > SOAP::Data
          > -> type('q2:context')
          > -> uri('http://myserver/my.xsd')
          > -> name('q2:context')
          > -> value ([
          > SOAP::Data
          > -> name('user')
          > -> value('user1')
          > -> type('string'),
          > SOAP::Data
          > -> name('lang')
          > -> value('4')
          > -> type('int'),
          > SOAP::Data
          > -> name('appl')
          > -> value('23FF')
          > -> type('string'),
          > SOAP::Data
          > -> name('sess')
          > -> value('E45925')
          > -> type('string'),
          > ]),
          > ),
          > );
          >
          > This XML-code is generated:
          >
          > <?xml version="1.0" encoding="UTF-8"?>
          > <soap:Envelope
          > soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
          > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
          > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
          > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
          > <soap:Body>
          > <q1:method xmlns:q1="urn:ourService">
          > <q2:context soapenc:arrayType="xsd:anyType[4]"
          > xsi:type="q2:context" xmlns:q2="http://myserver/my.xsd">
          > <user xsi:type="xsd:string">user1</user>
          > <lang xsi:type="xsd:int">4</lang>
          > <appl xsi:type="xsd:string">23FF</appl>
          > <sess xsi:type="xsd:string">E45925</sessionID>
          > </q2:context>
          > </q1:method>
          > </soap:Body>
          > </soap:Envelope>
          >
          > This works, but is in my opinion rather nasty, since SOAP::Lite
          > translates the <q2:context..... into:
          > soapenc:arrayType="xsd:anyType
          > [4]"
          >
          > What can I do to make SOAP::Lite serialize
          > this as xsi:type="q2:context"?
          >
          > PS! Thanks for making SOAP::Lite...
          >
          > Regards
          > Trond
          >
          > --- In soaplite@y..., "Trond Straume" <trond.straume@o...> wrote:
          > > Hi!
          > >
          > > I have searched through the messagehistory in this mailgroup, but
          >
          > I've not found the answer to my problem.
          > >
          > > This is what I need to create using SOAP::Lite:
          > >
          > > <?xml version="1.0" encoding="utf-8" ?>
          > > <soap:Envelope
          > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
          > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
          > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          > xmlns:xsd="http://www.w3.org/2001/XMLSchema">
          > > <soap:Body
          > soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
          > > <q1:method xmlns:q1="urn:ourService">
          > > <myref href="#id1" />
          > > </q1:method>
          > > <q2:context id="id1" xsi:type="q2:context"
          > xmlns:q2="http://myserver/my.xsd">
          > > <sess xsi:type="xsd:string">E45925</sess>
          > > <user xsi:type="xsd:string">user1</user>
          > > <appl xsi:type="xsd:string">23FF</appl>
          > > <lang xsi:type="xsd:int">4</lang>
          > > </q2:context>
          > > </soap:Body>
          > > </soap:Envelope>
          > >
          > > Everything is fine until I try to create a reference
          > (href="#id1")
          > in the soap:Body to another object ("context").
          > >
          > > My questions are therefore:
          > >
          > > - How do I make a reference?
          > > - Is there any elegant way to refer to an xsd-file (as in
          > http://myserver/my.xsd)?
          > >
          > >
          > > Regard
          > > Trond Straume
          >
          >
          > ------------------------ 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!?
          Y! Web Hosting - Let the expert host your web site
          http://webhosting.yahoo.com/
        • trond_straume
          Hi! Thanks for your answer!!! This XML-code is generated:
          Message 4 of 6 , Oct 28, 2002
          • 0 Attachment
            Hi!

            Thanks for your answer!!!

            This XML-code is generated:

            <?xml version="1.0" encoding="UTF-8"?>
            <SOAP-ENV:Envelope xmlns:namesp2="http://myserver/my.xsd" SOAP-
            ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
            xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-
            ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-
            ENV="http://schemas.xmlsoap.org/soap/envelope/"
            xmlns:xsd="http://www.w3.org/1999/XMLSchema"
            >
            <SOAP-ENV:Body
            >
            <namesp1:method xmlns:namesp1="urn:ourService"
            >
            <context xsi:type="namesp2:context"
            >
            <sess xsi:type="xsd:string"
            >E45925</sess>
            <lang xsi:type="xsd:int"
            >4</lang>
            <appl xsi:type="xsd:string"
            >23FF</appl>
            <user xsi:type="xsd:string"
            >user1</user></context></namesp1:method></SOAP-
            ENV:Body></SOAP-ENV:Envelope>

            This works, but I believe I need more powerful control ower the
            objects than a blessed hash can provide. The reason is that I need to
            make "lang => 4" a string, and not an integer, since SOAP::Lite
            automatically converts quotet strings containing numbers to integer.

            Another reason is that I want to add prefix to "context", not just
            beeing "context", but q2:context. And for the namespace: not
            namesp1:context.

            Any suggestions?

            PS! Thanks for making SOAP::Lite

            Regards
            Trond Straume

            --- In soaplite@y..., Paul Kulchenko <paulclinger@y...> wrote:
            > Hi Trond,
            >
            > Hm, it doesn't need to be THAT complex ;); S::L should make it
            > simple. Something like this may work.
            >
            > # make an object
            > $data = bless {
            > user => 'user1',
            > lang => 4,
            > appl => '23FF',
            > sess => 'E45925'
            > } => 'context';
            >
            > $som = SOAP::Lite
            > ->uri("urn:ourService")
            > # map type to namespace
            > ->maptype({context => "http://myserver/my.xsd"})
            > ->method($data)
            > ->result;
            >
            > In general, if something is TOO complex, it means that either you do
            > it the wrong way, or I didn't give it enough thought.
            >
            > Best wishes, Paul.
            >
            > P.S. It is still possible to do it the way you want; it just not the
            > easiest way.
            >
            > --- trond_straume <trond.straume@o...> wrote:
            > > Hi!
            > >
            > > I've managed to work around the problem using this code, and not
            > > using reference to any object, but a new problem has occured. This
            > > is
            > > my code:
            > >
            > > $result = $soap->call(
            > > SOAP::Data
            > > -> uri ("urn:ourService")
            > > -> name('q1:method') => (
            > > SOAP::Data
            > > -> type('q2:context')
            > > -> uri('http://myserver/my.xsd')
            > > -> name('q2:context')
            > > -> value ([
            > > SOAP::Data
            > > -> name('user')
            > > -> value('user1')
            > > -> type('string'),
            > > SOAP::Data
            > > -> name('lang')
            > > -> value('4')
            > > -> type('int'),
            > > SOAP::Data
            > > -> name('appl')
            > > -> value('23FF')
            > > -> type('string'),
            > > SOAP::Data
            > > -> name('sess')
            > > -> value('E45925')
            > > -> type('string'),
            > > ]),
            > > ),
            > > );
            > >
            > > This XML-code is generated:
            > >
            > > <?xml version="1.0" encoding="UTF-8"?>
            > > <soap:Envelope
            > > soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
            > > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
            > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            > > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            > > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
            > > <soap:Body>
            > > <q1:method xmlns:q1="urn:ourService">
            > > <q2:context soapenc:arrayType="xsd:anyType[4]"
            > > xsi:type="q2:context" xmlns:q2="http://myserver/my.xsd">
            > > <user xsi:type="xsd:string">user1</user>
            > > <lang xsi:type="xsd:int">4</lang>
            > > <appl xsi:type="xsd:string">23FF</appl>
            > > <sess xsi:type="xsd:string">E45925</sessionID>
            > > </q2:context>
            > > </q1:method>
            > > </soap:Body>
            > > </soap:Envelope>
            > >
            > > This works, but is in my opinion rather nasty, since SOAP::Lite
            > > translates the <q2:context..... into:
            > > soapenc:arrayType="xsd:anyType
            > > [4]"
            > >
            > > What can I do to make SOAP::Lite serialize
            > > this as xsi:type="q2:context"?
            > >
            > > PS! Thanks for making SOAP::Lite...
            > >
            > > Regards
            > > Trond
            > >
            > > --- In soaplite@y..., "Trond Straume" <trond.straume@o...> wrote:
            > > > Hi!
            > > >
            > > > I have searched through the messagehistory in this mailgroup,
            but
            > >
            > > I've not found the answer to my problem.
            > > >
            > > > This is what I need to create using SOAP::Lite:
            > > >
            > > > <?xml version="1.0" encoding="utf-8" ?>
            > > > <soap:Envelope
            > > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
            > > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
            > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            > > xmlns:xsd="http://www.w3.org/2001/XMLSchema">
            > > > <soap:Body
            > > soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
            > > > <q1:method xmlns:q1="urn:ourService">
            > > > <myref href="#id1" />
            > > > </q1:method>
            > > > <q2:context id="id1" xsi:type="q2:context"
            > > xmlns:q2="http://myserver/my.xsd">
            > > > <sess xsi:type="xsd:string">E45925</sess>
            > > > <user xsi:type="xsd:string">user1</user>
            > > > <appl xsi:type="xsd:string">23FF</appl>
            > > > <lang xsi:type="xsd:int">4</lang>
            > > > </q2:context>
            > > > </soap:Body>
            > > > </soap:Envelope>
            > > >
            > > > Everything is fine until I try to create a reference
            > > (href="#id1")
            > > in the soap:Body to another object ("context").
            > > >
            > > > My questions are therefore:
            > > >
            > > > - How do I make a reference?
            > > > - Is there any elegant way to refer to an xsd-file (as in
            > > http://myserver/my.xsd)?
            > > >
            > > >
            > > > Regard
            > > > Trond Straume
            > >
            > >
            > > ------------------------ 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!?
            > Y! Web Hosting - Let the expert host your web site
            > http://webhosting.yahoo.com/
          • Paul Kulchenko
            Hi Trond, ... You can do it the usual way: ... lang = SOAP::Data- type(string = 4); ... - method(SOAP::Data- uri( http://myserver/my.xsd = $data)) ...
            Message 5 of 6 , Oct 28, 2002
            • 0 Attachment
              Hi Trond,

              > objects than a blessed hash can provide. The reason is that I need
              > to
              > make "lang => 4" a string, and not an integer, since SOAP::Lite
              > automatically converts quotet strings containing numbers to
              > integer.

              You can do it the usual way:

              ...
              lang => SOAP::Data->type(string => 4);
              ...

              > Another reason is that I want to add prefix to "context", not just

              ->method(SOAP::Data->uri("http://myserver/my.xsd" => $data))

              > beeing "context", but q2:context. And for the namespace: not
              > namesp1:context.

              Prefix shouldn't really matter, but if you want to do it 'q2' here,
              just add ->prefix('q2') after ->uri().

              Best wishes, Paul.

              --- trond_straume <trond.straume@...> wrote:
              > Hi!
              >
              > Thanks for your answer!!!
              >
              > This XML-code is generated:
              >
              > <?xml version="1.0" encoding="UTF-8"?>
              > <SOAP-ENV:Envelope xmlns:namesp2="http://myserver/my.xsd" SOAP-
              > ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
              > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-
              > ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-
              > ENV="http://schemas.xmlsoap.org/soap/envelope/"
              > xmlns:xsd="http://www.w3.org/1999/XMLSchema"
              > >
              > <SOAP-ENV:Body
              > >
              > <namesp1:method xmlns:namesp1="urn:ourService"
              > >
              > <context xsi:type="namesp2:context"
              > >
              > <sess xsi:type="xsd:string"
              > >E45925</sess>
              > <lang xsi:type="xsd:int"
              > >4</lang>
              > <appl xsi:type="xsd:string"
              > >23FF</appl>
              > <user xsi:type="xsd:string"
              > >user1</user></context></namesp1:method></SOAP-
              > ENV:Body></SOAP-ENV:Envelope>
              >
              > This works, but I believe I need more powerful control ower the
              > objects than a blessed hash can provide. The reason is that I need
              > to
              > make "lang => 4" a string, and not an integer, since SOAP::Lite
              > automatically converts quotet strings containing numbers to
              > integer.
              >
              > Another reason is that I want to add prefix to "context", not just
              > beeing "context", but q2:context. And for the namespace: not
              > namesp1:context.
              >
              > Any suggestions?
              >
              > PS! Thanks for making SOAP::Lite
              >
              > Regards
              > Trond Straume
              >
              > --- In soaplite@y..., Paul Kulchenko <paulclinger@y...> wrote:
              > > Hi Trond,
              > >
              > > Hm, it doesn't need to be THAT complex ;); S::L should make it
              > > simple. Something like this may work.
              > >
              > > # make an object
              > > $data = bless {
              > > user => 'user1',
              > > lang => 4,
              > > appl => '23FF',
              > > sess => 'E45925'
              > > } => 'context';
              > >
              > > $som = SOAP::Lite
              > > ->uri("urn:ourService")
              > > # map type to namespace
              > > ->maptype({context => "http://myserver/my.xsd"})
              > > ->method($data)
              > > ->result;
              > >
              > > In general, if something is TOO complex, it means that either you
              > do
              > > it the wrong way, or I didn't give it enough thought.
              > >
              > > Best wishes, Paul.
              > >
              > > P.S. It is still possible to do it the way you want; it just not
              > the
              > > easiest way.
              > >
              > > --- trond_straume <trond.straume@o...> wrote:
              > > > Hi!
              > > >
              > > > I've managed to work around the problem using this code, and
              > not
              > > > using reference to any object, but a new problem has occured.
              > This
              > > > is
              > > > my code:
              > > >
              > > > $result = $soap->call(
              > > > SOAP::Data
              > > > -> uri ("urn:ourService")
              > > > -> name('q1:method') => (
              > > > SOAP::Data
              > > > -> type('q2:context')
              > > > -> uri('http://myserver/my.xsd')
              > > > -> name('q2:context')
              > > > -> value ([
              > > > SOAP::Data
              > > > -> name('user')
              > > > -> value('user1')
              > > > -> type('string'),
              > > > SOAP::Data
              > > > -> name('lang')
              > > > -> value('4')
              > > > -> type('int'),
              > > > SOAP::Data
              > > > -> name('appl')
              > > > -> value('23FF')
              > > > -> type('string'),
              > > > SOAP::Data
              > > > -> name('sess')
              > > > -> value('E45925')
              > > > -> type('string'),
              > > > ]),
              > > > ),
              > > > );
              > > >
              > > > This XML-code is generated:
              > > >
              > > > <?xml version="1.0" encoding="UTF-8"?>
              > > > <soap:Envelope
              > > > soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
              > > > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
              > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              > > > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
              > > > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
              > > > <soap:Body>
              > > > <q1:method xmlns:q1="urn:ourService">
              > > > <q2:context soapenc:arrayType="xsd:anyType[4]"
              > > > xsi:type="q2:context" xmlns:q2="http://myserver/my.xsd">
              > > > <user xsi:type="xsd:string">user1</user>
              > > > <lang xsi:type="xsd:int">4</lang>
              > > > <appl xsi:type="xsd:string">23FF</appl>
              > > > <sess xsi:type="xsd:string">E45925</sessionID>
              > > > </q2:context>
              > > > </q1:method>
              > > > </soap:Body>
              > > > </soap:Envelope>
              > > >
              > > > This works, but is in my opinion rather nasty, since SOAP::Lite
              >
              > > > translates the <q2:context..... into:
              > > > soapenc:arrayType="xsd:anyType
              > > > [4]"
              > > >
              > > > What can I do to make SOAP::Lite serialize
              > > > this as xsi:type="q2:context"?
              > > >
              > > > PS! Thanks for making SOAP::Lite...
              > > >
              > > > Regards
              > > > Trond
              > > >
              > > > --- In soaplite@y..., "Trond Straume" <trond.straume@o...>
              > wrote:
              > > > > Hi!
              > > > >
              > > > > I have searched through the messagehistory in this mailgroup,
              >
              > but
              > > >
              > > > I've not found the answer to my problem.
              > > > >
              > > > > This is what I need to create using SOAP::Lite:
              > > > >
              > > > > <?xml version="1.0" encoding="utf-8" ?>
              > > > > <soap:Envelope
              > > > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
              > > > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
              > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              > > > xmlns:xsd="http://www.w3.org/2001/XMLSchema">
              > > > > <soap:Body
              > > > soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
              > > > > <q1:method xmlns:q1="urn:ourService">
              > > > > <myref href="#id1" />
              > > > > </q1:method>
              > > > > <q2:context id="id1" xsi:type="q2:context"
              > > > xmlns:q2="http://myserver/my.xsd">
              > > > > <sess xsi:type="xsd:string">E45925</sess>
              > > > > <user xsi:type="xsd:string">user1</user>
              > > > > <appl xsi:type="xsd:string">23FF</appl>
              > > > > <lang xsi:type="xsd:int">4</lang>
              > > > > </q2:context>
              > > > > </soap:Body>
              > > > > </soap:Envelope>
              > > > >
              > > > > Everything is fine until I try to create a reference
              > > > (href="#id1")
              > > > in the soap:Body to another object ("context").
              > > > >
              > > > > My questions are therefore:
              > > > >
              > > > > - How do I make a reference?
              > > > > - Is there any elegant way to refer to an xsd-file (as in
              > > > http://myserver/my.xsd)?
              > > > >
              > > > >
              > > > > Regard
              > > > > Trond Straume
              > > >
              >
              === message truncated ===


              __________________________________________________
              Do you Yahoo!?
              Y! Web Hosting - Let the expert host your web site
              http://webhosting.yahoo.com/
            • trond_straume
              Brilliant! Thanks! Trond ... just ... just ... you ... soap:encodingStyle= http://schemas.xmlsoap.org/soap/encoding/ ... SOAP::Lite ... mailgroup, ...
              Message 6 of 6 , Oct 31, 2002
              • 0 Attachment
                Brilliant!

                Thanks!

                Trond

                --- In soaplite@y..., Paul Kulchenko <paulclinger@y...> wrote:
                > Hi Trond,
                >
                > > objects than a blessed hash can provide. The reason is that I need
                > > to
                > > make "lang => 4" a string, and not an integer, since SOAP::Lite
                > > automatically converts quotet strings containing numbers to
                > > integer.
                >
                > You can do it the usual way:
                >
                > ...
                > lang => SOAP::Data->type(string => 4);
                > ...
                >
                > > Another reason is that I want to add prefix to "context", not
                just
                >
                > ->method(SOAP::Data->uri("http://myserver/my.xsd" => $data))
                >
                > > beeing "context", but q2:context. And for the namespace: not
                > > namesp1:context.
                >
                > Prefix shouldn't really matter, but if you want to do it 'q2' here,
                > just add ->prefix('q2') after ->uri().
                >
                > Best wishes, Paul.
                >
                > --- trond_straume <trond.straume@o...> wrote:
                > > Hi!
                > >
                > > Thanks for your answer!!!
                > >
                > > This XML-code is generated:
                > >
                > > <?xml version="1.0" encoding="UTF-8"?>
                > > <SOAP-ENV:Envelope xmlns:namesp2="http://myserver/my.xsd" SOAP-
                > > ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
                > > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-
                > > ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-
                > > ENV="http://schemas.xmlsoap.org/soap/envelope/"
                > > xmlns:xsd="http://www.w3.org/1999/XMLSchema"
                > > >
                > > <SOAP-ENV:Body
                > > >
                > > <namesp1:method xmlns:namesp1="urn:ourService"
                > > >
                > > <context xsi:type="namesp2:context"
                > > >
                > > <sess xsi:type="xsd:string"
                > > >E45925</sess>
                > > <lang xsi:type="xsd:int"
                > > >4</lang>
                > > <appl xsi:type="xsd:string"
                > > >23FF</appl>
                > > <user xsi:type="xsd:string"
                > > >user1</user></context></namesp1:method></SOAP-
                > > ENV:Body></SOAP-ENV:Envelope>
                > >
                > > This works, but I believe I need more powerful control ower the
                > > objects than a blessed hash can provide. The reason is that I need
                > > to
                > > make "lang => 4" a string, and not an integer, since SOAP::Lite
                > > automatically converts quotet strings containing numbers to
                > > integer.
                > >
                > > Another reason is that I want to add prefix to "context", not
                just
                > > beeing "context", but q2:context. And for the namespace: not
                > > namesp1:context.
                > >
                > > Any suggestions?
                > >
                > > PS! Thanks for making SOAP::Lite
                > >
                > > Regards
                > > Trond Straume
                > >
                > > --- In soaplite@y..., Paul Kulchenko <paulclinger@y...> wrote:
                > > > Hi Trond,
                > > >
                > > > Hm, it doesn't need to be THAT complex ;); S::L should make it
                > > > simple. Something like this may work.
                > > >
                > > > # make an object
                > > > $data = bless {
                > > > user => 'user1',
                > > > lang => 4,
                > > > appl => '23FF',
                > > > sess => 'E45925'
                > > > } => 'context';
                > > >
                > > > $som = SOAP::Lite
                > > > ->uri("urn:ourService")
                > > > # map type to namespace
                > > > ->maptype({context => "http://myserver/my.xsd"})
                > > > ->method($data)
                > > > ->result;
                > > >
                > > > In general, if something is TOO complex, it means that either
                you
                > > do
                > > > it the wrong way, or I didn't give it enough thought.
                > > >
                > > > Best wishes, Paul.
                > > >
                > > > P.S. It is still possible to do it the way you want; it just not
                > > the
                > > > easiest way.
                > > >
                > > > --- trond_straume <trond.straume@o...> wrote:
                > > > > Hi!
                > > > >
                > > > > I've managed to work around the problem using this code, and
                > > not
                > > > > using reference to any object, but a new problem has occured.
                > > This
                > > > > is
                > > > > my code:
                > > > >
                > > > > $result = $soap->call(
                > > > > SOAP::Data
                > > > > -> uri ("urn:ourService")
                > > > > -> name('q1:method') => (
                > > > > SOAP::Data
                > > > > -> type('q2:context')
                > > > > -> uri('http://myserver/my.xsd')
                > > > > -> name('q2:context')
                > > > > -> value ([
                > > > > SOAP::Data
                > > > > -> name('user')
                > > > > -> value('user1')
                > > > > -> type('string'),
                > > > > SOAP::Data
                > > > > -> name('lang')
                > > > > -> value('4')
                > > > > -> type('int'),
                > > > > SOAP::Data
                > > > > -> name('appl')
                > > > > -> value('23FF')
                > > > > -> type('string'),
                > > > > SOAP::Data
                > > > > -> name('sess')
                > > > > -> value('E45925')
                > > > > -> type('string'),
                > > > > ]),
                > > > > ),
                > > > > );
                > > > >
                > > > > This XML-code is generated:
                > > > >
                > > > > <?xml version="1.0" encoding="UTF-8"?>
                > > > > <soap:Envelope
                > > > >
                soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
                > > > > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
                > > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                > > > > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                > > > > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
                > > > > <soap:Body>
                > > > > <q1:method xmlns:q1="urn:ourService">
                > > > > <q2:context soapenc:arrayType="xsd:anyType[4]"
                > > > > xsi:type="q2:context" xmlns:q2="http://myserver/my.xsd">
                > > > > <user xsi:type="xsd:string">user1</user>
                > > > > <lang xsi:type="xsd:int">4</lang>
                > > > > <appl xsi:type="xsd:string">23FF</appl>
                > > > > <sess xsi:type="xsd:string">E45925</sessionID>
                > > > > </q2:context>
                > > > > </q1:method>
                > > > > </soap:Body>
                > > > > </soap:Envelope>
                > > > >
                > > > > This works, but is in my opinion rather nasty, since
                SOAP::Lite
                > >
                > > > > translates the <q2:context..... into:
                > > > > soapenc:arrayType="xsd:anyType
                > > > > [4]"
                > > > >
                > > > > What can I do to make SOAP::Lite serialize
                > > > > this as xsi:type="q2:context"?
                > > > >
                > > > > PS! Thanks for making SOAP::Lite...
                > > > >
                > > > > Regards
                > > > > Trond
                > > > >
                > > > > --- In soaplite@y..., "Trond Straume" <trond.straume@o...>
                > > wrote:
                > > > > > Hi!
                > > > > >
                > > > > > I have searched through the messagehistory in this
                mailgroup,
                > >
                > > but
                > > > >
                > > > > I've not found the answer to my problem.
                > > > > >
                > > > > > This is what I need to create using SOAP::Lite:
                > > > > >
                > > > > > <?xml version="1.0" encoding="utf-8" ?>
                > > > > > <soap:Envelope
                > > > > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
                > > > > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
                > > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                > > > > xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                > > > > > <soap:Body
                > > > >
                soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
                > > > > > <q1:method xmlns:q1="urn:ourService">
                > > > > > <myref href="#id1" />
                > > > > > </q1:method>
                > > > > > <q2:context id="id1" xsi:type="q2:context"
                > > > > xmlns:q2="http://myserver/my.xsd">
                > > > > > <sess xsi:type="xsd:string">E45925</sess>
                > > > > > <user xsi:type="xsd:string">user1</user>
                > > > > > <appl xsi:type="xsd:string">23FF</appl>
                > > > > > <lang xsi:type="xsd:int">4</lang>
                > > > > > </q2:context>
                > > > > > </soap:Body>
                > > > > > </soap:Envelope>
                > > > > >
                > > > > > Everything is fine until I try to create a reference
                > > > > (href="#id1")
                > > > > in the soap:Body to another object ("context").
                > > > > >
                > > > > > My questions are therefore:
                > > > > >
                > > > > > - How do I make a reference?
                > > > > > - Is there any elegant way to refer to an xsd-file (as in
                > > > > http://myserver/my.xsd)?
                > > > > >
                > > > > >
                > > > > > Regard
                > > > > > Trond Straume
                > > > >
                > >
                > === message truncated ===
                >
                >
                > __________________________________________________
                > Do you Yahoo!?
                > Y! Web Hosting - Let the expert host your web site
                > http://webhosting.yahoo.com/
              Your message has been successfully submitted and would be delivered to recipients shortly.