Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#30 WDSL and multiRef problem

closed-duplicate
nobody
None
5
2007-10-03
2003-07-07
adhamh findlay
No

I have written a Java application that provides a SOAP
server. (Its a WebObjects application, but that
shouldn't matter...)

I seem to be having a multiref issue of the type that
has been discussed here before. I've found these
discussions useful, but not able to solve my issue.

I have a server that defines a method/operation that
returns a java Vector. I've written a really simple
SOAP::Lite script that uses wdsl. This script does
return all the objects I want (Dumper shows this), but
I can't access the results that are behind the mutliRef
key.

I have read the information at
http://www.majordojo.com/archives/cat_soaplite.html
come close to a solution but I can still only get one
object back. Here is the script:

#!/usr/bin/perl -w
use SOAP::Lite;
use Data::Dumper;
my $WSDL =
"http://myhost.somedomain.com:4220/cgi-bin/WebObjects/Waldo.woa/ws/PersonService?wsdl";
my $NS =
"http://myhost.somedomain.com:4220/cgi-bin/WebObjects/Waldo.woa/ws/PersonService";
my $HOST =
"http://myhost.somedomain.com:4220/cgi-bin/WebObjects/Waldo.woa/ws/PersonService";

my $search = SOAP::Lite
->readable(1)
->xmlschema('http://www.w3.org/2001/XMLSchema')
->on_action( sub { return'""';})
#See comments below
#->maptype({getPersonByNameRequest => $NS})
->proxy($HOST)
->uri($NS);

my $method = SOAP::Data->name('getPersonByName')
->uri($NS);

my $params = SOAP::Data
->type('getPersonByNameRequest')
#->uri($NS)
#->maptype({getPersonByNameRequest => $NS)
->name('in0' =>
#if I add a \ before the SOAP::Data line below then
I get a
#serialization exception.
#I tried to fix this by using maptype as above, but
I still get the
#exception.
#\SOAP::Data->value(SOAP::Data->name('in0' =>
#"jim")->type('xsd:string')));
SOAP::Data->value(SOAP::Data->name('in0' =>
"jim")->type('xsd:string')));

my $results = $search->call($method => $params);
print Dumper($results->result);

The output of Dumper showed me that the other object(s)
I am interested in are hidden behind a multiRef key,
that I can't seem to get back. I also had tcpflow
running and it to show me that all the data I am
interested in is returned in XML format to may
script/client. I have attached both these outputs
(dumper.txt, tcpflow.txt).

Additionally, I have attached the file soaplitexml.
This file shows the various xml that is being sent to
my soap server.

I have also attached my WSDL that the application is
generating.

I just can't tell what I am still doing wrong. Any
help would be greatly appreciated!

Discussion

  • adhamh findlay
    adhamh findlay
    2003-07-07

    tcpflow of the output

     
    Attachments
  • adhamh findlay
    adhamh findlay
    2003-07-07

    Output from using Dumper

     
    Attachments
  • adhamh findlay
    adhamh findlay
    2003-07-07

    Server side WSDL

     
    Attachments
  • adhamh findlay
    adhamh findlay
    2003-07-07

    xml that soap lite is sending to the server

     
    Attachments
  • Jorge Pacheco
    Jorge Pacheco
    2004-04-06

    Logged In: YES
    user_id=903978

    I don't know if you already fixed your problems, if not this
    could be helpful.

    Whenever I work with SOAP::Lite and I monitor the contents
    going and coming with the tcp-flow I realize that SOAP::Lite
    doesn't create MultiRefs. Defenders say that MultiRefs are
    created UNLESS they're necesary.
    I also work with a Java WebServer and it uses Axis. On Java
    side, MultiRefs are always used. Defenders say that the
    complex value should skip the MultiRef ONLY when necessary.

    So you shouldn't really care for creating a MultiRef, since
    Java/Axis will deserialize the object as it comes. Any how,
    I used a code like yours:

    $name_space = 'XYZ'; #You should know it. Might be useful.
    my $obj = \SOAP::Data
    ->value(SOAP::Data
    ->name('in0' => 'jim')
    ->type('xsd:string')
    );
    my $param = [
    SOAP::Data
    ->type('ns1:getPersonByNameRequest')
    #your TypeObject
    ->name('in0' => $obj)
    #your reference (transparent for you)
    ->attr({'ns1' => $name_space})
    #your TypeObject's namespace
    ];

    my $results = $search->call($method => @{$params});
    #I prefer to pass an array.

    If you see what you send probably you won't see any
    MultiRef, but Java/Axis will interpret your Object properly.

    When you retrieve your result from Java/Axis, you could have
    a problem, since probably you'll get a multiRef and
    SOAP::Lite deserializes BOTH the coming results and
    multiRefs within the body and probable the result runs
    before the non-yet-deserialized MultiRef.

    I made a small patch for, you can find also in this site.
    Hopeit helps.

    A newbee...

     
  • Martin Kutter
    Martin Kutter
    2007-10-03

    Logged In: YES
    user_id=884175
    Originator: NO

    Duplicate of [ 1612405 ] Incorrect deserialization of arrays/vectors

     
  • Martin Kutter
    Martin Kutter
    2007-10-03

    • status: open --> closed-duplicate