Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X
Has anybody been successful using the ContentLoader functions in TWx 9.0 Extension SDK? I've been following this example and this javadoc but I keep getting a null pointer exception. Just to test my sanity, I used the same url, header, and content information inside a Composer service and I was successful. I've attached the stack trace and the code I'm using is:
public Boolean myService() throws Exception {
Boolean verify = false;
ContentLoader verifyCheck = new ContentLoader();
String url = "https://postman-echo.com/post";
JSONObject content = new JSONObject("{\"meta\":{\"key\": \"" + "abc" + "\"}}");
String username = null;
String password = null;
JSONObject headers = null;
Boolean ignoreSSLErrors = null;
Boolean withCookies = null;
Double timeout = null;
Boolean useNTLM = null;
String workstation = null;
String domain = null;
Boolean useProxy = null;
String proxyHost = null;
Integer proxyPort = null;
String proxyScheme = null;
try {
_logger.warn("URL in myService(): " + url.toString());
_logger.warn("Content in myService(): " + content.toString());
verifyCheck.PostJSON(url, content, username, password, headers,
ignoreSSLErrors, withCookies, timeout, useNTLM, workstation, domain, useProxy,
proxyHost, proxyPort, proxyScheme);
}
catch(Exception e)
{
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
_logger.error("Exception in myService(): " + sw.toString());
}
return verify;
}
Solved! Go to Solution.
Thanks for the reply. I believe I found the issue. In the example that I linked, all of the Boolean values are set to null. I changed them all to false instead and that seems to have fixed the issue. The PTC example may need to be updated.
Hi @nmilleson.
We're working internally to answer your question and will respond back as soon as we have more information.
Regards.
--Sharon
Thanks for the reply. I believe I found the issue. In the example that I linked, all of the Boolean values are set to null. I changed them all to false instead and that seems to have fixed the issue. The PTC example may need to be updated.
Hi @nmilleson.
Thank you for the follow-up!
I will pursue getting the instructions reviewed for update.
Regards.
--Sharon
Hi @nmilleson.
The article you referenced has been updated. Please mark the appropriate response as the Accepted Solution (even if it's yours) for the benefit of others in the community.
Regards.
--Sharon
Thank you! Much appreciated