0

I am trying to schedule a task wherein I want to call a proxy which does not take any input payload. This is the code I've tried:

<?xml version="1.0" encoding="UTF-8"?>
<task class="org.apache.synapse.startup.tasks.MessageInjector" group="synapse.simple.quartz" name="ScheduleOrderCreation" xmlns="http://ws.apache.org/ns/synapse">
  <trigger count="2" interval="5"/>
     <property xmlns:task="http://www.wso2.org/products/wso2commons/tasks" value="" name="message">     
     </property>
     <property xmlns:task="http://www.wso2.org/products/wso2commons/tasks" name="proxyName"  value="CreateOrders"/>
     <property xmlns:task="http://www.wso2.org/products/wso2commons/tasks" name="injectTo" value="proxy"/>   
  </task>

Since I don't want to pass any input payload, I've set value ="" in "message" property. But I get the following error:

  ERROR {MessageInjector} - message or registry-key not set

How can I handle this in my task? Should I write a separate class implementing the Tasks interface to call this proxy?

ycr
  • 12,828
  • 2
  • 25
  • 45
Ruby
  • 368
  • 1
  • 9

1 Answers1

1

Just add an Empty Payload there.

<?xml version="1.0" encoding="UTF-8"?>
<task class="org.apache.synapse.startup.tasks.MessageInjector" group="synapse.simple.quartz" name="ScheduleOrderCreation" xmlns="http://ws.apache.org/ns/synapse">
    <trigger cron="0 0/1 * 1/1 * ? *"/>
    <property name="injectTo" value="proxy" xmlns:task="http://www.wso2.org/products/wso2commons/tasks"/>
    <property name="proxyName" value="CreateOrders" xmlns:task="http://www.wso2.org/products/wso2commons/tasks"/>
    <property name="message" xmlns:task="http://www.wso2.org/products/wso2commons/tasks">
        <sfdc xmlns=""/>
    </property>
</task>
ycr
  • 12,828
  • 2
  • 25
  • 45
  • I did try passing empty xml payload but I got an error which said: Error while building Passthrough stream org.apache.axiom.soap.SOAPProcessingException: First Element must contain the local name, Envelope , but found html. Since I got this error I set empty value. – Ruby Dec 13 '22 at 12:56
  • @Ruby It seems the error is not related to the task. This `Envelope , but found html.` seems to be coming from one of your Backends. Probably some BE is responding with an HTML page. Add a few logs to the integration and see where it's throwing this error. – ycr Dec 13 '22 at 13:00
  • 1
    hmn hmn.. I'll work on checking the input that is coming then. Thanks @ycr – Ruby Dec 13 '22 at 13:20
  • 1
    Issue is resolved, there was an error connecting to the backend due to password change so it was printing some html content for Unauthorized user. Thanks again @ycr!! – Ruby Dec 13 '22 at 16:23