One Star

[resolved] Send Parameter from PHP to Webservice (with SOAP)

Hi,
As the title says, I try to send parameter from PHP form to ws, I just send to url file url to compare.
I see to way :
- with url : http://localhost:8080/Principale_0.1/services/principal?method=runJob&arg1=--context_param%20dossierBoard=d:\Utilisateurs\acanevat\Mes%20documents\TOS2\recoupBoardESS\In\board.xls&arg2=--context_param%20dossierESS=d:\Utilisateurs\acanevat\Mes%20documents\TOS2\recoupBoardESS\In\REEL.xls, I can send the parameter and it's OK.
- with soap, the way I look for
Fichier wsdl
<wsdl:types>
<schema elementFormDefault="qualified" targetNamespace="http://talend.org" xmlns="http://www.w3.org/2001/XMLSchema">
<element name="args">
<complexType>
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="item" type="xsd:string"/>
</sequence>
</complexType>
</element>
...
<wsdl:message name="runJobRequest">
<wsdl:part element="impl:args" name="args"/>
</wsdl:message>
...
<wsdl:operation name="runJob">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="runJobRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>

Coté client (PHP)
$services = new soapClient($url_wsdl); // with soap php extension
print_r($services->__getFunctions()); // get function service can use
$args = "&arg1=--context_param%20dossierBoard=d:\Utilisateurs\acanevat\Mes%20documents\TOS2\recoupBoardESS\In\board.xls";
$args = "&arg2=--context_param%20dossierESS=d:\Utilisateurs\acanevat\Mes%20documents\TOS2\recoupBoardESS\In\REEL.xls";
// $args = "--context_param";
// $args = "dossierBoard=d:\Utilisateurs\acanevat\Mes documents\TOS2\recoupBoardESS\In\board.xls";
// $args = "--context_param";
// $args = "dossierESS=d:\Utilisateurs\acanevat\Mes documents\TOS2\recoupBoardESS\In\REEL.xls";

// Call the SOAP method
print_r($services -> runJob($args));

I get
Array ( => runJobReturn runJob(args $args) ) stdClass Object ( )
I start in ws and I don't know if the pb comes from my sent or the content of the parameter, knowing that the parameter dossierBoard and dossierESS correspond on context.dossierBoard and context.dossierESS.
Cordially.
1 ACCEPTED SOLUTION

Accepted Solutions
Seventeen Stars

Re: [resolved] Send Parameter from PHP to Webservice (with SOAP)

thanks for the tricks
I can call a simple job that take args[] (a value ) ans multiplie it by 2 !
Now I can use forms and some php script to consume Talend web services througt Http web page ... so cool!
regards
laurent
++
5 REPLIES
Seventeen Stars

Re: [resolved] Send Parameter from PHP to Webservice (with SOAP)

hi chtorrel,
I've got same problem
If I call my web service and pass args in the URI , it's work!
But I dont' find the way to pass args to my SoapClient in a PHP script.
I've tried with array , value and __soapCall ....
here some of my test :
print_r ($soapClient->runJob()->item->item);
print_r ($soapClient->runJob(array('args'=>'arg1=--context_param valeur=5'))->item->item);
print_r ($soapClient->__soapCall('runJob',array('args'=>'5'))->item-item);
// ....

I'm also newbies with soap and wsql descriptiion , so i'm looking like you a way to do that ....
It's always my default context value as a result Smiley Happy
ps : your result Array ( => runJobReturn runJob(args $args) ) is the normal one for print_r($services->__getFunctions());
laurent
++
One Star

Re: [resolved] Send Parameter from PHP to Webservice (with SOAP)

So start of an answer, I try with a simple job containing tFlowInput and tBufferOutput and my 2 variables context.dossierESS and context.dossierBoard.
client (PHP)
$args = "--context_param";
$args = "dossierBoard=act";
$args = "--context_param";
$args = "dossierESS=d:\Utilisateurs\acanevat\Mes documents\TOS2\recoupBoardESS\In\REEL.xls";

// Call the SOAP method
print_r($services -> runJob($args));

it's OK my browser show the waited result.
but my principal job doesn't work anyway, I hope my next msg will be better..
cordially
Seventeen Stars

Re: [resolved] Send Parameter from PHP to Webservice (with SOAP)

thanks for the tricks
I can call a simple job that take args[] (a value ) ans multiplie it by 2 !
Now I can use forms and some php script to consume Talend web services througt Http web page ... so cool!
regards
laurent
++
One Star

Re: [resolved] Send Parameter from PHP to Webservice (with SOAP)

could you give us the code (php script ) that you have wrote to consume the Talend WS from php script page .
i have the same probleme .
thanks
One Star

Re: [resolved] Send Parameter from PHP to Webservice (with SOAP)

RgRRR6 <a href="">kvvnkxmifrrt</a>, italoumvallz, jirpkjmjoipn,