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

Passing Hashtables from Perl (again)

Expand Messages
  • calinm
    Hello, I read the previous posts from people trying to pass Hashtable around. I wrote a method that takes nothing and returns a hashtable. It serialises it
    Message 1 of 4 , Aug 15, 2002
    View Source
    • 0 Attachment
      Hello,

      I read the previous posts from people trying to pass Hashtable
      around. I wrote a method that takes nothing and returns a hashtable.
      It serialises it like below, as an array of MapEntries. What would I
      have to pass something like this from SOAP::Lite? I assume that java
      expects it serialized the way it's sending it away..

      <result xsi:type="ns1:hashtable" enc:arrayType="ns1:mapEntr[3]">
      <item xsi:type="ns1:mapEntry"><key
      xsi:type="xsd:string">two</key><value
      xsi:type="xsd:string">two</value></item><item xsi:type="
      ns1:mapEntry"><key xsi:type="xsd:string">one</key><value
      xsi:type="xsd:string">one</value></item><item
      xsi:type="ns1:mapEntry"><key xsi:type="xsd:string">three</key
      ><value
      xsi:type="xsd:string">boo</value></item></result></ans1:getHashtableRe
      sponse></env:Body></env:Envelope>

      I am using the Sun Java WSDP.

      Thanks!

      Calin
    • Duncan Cameron
      ... It s not clear quite what you want to do. Send a SOAP message from SOAP::Lite containing a hash table which Java can handle? The previous posts should
      Message 2 of 4 , Aug 15, 2002
      View Source
      • 0 Attachment
        On 2002-08-15 calinm wrote:
        >Hello,
        >
        >I read the previous posts from people trying to pass Hashtable
        >around. I wrote a method that takes nothing and returns a hashtable.
        >It serialises it like below, as an array of MapEntries. What would I
        >have to pass something like this from SOAP::Lite? I assume that java
        >expects it serialized the way it's sending it away..
        >
        ><result xsi:type="ns1:hashtable" enc:arrayType="ns1:mapEntr[3]">
        ><item xsi:type="ns1:mapEntry"><key
        >xsi:type="xsd:string">two</key><value
        >xsi:type="xsd:string">two</value></item><item xsi:type="
        >ns1:mapEntry"><key xsi:type="xsd:string">one</key><value
        >xsi:type="xsd:string">one</value></item><item
        >xsi:type="ns1:mapEntry"><key xsi:type="xsd:string">three</key
        >><value
        >xsi:type="xsd:string">boo</value></item></result></ans1:getHashtableRe
        >sponse></env:Body></env:Envelope>
        >
        >I am using the Sun Java WSDP.
        >
        It's not clear quite what you want to do. Send a SOAP message from
        SOAP::Lite containing a hash table which Java can handle?

        The previous posts should give you a handle on how to do that,
        see http://groups.yahoo.com/group/soaplite/message/1374 as an example.


        Regards,
        Duncan Cameron
      • calinm
        ... Exactly. This is the code of my java function: public Hashtable echoHashtable(Hashtable ht) { return ht; } I am trying to call it from perl. I tried the
        Message 3 of 4 , Aug 16, 2002
        View Source
        • 0 Attachment
          > >I am using the Sun Java WSDP.
          > >
          > It's not clear quite what you want to do. Send a SOAP message from
          > SOAP::Lite containing a hash table which Java can handle?

          Exactly. This is the code of my java function:
          public Hashtable echoHashtable(Hashtable ht)
          {
          return ht;
          }

          I am trying to call it from perl. I tried the approach you described
          in msg 1374:

          $result = echoHashtable (SOAP::Data->type(map =>
          $hashref)->name('ht'))

          and I get this:

          <?xml version="1.0" encoding="UTF-8"?>
          <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
          xmlns:xsd="http://www.w3.org/2001/XMLSchema"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"
          xmlns:ns0="http://com.test/types/ZoneEditWS"
          xmlns:ns1="http://java.sun.com/jax-rpc-ri/internal"
          env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
          <env:Body><env:Fault><faultcode>env:Server</faultcode>
          <faultstring>Internal Server Error (deserialization error:
          unexpected XML reader state. expected: END but found: START:
          ht)</faultstring>
          </env:Fault></env:Body>
          </env:Envelope>

          I am using the Sun java WSDP. and WSDL on the client side.

          Any help would be most appreciated.

          Thanks,

          Calin

          > The previous posts should give you a handle on how to do that,
          > see http://groups.yahoo.com/group/soaplite/message/1374 as an
          example.
          >
          >
          > Regards,
          > Duncan Cameron
        • Duncan Cameron
          ... Clearly you have some sort of malformed message. I think that you need to look at the SOAP message generated by SOAP::Lite. If you don t have a tracing
          Message 4 of 4 , Aug 16, 2002
          View Source
          • 0 Attachment
            On 2002-08-16 calinm wrote:
            >> >I am using the Sun Java WSDP.
            >> >
            >> It's not clear quite what you want to do. Send a SOAP message from
            >> SOAP::Lite containing a hash table which Java can handle?
            >
            >Exactly. This is the code of my java function:
            >public Hashtable echoHashtable(Hashtable ht)
            >{
            > return ht;
            >}
            >
            >I am trying to call it from perl. I tried the approach you described
            >in msg 1374:
            >
            >$result = echoHashtable (SOAP::Data->type(map =>
            >$hashref)->name('ht'))
            >
            >and I get this:
            >
            ><?xml version="1.0" encoding="UTF-8"?>
            ><env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
            >xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            >xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            >xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"
            >xmlns:ns0="http://com.test/types/ZoneEditWS"
            >xmlns:ns1="http://java.sun.com/jax-rpc-ri/internal"
            >env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
            ><env:Body><env:Fault><faultcode>env:Server</faultcode>
            ><faultstring>Internal Server Error (deserialization error:
            >unexpected XML reader state. expected: END but found: START:
            >ht)</faultstring>
            ></env:Fault></env:Body>
            ></env:Envelope>
            >
            >I am using the Sun java WSDP. and WSDL on the client side.
            >
            Clearly you have some sort of malformed message.
            I think that you need to look at the SOAP message generated by
            SOAP::Lite. If you don't have a tracing proxy then turn on debug
            with SOAP::Lite, something like

            use SOAP::Lite +debug => trace;

            That should show the generated xml and hopefully identify the problem.

            Regards,
            Duncan Cameron
          Your message has been successfully submitted and would be delivered to recipients shortly.