• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » PHP Code into Talend Job - WebServices, how to?

#1 2012-07-19 09:19:00

hammerwd
Member
Registered: 2008-04-27
Posts: 59

PHP Code into Talend Job - WebServices, how to?

Hi,

I've got a rather simple PHP code that I'd like to do with Talend:

Code:

$client = new SoapClient('http://www.myhost.com/api/v2_soap?wsdl=1');
$sessionId = $client->login('mysoapadmin', 'mypass');
$params = array('filter' => array(
    array('key' => 'status', 'value' => 'pending'),
    array('key' => 'customer_is_guest', 'value' => '1')
));
$result = $client->salesOrderList($sessionId, $params);
print_r ($result);
$client->endSession($sessionId);

I tried this one:
http://www.talendforge.org/tutorials/tu … ;idTuto=46
but I'm a bit confused - why do I use a WebService  component if there is a SOAP component?
Do I use a WebService or a WebServiceInput?
How do I setup the parameters for the login? In a context?
How about the parameter for the OrderList request?

It seems to be really difficult to get an output with Talend with WebServices (did some stuff with Databases and Files before which was kind of easier :-S ).

Thanks
Chris

Offline

#2 2012-07-19 09:27:39

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: PHP Code into Talend Job - WebServices, how to?

Hi Chris

According to your PHP code, I think you might use tWebService or tWebServiceInput to accomplish your requirement.
Please select the option "Need authentication" on tWebService or tWebServiceInput and then type username and password.
Besides, tWebService is easier to use which can retrieve Port Name and Operation automatically.

Please download the document TalendOpenStudio_Components_RG_51b_EN and get instruction&scenarios about these webservice components. It is not too difficult to use.

Regards,
Pedro


Only Paranoid Survive.

Offline

#3 2012-07-19 11:41:58

hammerwd
Member
Registered: 2008-04-27
Posts: 59

Re: PHP Code into Talend Job - WebServices, how to?

Thanks  for your quick answer.

I tried tWebService which worked nice with retrieving the methods.
After selecting the login method I set up the two parameters username and apiKey and the loginReturn (which should be a Session ID that I need to use).

Unfortunately I receive an error:

Code:

Starte Job MagentoConnection am 17:32 19/07/2012.

[statistics] connecting to socket on port 4079
[statistics] connected
Exception in component tWebService_1
java.lang.reflect.UndeclaredThrowableException
    at $Proxy32.bind(Unknown Source)
    at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:280)
    at org.talend.webservice.helper.ServiceInvokerHelper.createClient(ServiceInvokerHelper.java:142)
    at org.talend.webservice.helper.ServiceInvokerHelper.getClient(ServiceInvokerHelper.java:134)
    at org.talend.webservice.helper.ServiceInvokerHelper.invoke(ServiceInvokerHelper.java:234)
    at magentoinvoicing.magentoconnection_0_1.MagentoConnection.tWebService_1Process(MagentoConnection.java:596)
    at magentoinvoicing.magentoconnection_0_1.MagentoConnection.runJobInTOS(MagentoConnection.java:908)
    at magentoinvoicing.magentoconnection_0_1.MagentoConnection.main(MagentoConnection.java:767)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.cxf.common.util.ReflectionInvokationHandler.invoke(ReflectionInvokationHandler.java:52)
    ... 8 more
Caused by: java.lang.reflect.UndeclaredThrowableException
    at $Proxy33.error(Unknown Source)
    at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.error(SchemaCompilerImpl.java:286)
    at com.sun.tools.xjc.util.ErrorReceiverFilter.error(ErrorReceiverFilter.java:77)
    at com.sun.xml.xsom.impl.parser.ParserContext$2.error(ParserContext.java:202)
    at com.sun.xml.xsom.impl.parser.ParserContext$1.reportError(ParserContext.java:180)
    at com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.reportError(NGCCRuntimeEx.java:170)
    at com.sun.xml.xsom.impl.parser.DelayedRef.resolve(DelayedRef.java:125)
    at com.sun.xml.xsom.impl.parser.DelayedRef.run(DelayedRef.java:100)
    at com.sun.xml.xsom.impl.parser.ParserContext.getResult(ParserContext.java:131)
    at com.sun.xml.xsom.parser.XSOMParser.getResult(XSOMParser.java:226)
    at com.sun.tools.xjc.ModelLoader.createXSOM(ModelLoader.java:519)
    at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:236)
    ... 13 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.cxf.common.util.ReflectionInvokationHandler.invoke(ReflectionInvokationHandler.java:52)
    ... 25 more
Caused by: java.lang.RuntimeException: Error compiling schema from WSDL at {file:/tmp/wsdl1342690377908/mainWSDL.wsdl}: undefined simple or complex type 'typens:associativeMultiArray'
    at org.apache.cxf.endpoint.dynamic.DynamicClientFactory$InnerErrorListener.error(DynamicClientFactory.java:624)
    ... 30 more
Caused by: org.xml.sax.SAXParseException: undefined simple or complex type 'typens:associativeMultiArray'
    at com.sun.xml.xsom.impl.parser.ParserContext$1.reportError(ParserContext.java:176)
    ... 20 more
[statistics] disconnected
Job MagentoConnection endet am 17:33 19/07/2012. [exit code=1]

Any idea on how I can get this working?


Uploaded Images

Last edited by hammerwd (2012-07-19 11:43:41)

Offline

#4 2012-07-19 11:47:09

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: PHP Code into Talend Job - WebServices, how to?

Hi Chris

Could you send me the WSDL file?
I want to check the input parameters and output.

Regards,
Pedro


Only Paranoid Survive.

Offline

#5 2012-07-19 11:56:51

hammerwd
Member
Registered: 2008-04-27
Posts: 59

Re: PHP Code into Talend Job - WebServices, how to?

Thank you - I just sent it to you via email.

Offline

#6 2012-07-22 12:38:52

hammerwd
Member
Registered: 2008-04-27
Posts: 59

Re: PHP Code into Talend Job - WebServices, how to?

Hello,

just wanted to make sure - did you receive my email?

Thanks,
Chris

Offline

#7 2012-07-23 04:11:56

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: PHP Code into Talend Job - WebServices, how to?

Hi Chris

I am so sorry. I didn't receive the attachment.

Regards,
Pedro


Only Paranoid Survive.

Offline

#8 2012-07-23 04:51:51

hammerwd
Member
Registered: 2008-04-27
Posts: 59

Re: PHP Code into Talend Job - WebServices, how to?

Thanks for looking into it .. I resend the mail.

Offline

#9 2012-07-23 05:02:23

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: PHP Code into Talend Job - WebServices, how to?

Hi

I have reproduced this issue.
And here you can see a related issue.
http://jira.talendforge.org/browse/TDI-18573
Please report it on BugTracker. It seems that it recurs.

Regards,
Pedro


Only Paranoid Survive.

Offline

#10 2012-07-23 07:16:45

hammerwd
Member
Registered: 2008-04-27
Posts: 59

Re: PHP Code into Talend Job - WebServices, how to?

I wrote a comment - I hope that's enough as a report!?

Offline

#11 2012-07-23 07:47:16

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: PHP Code into Talend Job - WebServices, how to?

Hi

I don't think so.
The best way is to create a new issue.
Or the developer may not notice it.
http://jira.talendforge.org/secure/Dashboard.jspa

Regards,
Pedro


Only Paranoid Survive.

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » PHP Code into Talend Job - WebServices, how to?

Board footer

Powered by FluxBB