KB Article #166327

NullPointerException in Connect To URL filter

Problem

When trying to use a connect to URL and filling out the Request details tab at runtime the following exceptions have been hit.

  • java exception running circuit:
<span style="color: #000000;"><span style="font-family: 'Courier New', monospace;"><span>java.lang.NullPointerException</span></span></span>
<span style="color: #000000;">        <span style="font-family: 'Courier New', monospace;"><span>at com.vordel.circuit.net.ConnectToURLProcessor.invoke(ConnectToURLProcessor.java:62)</span></span></span>
<span style="color: #000000;">        <span style="font-family: 'Courier New', monospace;"><span>at com.vordel.circuit.InvocationEngine.invokeFilter(InvocationEngine.java:160)</span></span></span>
<span style="color: #000000;">        <span style="font-family: 'Courier New', monospace;"><span>at com.vordel.circuit.InvocationEngine.invokeCircuit(InvocationEngine.java:52)</span></span></span>
<span style="color: #000000;">        <span style="font-family: 'Courier New', monospace;"><span>at com.vordel.circuit.InvocationEngine.processMessage(InvocationEngine.java:241)</span></span></span>
<span style="color: #000000;">        <span style="font-family: 'Courier New', monospace;"><span>at com.vordel.circuit.SyntheticCircuitChainProcessor.invoke(SyntheticCircuitChainProcessor.java:36)</span></span></span>
<span style="color: #000000;">        <span style="font-family: 'Courier New', monospace;"><span>at com.vordel.dwe.http.HTTPPlugin.invokeDispose(HTTPPlugin.java:300)</span></span></span>
<span style="color: #000000;">        <span style="font-family: 'Courier New', monospace;"><span>at com.vordel.dwe.http.HTTPPlugin.invoke(HTTPPlugin.java:166)</span></span></span>
  • java exception running circuit:

java.lang.RuntimeException: IO error creating body from text

at com.vordel.el.coercers.BodyCoercer.convert(BodyCoercer.java:23)

at com.vordel.el.coercers.BodyCoercer.convert(BodyCoercer.java:11)

at com.vordel.el.SelectorString$1.convert(SelectorString.java:158)

at de.odysseus.el.ExpressionFactoryImpl.coerceToType(ExpressionFactoryImpl.java:431)

at com.vordel.el.SelectorString.substitute(SelectorString.java:280)

at com.vordel.el.SelectorString.substitute(SelectorString.java:319)

at com.vordel.circuit.net.ConnectToURLProcessor.invoke(ConnectToURLProcessor.java:62)

at com.vordel.circuit.InvocationEngine.invokeFilter(InvocationEngine.java:160)

at com.vordel.circuit.InvocationEngine.invokeCircuit(InvocationEngine.java:52)

at com.vordel.circuit.InvocationEngine.processMessage(InvocationEngine.java:241)

at com.vordel.circuit.SyntheticCircuitChainProcessor.invoke(SyntheticCircuitChainProcessor.java:36)

at com.vordel.dwe.http.HTTPPlugin.invokeDispose(HTTPPlugin.java:300)

at com.vordel.dwe.http.HTTPPlugin.invoke(HTTPPlugin.java:166)

Caused by: java.io.IOException: Unexpected end of input reading header

at com.vordel.mime.HeaderSet.parseMIME(HeaderSet.java:446)

at com.vordel.el.coercers.BodyCoercer.convert(BodyCoercer.java:19)

Resolution

The way to use the Request Details Body in the Connect To URL filter is to include the content-type in the field e.g.

Content-Type: text/html

<!DOCTYPE html>
<html>
    <body>
        <h1>Hello World</h1>
    </body>
</html>

Note: A blank line (CRLF) is required between content type line and body.


This is underlined in the Amplify API Management documentation: Policy Filter reference -> Routing filters (axway.com)

The Request Details configuration is like having a Set Message built into the connection filter.