Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
hiba1
Contributor
Contributor

Pass Dynamic values into tSOAP Message

I am quite new to Talend.

i am using the tSOAP component and if i use the blow flow it works fine.
tsoap --> LogRow
I can paste the SOAP Request message into SOAP Message section of the tsoap node and it works fine.. 
But now i want to read sql table and dynamically pass the value to  SOAP Message of tSOAP component .I tried to produce this but it not work.

0683p000009M6ZX.png0683p000009M6f1.pngto check the dynamic value0683p000009M6lr.pnginsert the dynamic value into the soap message

Any help is really appreciated.

Labels (5)
1 Solution

Accepted Solutions
lennelei
Creator III
Creator III

Good!

 

Are you sure you have no space between ' and " in the SOAP message : it looks like there is a space in your screenshot

 

it should be :

<country code='" + (String)globalMap.get("coutryCode") + "' />

not (note the spaces between the ' and the " after and before your globalMap.get...:

<country code=' " + (String)globalMap.get("coutryCode") + " ' />

View solution in original post

9 Replies
lennelei
Creator III
Creator III

Hi,

 

the SOAP message content is a String (see the quotes "around it).

 

You are currently writing the text (String)globalMap.get(countryCode) in your message which is not what you want 0683p000009MA9p.png

 

You want to concatenates the value of the globale variable countryCode to your message.

 

Strings concatenation in Java is made with + operator.

 

You need to use :

".... beginning of your message ...
<country code='" + (String)globalMap.get("countryCode") + "' />
.... end of your message ..."

Note how I use quotes to end the fixed String after : <country code='

I then concatenate your variable value

And start a new fixed String for the end of your message : ' />

 

Regards

hiba1
Contributor
Contributor
Author

Hi lennelei,

i try to update the soap message ,but i get this error :0683p000009M6T8.png

lennelei
Creator III
Creator III

my bad 0683p000009MACn.png I took your code and forgot to add the missing quotes!

 

...globalMap.get("countryCode")...

 

hiba1
Contributor
Contributor
Author

another error 0683p000009MPcz.png

 0683p000009M6m6.png

0683p000009M6mB.png

lennelei
Creator III
Creator III

Could you please post the whole error and the content of the soap message text box?

hiba1
Contributor
Contributor
Author

the error:

juil. 24, 2019 1:28:24 PM com.sun.xml.messaging.saaj.soap.EnvelopeFactory createEnvelope
GRAVE: SAAJ0511: Unable to create envelope from given source
Exception in component tSOAP_5 (myGO_V1)
com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to create envelope from given source:
at com.sun.xml.messaging.saaj.soap.EnvelopeFactory.createEnvelope(EnvelopeFactory.java:148)
at com.sun.xml.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl.createEnvelopeFromSource(SOAPPart1_1Impl.java:102)
at com.sun.xml.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:156)
at org.talend.soap.SOAPUtil.invokeSOAP(SOAPUtil.java:155)
at xml_project.mygo_v1_0_1.myGO_V1.tDBInput_3Process(myGO_V1.java:969)
at xml_project.mygo_v1_0_1.myGO_V1.runJobInTOS(myGO_V1.java:1491)
at xml_project.mygo_v1_0_1.myGO_V1.main(myGO_V1.java:1342)
Caused by: java.lang.NullPointerException
at com.sun.xml.messaging.saaj.soap.SOAPPartImpl.lookForEnvelope(SOAPPartImpl.java:176)
at com.sun.xml.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:149)
at com.sun.xml.messaging.saaj.soap.EnvelopeFactory.createEnvelope(EnvelopeFactory.java:138)
... 6 more

CAUSE:

java.lang.NullPointerException
at com.sun.xml.messaging.saaj.soap.SOAPPartImpl.lookForEnvelope(SOAPPartImpl.java:176)
at com.sun.xml.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:149)
at com.sun.xml.messaging.saaj.soap.EnvelopeFactory.createEnvelope(EnvelopeFactory.java:138)
at com.sun.xml.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl.createEnvelopeFromSource(SOAPPart1_1Impl.java:102)
at com.sun.xml.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:156)
at org.talend.soap.SOAPUtil.invokeSOAP(SOAPUtil.java:155)
at xml_project.mygo_v1_0_1.myGO_V1.tDBInput_3Process(myGO_V1.java:969)
at xml_project.mygo_v1_0_1.myGO_V1.runJobInTOS(myGO_V1.java:1491)
at xml_project.mygo_v1_0_1.myGO_V1.main(myGO_V1.java:1342)

CAUSE:

java.lang.NullPointerException
at com.sun.xml.messaging.saaj.soap.SOAPPartImpl.lookForEnvelope(SOAPPartImpl.java:176)
at com.sun.xml.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:149)
at com.sun.xml.messaging.saaj.soap.EnvelopeFactory.createEnvelope(EnvelopeFactory.java:138)
at com.sun.xml.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl.createEnvelopeFromSource(SOAPPart1_1Impl.java:102)
at com.sun.xml.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:156)
at org.talend.soap.SOAPUtil.invokeSOAP(SOAPUtil.java:155)
at xml_project.mygo_v1_0_1.myGO_V1.tDBInput_3Process(myGO_V1.java:969)
at xml_project.mygo_v1_0_1.myGO_V1.runJobInTOS(myGO_V1.java:1491)
at xml_project.mygo_v1_0_1.myGO_V1.main(myGO_V1.java:1342)
[statistics] disconnected

 

tSOAP Message:

0683p000009M6m2.png

hiba1
Contributor
Contributor
Author

i correct it ...but  the response of the tsoap return this xml :

0683p000009M6mG.pngwhile when i try this with SOAPUI and replace the coutryCode with "I"  .it return the correct xml with all the cities of the country.

 

lennelei
Creator III
Creator III

Good!

 

Are you sure you have no space between ' and " in the SOAP message : it looks like there is a space in your screenshot

 

it should be :

<country code='" + (String)globalMap.get("coutryCode") + "' />

not (note the spaces between the ' and the " after and before your globalMap.get...:

<country code=' " + (String)globalMap.get("coutryCode") + " ' />
hiba1
Contributor
Contributor
Author

Thanks, your solution worked 0683p000009MACJ.png