Question

Is there any way to get the value of transport.vfs.FileURI in a sequence in WSO2? For example I have a proxy vfs like this

  <parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
  <parameter name="transport.PollInterval">15</parameter>
  <parameter name="transport.vfs.MoveAfterProcess">file:///opt/temp/</parameter>
  <parameter name="transport.vfs.FileURI">file:///opt/IDM/</parameter>
  <parameter name="transport.vfs.ContentType">application/xml</parameter>

Then I want to get the value of transport.vfs.FileURI in a sequence, maybe something like this :

  <property xmlns:ns="http://org.apache.synapse/xsd"
  name="fileuri"
  expression="fn:concat('uri : ',get-property('transport', 'FILE_URI'))"
  scope="default"
  type="STRING"/>

Can I do something like this in WSO2 sequence?

Thanks :)

Was it helpful?

Solution

No, not like that, in the proxy it is set as service level parameter. so, in the sequence of the proxy you need to set a property with the same value, and again try to access that property. But i think, you can achieve this using a class mediator, where access the axis2 serviceMessagecontext,and read service level parameters. (though not sure)

OTHER TIPS

As this was my problem too I tried to understand the answer above, I just write here what I found from this comment of @Ratha. To access the service parameters in a Class Mediator you can simply get the axis2 message context and get the value of parameter by its name. here is the code that I used and it is just copy of what was in the so-called link.

//These three lines are for getting Service Parameters from the axis2 message context.
        org.apache.axis2.context.MessageContext axis2MessageContext;
        axis2MessageContext = ((Axis2MessageContext)context).getAxis2MessageContext();

        System.out.println("Service Parameter name: "
                + axis2MessageContext.getParameter("parameterName").getValue());    

and in this regard I think it is good to say that it shouldn't get confused with message context properties, message context properties are those which can be add with property mediator in wso2 esb designer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top