& not recognized in tag of Target Endpoint

Not applicable

Hi,

I am using routerules to route my request to different target end points.So in one of my Target End point I have a hard coded URL like

https://m.example.com/abc/getResource?var1=ABC&var2=https://m.example.com/

I know that in XML we cannot give & directly so used & amp ; but even after this I am getting error as follows:

javax.xml.bind.UnmarshalException - with linked exception: 
[org.xml.sax.SAXParseException; lineNumber: 16; columnNumber: 92; 
The reference to entity "var2" must end with the ';' delimiter.

I tried another approach by setting query parameter using the assign message policy. But with that approach when I see the trace I see that URL has characters %2F %3D for the value of var2 Variable.

Please suggest me the better approach and help me with the error.

0 3 198
3 REPLIES 3

Not applicable

@Vipul Agarwal, can you provide the AssignMessage policy details? And, can you review the target string and ensure that since %2F %3D looks like '/=' characters in a string where you are constructing the targetUrl.

@rdave

For second approach

Assign Message policy is:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage async="false" continueOnError="false" enabled="true" name="AddQueryParam">
    <DisplayName>AddQueryParam</DisplayName>
    <Properties/>
    <Set>
        <Headers/>
        <QueryParams>
            <QueryParam name="var1">ABC</QueryParam>
            <QueryParam name="var2">https://m.example.com</QueryParam>
        </QueryParams>
    </Set>
    <AssignVariable>
        <Name>target.copy.pathsuffix</Name>
        <Value>false</Value>
    </AssignVariable>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
    <AssignTo createNew="false" transport="http" type="request"/>
</AssignMessage>

and My Target end point as

<HTTPTargetConnection>
        <Properties/>
        <URL>https://m.example.com/abc/getResource</URL>
</HTTPTargetConnection>

And in trace session I am getting

getResource?var1=ABC&var2%3Dhttps%3A%2F%2Fm.example.com%2F

adas
New Member

@Vipul Agarwal There's an issue with the new proxy editor, it doesn't accept "&" character in the xml editor. Can you try switching to the classic editor and that should help. We have identified the issue and are working on getting it fixed.