I want to consume Magento SOAP webservice in Talend. The newbie solution I tried first was to write manually soap messages in custom routines. It works but not viable at long term and really painful to maintain. You guess it's the first time I deal with SOAP.
Now I've discovered code generation using wsdl2java in tWebServiceInput. I got the following new routines: BindingStub, MagentoService, MagentoServiceLocator, Porttype.
In a tJava, I wrote:
String wsdl = "http://mymagento.localhost/index.php/api/soap/"; routines.PortType porttype = new routines.MagentoServiceLocator().getPort(new java.net.URL(wsdl)); String resp= porttype.login("myusername", "mypassword"); System.out.println(resp);
But when I run it, I got the following error.
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/rpc/Service
How do I install this missing class ?
There are two ways for you to import and use an external jar.
1)Using tLibraryload component to load the jar file at the begininig of job. for example:
tJava(on tJava, use the external API)
2)Creating custom routine, import the external jar file by clicking on the routine name and editing the routine libraries, and then call this routine in the job.