REST Component exception java.lang.IllegalArgumentException: Illegal

One Star lkv
One Star

REST Component exception java.lang.IllegalArgumentException: Illegal

I am trying to use the REST component by having Global variable in the URL and getting this error.
REST is having the below URL as in the screen shot.

The java node is having this below line:
globalMap.put("token_result",row1.Body);
System.out.println("The Webervice Token is  :" +(String)globalMap.get("token_result"));

what i am doing is trying to attach the "Token" global variable into the URL, but when i run i am getting is below error
connecting to socket on port 3761
connected
The Webervice Token is  :token=ws31aeb9bdb40ee71b3a:a877881:14fcccd3d12:2c330.16576409984069873
Body    ERROR_CODE
Exception in component tREST_2
java.lang.IllegalArgumentException: Illegal character in query at index 150: https://dev-acm-suse/aveksa/command.submit?cmd=createChangeRequest&token=ws31aeb9bdb40ee71b3a:a87788...

    at java.net.URI.create(Unknown Source)
    at com.sun.jersey.api.client.Client.resource(Client.java:402)
    at zions_etl.aveksa_webservice_termination_0_1.Aveksa_WebService_Termination.tREST_2Process(Aveksa_WebService_Termination.java:1254)
    at zions_etl.aveksa_webservice_termination_0_1.Aveksa_WebService_Termination.tREST_1Process(Aveksa_WebService_Termination.java:879)
    at zions_etl.aveksa_webservice_termination_0_1.Aveksa_WebService_Termination.tSetKeystore_1Process(Aveksa_WebService_Termination.java:439)
    at zions_etl.aveksa_webservice_termination_0_1.Aveksa_WebService_Termination.runJobInTOS(Aveksa_WebService_Termination.java:1623)
    at zions_etl.aveksa_webservice_termination_0_1.Aveksa_WebService_Termination.main(Aveksa_WebService_Termination.java:1480)
disconnected
Caused by: java.net.URISyntaxException: Illegal character in query at index 150: https://dev-acm-suse.zbc.internal/aveksa/command.submit?cmd=createChangeRequest&token=ws31aeb9bdb40e...

    at java.net.URI$Parser.fail(Unknown Source)
    at java.net.URI$Parser.checkChars(Unknown Source)
    at java.net.URI$Parser.parseHierarchical(Unknown Source)
    at java.net.URI$Parser.parse(Unknown Source)
    at java.net.URI.<init>(Unknown Source)
    ... 7 more
Job Aveksa_WebService_Termination ended at 12:35 17/09/2015.


This is throwing this error only when i have the Globalvar in the REST URL.
when i have the full URL as below in the REST component with out having to pass the Global variable then it works fine.
"https://dev-acm-suse/aveksa/command.submit?cmd=createChangeRequest&token=ws31aeb9bdb40ee71b3a:a877881:14fcccd3d12:2c330.16576409984069873
Any idea why it is throwing this error?
Community Manager

Re: REST Component exception java.lang.IllegalArgumentException: Illegal

Hi 
Have a try to build the full url with a context variable on tJavaRow:
context.url="https://dev-acm-suse/aveksa/command.submit?cmd=createChangeRequest&"+row1.Body;
and set the URL field of tRest2 with the context variable.
Please let me know if it works?
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business