You are not logged in.
Announcement
Unanswered posts
|
Pages: 1
Hi,
(I'm a new Talend user, and new on the forum too - but I'm quite old in the art of trying and using new software. I plan to use Talend to test a new SOAP interface for our software. I'm using the Perl flavour on an Ubuntu client, all perl modules are installed).
I've read all related topics on "complex arrays" , and tried everything I could, but I can't manage to get data from this WSDL, http://examples.qcodo.com/examples/communication/example_service.php?wsdl , with GetPeople method & "Smith" as a parameter.
This page http://examples.qcodo.com/examples/communication/soap.php explains how this service works - and it works very well from soapUI.
I just get : "ArrayOfPerson=ARRAY(0x98d05b0)" from my tWebServiceInput_1.
I read [Forum, topic 2016] How to read from a webservice ? about this, but I couldn't find how to apply it. And http://talendforge.org/test/ws/soap_server.php?wsdl seems to have disappeared...
(I succedeed using "AddNumbers" method).
Is there a way to handle this - getting
- Alex Smith
- Wendy Smith
-Jennifer Smith
back ?
Thanks (a lot) in advance,
Fred
Last edited by FredT (2009-08-12 00:01:44)
Offline
Well, I've spent some more hours today trying things and googling... I just can't figure how to achieve this, and I can't imagine it would be not possible.
Obviously Toni-Fatec and plegall succeeded, but some part of their explanations are missing... and the link they provided, http://talendforge.org/test/ws/soap_server.php?wsdl , is dead.
I'll read every clue with great attention...
TIA
Fred
Offline
FredT wrote:
hmmm... is there anything wrong with my questions ?
Nothing wrong with your question. Here comes a solution :-)
I'm going to propose a solution a bit more complex than "just a tWebServiceInput", so I wand to explain why. The "problem" is that GetPeople is not returning an "ARRAY", but a specific "ArrayOfPerson".
$ stubmaker.pl http://examples.qcodo.com/examples/communication/example_service.php?wsdl
$ perl "-MExampleService qw(:all)" -le "use Data::Dumper; print Dumper(GetPeople('Smith'))"
$VAR1 = bless( [
bless( {
'__blnRestored' => 1,
'FirstName' => 'Alex',
'Id' => '5',
'LastName' => 'Smith'
}, 'Person' ),
bless( {
'__blnRestored' => 1,
'FirstName' => 'Wendy',
'Id' => '6',
'LastName' => 'Smith'
}, 'Person' ),
bless( {
'__blnRestored' => 1,
'FirstName' => 'Jennifer',
'Id' => '10',
'LastName' => 'Smith'
}, 'Person' )
], 'ArrayOfPerson' );And if you look at the Perl code generated by tWebServiceInput, you can see that I check for an "ARRAY", not a "ArrayOfPerson". This is something I had not expected when I designed this component (but things can changed, you'll see what I propose in the next post).
So, tWebServiceInput can't produce a nice data structure as output but only a big Perl structure, and tPerlRow will do the smart job. The code in tPerlRow is:
foreach my $person (@{ $input_row[array_of_person] }) {
push @persons, [$person->{FirstName}, $person->{LastName}];
}By default the tArrayIn component is not visible in the palette. You have to make it visible. Go in the "Project settings" (button in the toolbar), Designer > Palette Settings.
Offline
And now, what about improving tWebServiceInput to make things a bit simpler when the data structure returned by the webservice is called "array*".
In tWebServiceInput_begin.perljet, I've replaced:
if (ref $result_<%=cid%> eq 'ARRAY') {by
my $ref_<%=cid%> = ref $result_<%=cid%>;
if ($ref_<%=cid%> =~ m/^ARRAY/i) {And now... standing ovation, the job becomes much simpler. No tPerlRow anymore, no tArrayIn.
Offline
Waow, THIS is an answer
!!! I'm standing on my chair to write this (...hmmm... quite dangerous !!!).
Ok, I'm going to try this now... and I'll post my success, then ask for a feature request.
Thanks a lot !
Offline
Pages: 1