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>

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. 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
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to