Darg писал(а):
Amir писал(а):
http://stackoverflow.com/questions/6797030/perl-client-to-jax-ws-java-server-issue
Цитата:
I was having the same problem. I made it work with the following two changes:
Name your arguments as in the XSD (
http://localhost:8080/tomcat/calculator?xsd=1)
Don't use the default namespace, but a namespace prefix for the SOAP method (ns() method).
Example code:
my $soap = SOAP::Lite
-> proxy('http://localhost:8080/tomcat/calculator')
-> ns ('http://operation.calculator/');
my $response = $soap->call('add', SOAP::Data->name( arg0 => 'Peter Pan'));
В этом как и во многих других примерах , передаются обычные строковые параметры. А ведь PaymentUpdate требует paymentUpdate который в свою очередь состоит из payment и этот в свою очередь из своих аттрибутов. Как передать такой аргумент ?
пробовал
$v={'id'=>'-1','userId'=>'0','contractId'=>$contract_id,typeId'=>'3','date'=>$now,'comment'=>"fdgdf",'sum'=>$sum,'timeChange'=>$now};
$var = {'paymentUpdate'=>$v}
$client->call('paymentUpdate',$var);
не работает
пробовал
$client->call('paymentUpdate',SOAP::Data->name('paymentUpdate'=> SOAP::Data->name('id'=>'-1','userId'=>'0','contractId'=>$contract_id, 'typeId'=>'3','date'=>$now,'comment'=>"fdgdf",'sum'=>$sum,'timeChange'=>$now)));
тоже не работает
может быть
это поможетЦитата:
Handling LoLs (List of Lists, Structs, Objects, or something else)
Processing of complex data structures isn't different in any aspect from usual processing in your programming language. General rule is simple: 'Treat the result of SOAP call as variable of specified type'.
Next example shows service that works with array of structs (strictly speaking, Perl has no structs. Structs are often emulated with hashes, and that is exactly what is happening here):
8.a. client (lol_serv.pl)
#!perl -w
use SOAP::Lite;
my $result = SOAP::Lite
-> uri('urn:xmethodsServicesManager')
-> proxy('http://www.xmethods.net/soap/servlet/rpcrouter')
-> getAllSOAPServices();
if ($result->fault) {
print $result->faultcode, " ", $result->faultstring, "\n";
} else {
# reference to array of structs is returned
my @listings = @{$result->result};
# @listings is the array of structs
foreach my $listing (@listings) {
print "-----------------------------------------\n";
# print description for every listing
foreach my $key (keys %{$listing}) {
print $key, ": ", $listing->{$key} || '', "\n";
}
}
}
Exactly the same thing is true about structs inside of other structs, list of objects, objects that have lists inside, etc. 'What you return on server side is what you get on client side, and let me know if you get something else.'
(Ok, not always. You MAY get a blessed array even when you return a simple array on the other side and you MAY get a blessed hash when you return a simple one, but it won't change anything in your code, just access it as you usually do).
Т.е в перле объекты это хэши. Попробуйте создать хеш вместо объекта.