How to get the property transport.vfs.FileURI in sequence WSO2?

蹲街弑〆低调 提交于 2019-12-13 19:33:29

问题


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 :)


回答1:


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)




回答2:


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.



来源:https://stackoverflow.com/questions/17562087/how-to-get-the-property-transport-vfs-fileuri-in-sequence-wso2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!