web stats
java.lang.NullPointerException after REST API call with HTTP Sender Connector - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 08-27-2014, 07:37 PM
mirraraenn mirraraenn is offline
Mirth Newb
 
Join Date: Jun 2014
Posts: 16
mirraraenn is on a distinguished road
Default java.lang.NullPointerException after REST API call with HTTP Sender Connector

After configuring the SSL plugin and making several successful calls via HTTPS to a REST API I attempted using a query parameter to further refine the call. The only difference between a working version of the channel and a non-working version where this null pointer exception is received is the introduction of the query parameter. I've tried adding it into the Query Parameter forms area as well as directly placing it in the URL, but to no avail.

Response Status
Code:
ERROR: Error connecting to HTTP server [NullPointerException: null]
Full Stack Trace
Code:
HTTP Sender error
ERROR MESSAGE: Error connecting to HTTP server
java.lang.NullPointerException
	at java.lang.String.<init>(Unknown Source)
	at com.mirth.connect.connectors.http.HttpDispatcher.send(HttpDispatcher.java:195)
	at com.mirth.connect.donkey.server.channel.DestinationConnector.handleSend(DestinationConnector.java:599)
	at com.mirth.connect.donkey.server.channel.DestinationConnector.process(DestinationConnector.java:336)
	at com.mirth.connect.donkey.server.channel.DestinationChain.call(DestinationChain.java:224)
	at com.mirth.connect.donkey.server.channel.Channel.process(Channel.java:1428)
	at com.mirth.connect.donkey.server.channel.Channel.dispatchRawMessage(Channel.java:956)
	at com.mirth.connect.donkey.server.channel.SourceConnector.dispatchRawMessage(SourceConnector.java:175)
	at com.mirth.connect.donkey.server.channel.SourceConnector.dispatchRawMessage(SourceConnector.java:152)
	at com.mirth.connect.connectors.jdbc.DatabaseReceiver.processRecord(DatabaseReceiver.java:198)
	at com.mirth.connect.connectors.jdbc.DatabaseReceiver.processResultSet(DatabaseReceiver.java:164)
	at com.mirth.connect.connectors.jdbc.DatabaseReceiver.poll(DatabaseReceiver.java:121)
	at com.mirth.connect.donkey.server.channel.PollConnector$PollConnectorTask.run(PollConnector.java:141)
	at java.util.TimerThread.mainLoop(Unknown Source)
	at java.util.TimerThread.run(Unknown Source)
Reply With Quote
  #2  
Old 08-28-2014, 06:56 AM
mirraraenn mirraraenn is offline
Mirth Newb
 
Join Date: Jun 2014
Posts: 16
mirraraenn is on a distinguished road
Default

The url that works looks like this:
Code:
https://hostname/v1/contextPath/resourceName
while the non-working version looks like this:
Code:
https://hostname/v1/contextPath/resourceName?since=1407871630,1
Reply With Quote
  #3  
Old 08-28-2014, 08:53 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,099
narupley is on a distinguished road
Default

The problem is probably not in the query parameters you're sending per se, but rather in the response being returned from the server. What exactly is the difference, if any? Do an in-depth network capture in both cases and post it here.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #4  
Old 08-28-2014, 11:24 AM
mirraraenn mirraraenn is offline
Mirth Newb
 
Join Date: Jun 2014
Posts: 16
mirraraenn is on a distinguished road
Post

I've attached here two captures from Wire Shark - One from a successful call without query parameters and a failed call with query parameters.
Attached Files
File Type: zip WireShark Captures.zip (540.7 KB, 9 views)
Reply With Quote
  #5  
Old 08-28-2014, 11:26 AM
mirraraenn mirraraenn is offline
Mirth Newb
 
Join Date: Jun 2014
Posts: 16
mirraraenn is on a distinguished road
Smile

Please let me know as well if there are any filters that would be useful to run in Wire Shark based on the circumstances. I've filtered on port 443 because that's where the traffic resides, but if there is anything else that could be used to narrow the field then I will re-run the captures. Thanks again for all your help Narupley.
Reply With Quote
  #6  
Old 08-28-2014, 12:19 PM
mirraraenn mirraraenn is offline
Mirth Newb
 
Join Date: Jun 2014
Posts: 16
mirraraenn is on a distinguished road
Default

Updated progress on troubleshooting; what we've found is that the error hinges on the presence of the equals = sign. When trying the same URL, but with encoded equals sign it succeeds, but disregards the query parameter.

Fails
Code:
https://hostname/v1/contextPath/resourceName?since=1407871630,1
Succeeds, but REST API doesn't use query parameter
Code:
https://hostname/v1/contextPath/resourceName?since%3D1407871630%2C1
Reply With Quote
  #7  
Old 08-28-2014, 12:43 PM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,099
narupley is on a distinguished road
Default

Those captures don't make sense. The one that says "without query parameters" actually does have HTTP requests with query parameters, and those appear to be perfectly successful:



The second one that says "with query parameters" doesn't have any HTTP requests at all:

__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #8  
Old 08-28-2014, 12:44 PM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,099
narupley is on a distinguished road
Default

Quote:
Originally Posted by mirraraenn View Post
Updated progress on troubleshooting; what we've found is that the error hinges on the presence of the equals = sign. When trying the same URL, but with encoded equals sign it succeeds, but disregards the query parameter.

Fails
Code:
https://hostname/v1/contextPath/resourceName?since=1407871630,1
Succeeds, but REST API doesn't use query parameter
Code:
https://hostname/v1/contextPath/resourceName?since%3D1407871630%2C1
How do you know it's the equals sign? Have you tried just encoding the comma?

Code:
https://hostname/v1/contextPath/resourceName?since=1407871630%2C1
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #9  
Old 08-28-2014, 01:06 PM
mirraraenn mirraraenn is offline
Mirth Newb
 
Join Date: Jun 2014
Posts: 16
mirraraenn is on a distinguished road
Default

Quote:
Originally Posted by narupley View Post
Those captures don't make sense. The one that says "without query parameters" actually does have HTTP requests with query parameters, and those appear to be perfectly successful:



The second one that says "with query parameters" doesn't have any HTTP requests at all:

The URLs you have for the first filter aren't the ones that the HTTP connector is performing a GET on, that may be just regular browser traffic. I'm worried that the reason you're seeing zero requests in the second trace is because the request is failing to leave Mirth at all.

I've sent the bare bones channel that exhibits the behavior in an email to the Mirth Support address so you can test yourself. It has all the right settings to make a successful call in a third party REST client tool, but not in the Mirth channel because of the exception.
Reply With Quote
  #10  
Old 08-28-2014, 01:18 PM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,099
narupley is on a distinguished road
Default

There are literally no other HTTP requests in the first trace, those two were the only ones. Unless... you haven't decrypted any TLS traffic? There's no way for anyone to see the actual requests if they're still encrypted.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
Reply

Tags
exception, http sender, null pointer exception, query parameter

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 10:51 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation