Date From SOAP todatabase

Four Stars

Date From SOAP todatabase

Hi,

I am new user of Talend Open Studio.

I d like to get data from SOAP service to put in a database.

I do not know what is the difference between "tsoap", "twebService", "twebserviceInput" ans WebsService Metadata.

Somebody can help me ?

Thanks,

Ponce

Tags (1)
Community Manager

Re: Date From SOAP todatabase

Have you built anything yet? If so, can you show us?
A tSoap component is used to call a SOAP web service.

A tWebService is another component to call a SOAP service.

A tWebServiceInput is another component to call a SOAP service.

WebService metadata is created when you analyse your WSDL.

If you Google each of the components above, it will take you to the relevant documentation

Four Stars

Re: Date From SOAP todatabase

Thanks for your response.

 

I have just do this :

tsoap ->row(main)->tmap->exit(main)->tDbOutput

I didn't succeed in doing this.

 

How can we know what soap component to use ?

 

Thanks,

Ponce

Community Manager

Re: Date From SOAP todatabase

You can use whichever SOAP component you wish. There are differences between them, but they will each return a result from a SOAP payload. The first thing you need to do is get your SOAP component returning some data. Does your SOAP Service require any particular parameters? 

Four Stars

Re: Date From SOAP todatabase

I need a login, password and a client ID to get data.

In the tmap I see header, body and fault. I do not see variables which comes from the webservices.

How can I see the result ?

 

Thanks,

Ponce

Community Manager

Re: Date From SOAP todatabase

This is going to be tricky. Do you work with anyone who understands SOAP services? All of the information you should need for this should be contained in the service WSDL. Once you have that information, it should point out how to set any parameters within an XML payload. You may need to set usernames and passwords using the tSOAP component. Getting data from SOAP services is generally a lot harder than simply calling a URL. It is one of the many reasons why many people prefer REST services.

 

Do you have a WSDL that you know of?

Four Stars

Re: Date From SOAP todatabase

Hi,

thank you for your response.

I have the documentation of methods (All I need to know: WSDSL, login, passwords, methods) I can use to get data from the software (Ypareo).

But I have some difficulties to use them.

I am not an expert of SOAP but this is the only way to use webservice (soap 1.1).

I have succeed in getting data from the software by using SOAPUI.

Now I need to do more by getting data to put on a database...

I have to understand how to get data by using a component of TOS instead of making a script (php for example).

 

Ponce

Community Manager

Re: Date From SOAP todatabase

OK, we can go from your SOAPUI config to the config you need with Talend. What did you use with SOAPUI when you got a successful result?

 

Four Stars

Re: Date From SOAP todatabase

With a new SOAP project with the WSDL I have, I get the list of methods.

When I click on a method/request, I have the request in XML format. I just have to write missing data to execute and having the result on the right (in XML format).

Some requests need data which comes from another requests...

 

This is an example of a request I can do to begin :

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:net="URL">
<soapenv:Header>
<WebServiceUser xsi:type="net:WebServiceUser">
<!--You may enter the following 3 items in any order-->
<codeClient xsi:type="xsd:int">CODECLIENT</codeClient>
<login xsi:type="xsd:string">LOGIN</login>
<password xsi:type="xsd:string">PASSWORD</password>
</WebServiceUser>
</soapenv:Header>
<soapenv:Body>
<net:getSites soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</soapenv:Body>
</soapenv:Envelope>

Community Manager

Re: Date From SOAP todatabase

Right, I have converted your example SOAP message to an escaped version since it will be interpreted as a Java String by Talend. FYI, this allows you to make the contents dynamic by using String variables.

 

"<soapenv:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"URL\">\r\n<soapenv:Header>\r\n<WebServiceUser xsi:type=\"net:WebServiceUser\">\r\n<!--You may enter the following 3 items in any order-->\r\n<codeClient xsi:type=\"xsd:int\">"+context.ClientCode+"</codeClient>\r\n<login xsi:type=\"xsd:string\">"+context.Login+"</login>\r\n<password xsi:type=\"xsd:string\">"+context.Password+"</password>\r\n</WebServiceUser>\r\n</soapenv:Header>\r\n<soapenv:Body>\r\n<net:getSites soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"/>\r\n</soapenv:Body>\r\n</soapenv:Envelope>"

You will notice 3 context variables I have added. One for Login, Password and ClientCode. You will need to either change these or use them in your job.

 

The component I would test this with would be the tSOAP component. The code above needs to be placed in the "SOAP Message" parameter.

 

You will need to populate the "ENDPOINT" and "SOAP Action" parameters. You have not given me enough info to tell you what they should be.

 

Add a tLogRow after your tSOAP component and test it like this. What do you get?

Four Stars

Re: Date From SOAP todatabase

I have this on TOS :

tsoap ->row(Main)->tlogrow

 

In tsoap :

Endpoint : URL

Action SOAP : url with Method name

Version : SOAP1.1

SOAP Message : your code with my three paramters.

 

When execute : Syntax error on token "Invalid Character", invalid (It could have another errors ....)

org.talend.designer.runprocess.ProcessorException: Erreurs de compilation du Job 
Au moins le Job "testJob" a des erreurs de compilation, réparez et réexportez.
Ligne en erreur: 561
Message détaillé: Syntax error on token "Invalid Character", invalid (
Il peut y avoir d'autres erreurs causées par la compatibilité avec la JVM. Vérifiez que les paramètres de votre JVM sont les mêmes que dans le studio.
	at org.talend.designer.runprocess.JobErrorsChecker.checkLastGenerationHasCompilationError(JobErrorsChecker.java:338)
	at org.talend.designer.runprocess.DefaultRunProcessService.checkLastGenerationHasCompilationError(DefaultRunProcessService.java:533)
	at org.talend.designer.runprocess.RunProcessService.checkLastGenerationHasCompilationError(RunProcessService.java:316)
	at org.talend.designer.runprocess.ProcessorUtilities.generateBuildInfo(ProcessorUtilities.java:826)
	at org.talend.designer.runprocess.ProcessorUtilities.generateCode(ProcessorUtilities.java:609)
	at org.talend.designer.runprocess.ProcessorUtilities.generateCode(ProcessorUtilities.java:1951)
	at org.talend.designer.runprocess.RunProcessContext$1.run(RunProcessContext.java:601)
	at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:440)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:356)
	at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:474)
	at org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog.run(ProgressMonitorJobsDialog.java:240)
	at org.eclipse.ui.internal.progress.ProgressManager.run(ProgressManager.java:966)
	at org.talend.designer.runprocess.RunProcessContext.exec(RunProcessContext.java:548)
	at org.talend.designer.runprocess.ui.ProcessComposite.exec(ProcessComposite.java:1444)
	at org.talend.designer.runprocess.ui.views.ProcessView$RunAction.run(ProcessView.java:700)
	at org.talend.designer.runprocess.ui.actions.RunProcessAction.run(RunProcessAction.java:58)
	at org.talend.designer.core.debug.JobLaunchConfigurationDelegate$1.run(JobLaunchConfigurationDelegate.java:85)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4906)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4475)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1173)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1062)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:636)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:563)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:151)
	at org.talend.rcp.intro.Application.start(Application.java:277)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:595)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1501)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1474)

 

This is the result on SOAPUI :

<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="XXXXXX" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <SOAP-ENV:Body>
      <ns1:getSitesResponse>
         <getSitesReturn SOAP-ENC:arrayType="ns1:wsPiSite[6]" xsi:type="ns1:wsPiSiteArray">
            <item xsi:type="ns1:wsPiSite">
               <abrege_site xsi:nil="true"/>
               <adr1 xsi:type="xsd:string">XXXXXX</adr1>
               <adr2 xsi:type="xsd:string">XXXXXX</adr2>
               <adr3 xsi:nil="true"/>
               <civilite_dirigeant xsi:type="xsd:string">M.</civilite_dirigeant>
               <code_site xsi:type="xsd:int">XXXXXX</code_site>
               <cp xsi:type="xsd:string">XXXXXX</cp>
               <email xsi:type="xsd:string">XXXXXX</email>
               <fax xsi:type="xsd:string">XXXXXX</fax>
               <naf xsi:nil="true"/>
               <nom_dirigeant xsi:type="xsd:string">XXXXXX</nom_dirigeant>
               <nom_forme_juridique xsi:nil="true"/>
               <nom_site xsi:type="xsd:string">XXXXXX</nom_site>
               <prenom_dirigeant xsi:type="xsd:string">XXXXXX</prenom_dirigeant>
               <rne xsi:type="xsd:string">XXXXXX</rne>
               <siret xsi:nil="true"/>
               <tel1 xsi:type="xsd:string">XXXXXX</tel1>
               <tel2 xsi:nil="true"/>
               <ville xsi:type="xsd:string">XXXXXX</ville>
            </item>
[...]
 </getSitesReturn>
      </ns1:getSitesResponse>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

 

Community Manager

Re: Date From SOAP todatabase

This looks like a compilation error. I'm afraid my French is not great. If it is a compilation error, you can get more information by clicking on the "Code" tab in the bottom left corner of the development window, waiting for the code to be built and then looking for red blocks on the right of the page. Click on the red blocks and it will take you to the code in error. Can you take a few screenshots of any code errors found? Also, can you take a screenshot of your tSOAP config please?

Four Stars

Re: Date From SOAP todatabase

On the bottom left corner, you mean "outline" ?

I don't see a development windows.

Community Manager

Re: Date From SOAP todatabase

When I said the development window, I meant where you place your components. You have a "Code" tab there. If you click on it, it will reveal the code that has been generated. I can see one error from your screenshot though. Take a look at the image below....

Screenshot 2019-08-09 at 16.54.19.png

 

Where you have replaced the context variable examples I gave you, you have made 1 or 2 possible mistakes (I cannot see as this has been covered). You have either added new variables here and omitted to include the + symbols before and after those variables. These are required for String concatenation. Everything after the last " is concatenated with the value held by the variable after the + in my example. The alternative is that you have added a hardcoded value. In which case you need to remove the quotes after the > and before <.

 

For example, I gave you something like this....

 

<Login>"+context.Login+"</Login>

If you are adding a new variable to replace context.Login, you needed to change it to this (assuming the new variable is actually a column value from a row)....

<Login>"+row1.columnVal+"</Login>

If you are hardcoding a literal value (the actual login name), you would want to do this...

<Login>MyActualName</Login>

What you have done is left the quotes and omitted the +s. This will break the Java String.

Four Stars

Re: Date From SOAP todatabase

Hi,

thanks for your message.

I have some difficulties to understand about variables.

Where we have to put the values of variables ?

About Login and Password, is it like on the picture ?

What about the ClientCode we need too ?

 

You say

<Login>"+row1.columnVal+"</Login>

But for a tsoap component, what/where is row1 and columnVal ?

Should we use a WSDL webservice metadata for to put values ?

Thank you,

Ponce

Community Manager

Re: Date From SOAP todatabase

My example was a generic example using what most people use to pass values into SOAP messages. But I could have been clearer. "row1.columnVal" was just a generic reference to the standard row and column notation used. This could have been a context variable or any other Java variable. What is happening here is that several domain specific languages/contexts are being combined. Creating the SOAP message is just a case of Java String manipulation. 

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 3

Read about some useful Context Variable ideas

Blog