Hi Malintha,

I'm not sure if this will help, did you try adding a type to target tag.

<enrich>
            <source type="property" clone="true"
property="message1"></source>
            <target type="custom" xpath="//deliverystatus" xmlns="
http://ws.apache.org/ns/synapse";></target>
</enrich>

Regards,

On Mon, Dec 1, 2014 at 7:52 PM, Malintha Adikari <malin...@wso2.com> wrote:

> Hi Senduran,
>
> I tried it but the issue is still there ( Using esb 4.8.1). Will check
> more with your sample. Thank you very much
>
> On Mon, Dec 1, 2014 at 2:03 PM, Senduran Balasubramaniyam <
> sendu...@wso2.com> wrote:
>
>> Hi Malintha,
>>
>> can you try the following and let me know (btw  I tried with ESB 4.8.1)
>>
>> <property name="deliverystatus" scope="default">
>>     <deleveryStatus xmlns="">temval</deleveryStatus>
>> </property>
>>
>> <property name="message1" value="abc123" scope="default"
>> type="STRING"></property>
>>
>> <enrich>
>>     <source type="property" clone="true"
>> property="deliverystatus"></source>
>>     <target type="body" action="child"></target>
>> </enrich>
>>
>>
>> <enrich>
>>     <source clone="true" type="custom" xpath="$ctx:message1"></source>
>>     <target action="replace" type="custom"
>> xpath="//deliverystatus/text()"></target>
>> </enrich>
>>
>> Thanks
>> Senduran
>>
>> On Mon, Dec 1, 2014 at 6:49 PM, Malintha Adikari <malin...@wso2.com>
>> wrote:
>>
>>> Hi Senduran,
>>>
>>> Thank you for the prompt response.
>>>
>>>
>>> On Mon, Dec 1, 2014 at 1:06 PM, Senduran Balasubramaniyam <
>>> sendu...@wso2.com> wrote:
>>>
>>>> Hi Malintha,
>>>>
>>>> You can get rid of the default namespace by adding an empty namespace
>>>> i.e
>>>> <property name="deliverystatus" scope="default">
>>>>             <deleveryStatus xmlns=""></deleveryStatus>
>>>> </property>
>>>>
>>>
>>> I have already tried adding xmlns="" to remove added namespace. But it
>>> did not fix the issue for me.
>>>
>>>>
>>>> also I am not quite sure about the 2nd enrich mediator's target. Since
>>>> if you are adding something like "//deliverystatus" then the xpath will try
>>>> to find a "deliverystatus" node in the body.
>>>>
>>>
>>> First I add this element to request body. Then I try to add value into
>>> that element. I used  log mediator and printed the payload after adding the
>>> <deliveryStatus> element and the payload contains that element. But I
>>> cannot access that element using //deliveryStatus xpath.
>>>
>>> I tried to access same DOM level elements and I could access them.
>>> Problem is cannot access the newly added element though it exists.
>>>
>>>
>>>> If your request doesn't have a deliverystatus node this error may occur
>>>>
>>>> Thanks
>>>> Senduran
>>>>
>>>>
>>>> On Mon, Dec 1, 2014 at 5:59 PM, Malintha Adikari <malin...@wso2.com>
>>>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I want to add following XML element as a child to the payload body
>>>>>
>>>>> <deleveryStatus>abc123</deleveryStatus>
>>>>>
>>>>> This "abc123" value is taken from a property.
>>>>>
>>>>> I used enrich mediator to add the element as follows
>>>>>
>>>>> <property name="deliverystatus" scope="default">
>>>>>             <deleveryStatus></deleveryStatus>
>>>>>          </property>
>>>>>
>>>>>  <enrich>
>>>>>             <source type="property" clone="true"
>>>>> property="deliverystatus"></source>
>>>>>             <target type="body" action="child"></target>
>>>>>          </enrich>
>>>>>
>>>>> and it sets the element as expected to the body (with default
>>>>> namespace)
>>>>>
>>>>> (<deleveryStatus xmlns="http://ws.apache.org/ns/synapse
>>>>> "></deleveryStatus>)
>>>>>
>>>>> Then I tired to set value in to this element (taking from another
>>>>> property)
>>>>>
>>>>>  <enrich>
>>>>>             <source type="property" clone="true"
>>>>> property="message1"></source>
>>>>>             <target xpath="//deliverystatus" xmlns="
>>>>> http://ws.apache.org/ns/synapse";></target>
>>>>>   </enrich>
>>>>>
>>>>> and it gives me following error
>>>>>
>>>>>  *ERROR - EnrichMediator Invalid Target object to be enrich.*
>>>>>
>>>>> But I could add values to elements which were already there in the
>>>>> payload body (value can't be added only to the newly added one). What 
>>>>> could
>>>>> be the reason for this issue? Is there any other way to do this task ?
>>>>>
>>>>> Regards,
>>>>> Malintha Adikari
>>>>> --
>>>>> *Malintha Adikari*
>>>>>  Software Engineer
>>>>> WSO2 Inc.; http://wso2.com
>>>>> lean.enterprise.middleware
>>>>>
>>>>> Mobile: +94 71 2312958
>>>>> Blog:    http://malinthas.blogspot.com
>>>>> Page:   http://about.me/malintha
>>>>>
>>>>> _______________________________________________
>>>>> Dev mailing list
>>>>> Dev@wso2.org
>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> *Senduran *
>>>> Software Engineer,
>>>> WSO2, Inc.;  http://wso2.com/ <http://wso2.com/>
>>>> Mobile: +94 77 952 6548
>>>>
>>>
>>>
>>>
>>> --
>>> *Malintha Adikari*
>>>  Software Engineer
>>> WSO2 Inc.; http://wso2.com
>>> lean.enterprise.middleware
>>>
>>> Mobile: +94 71 2312958
>>> Blog:    http://malinthas.blogspot.com
>>> Page:   http://about.me/malintha
>>>
>>
>>
>>
>> --
>> *Senduran *
>> Software Engineer,
>> WSO2, Inc.;  http://wso2.com/ <http://wso2.com/>
>> Mobile: +94 77 952 6548
>>
>
>
>
> --
> *Malintha Adikari*
>  Software Engineer
> WSO2 Inc.; http://wso2.com
> lean.enterprise.middleware
>
> Mobile: +94 71 2312958
> Blog:    http://malinthas.blogspot.com
> Page:   http://about.me/malintha
>
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
*Jerad Rutnam | **Software Engineer - UI*
WSO2, Inc. www.wso2.com

*Email: je...@wso2.com <je...@wso2.com>*
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to