I am getting error while trying to POSt data to servicenow instance using REST API (Table API)

Artemis15
Kilo Guru

I am using the same code to develop a program to post data to snow demo instance.

 

URL : http://wiki.servicenow.com/index.php?title=Table_API_Java_Examples#POST

 

I'm getting status 404 and stream closed error.

 

find_real_file.png

 

Please help me in this issue.

1 ACCEPTED SOLUTION

Artemis15
Kilo Guru

Thanks Kalaiarasan and Chandan for your valuable reply.



I found out the mistake in the code. It's because of a jar file which is accidentally closing the buffer before connecting to SNOW instance.


View solution in original post

15 REPLIES 15

Kalaiarasan Pus
Giga Sage

does the user account has the needed credentials ?


Chandan23
Tera Expert


Can you use below and go through the output:


catch(IOException ioe)
     
{ ioe.printStackTrace();
     
}


Artemis15
Kilo Guru

Thanks Kalaiarasan and Chandan for your valuable reply.



I found out the mistake in the code. It's because of a jar file which is accidentally closing the buffer before connecting to SNOW instance.


sumukh
Kilo Expert

Hi Akash,



I am getting a similar error. Can you tell me which jar file was causing the issue?



IOException: Connection reset by peer: socket write error


java.net.SocketException: Connection reset by peer: socket write error


at java.net.SocketOutputStream.socketWrite0(Native Method)


at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)


at java.net.SocketOutputStream.write(SocketOutputStream.java:136)


at com.sun.net.ssl.internal.ssl.OutputRecord.writeBuffer(OutputRecord.java:297)


at com.sun.net.ssl.internal.ssl.OutputRecord.write(OutputRecord.java:286)


at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecordInternal(SSLSocketImpl.java:748)


at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:736)


at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:89)


at java.io.BufferedOutputStream.write(BufferedOutputStream.java:105)


at org.apache.commons.httpclient.WireLogOutputStream.write(WireLogOutputStream.java:68)


at org.apache.commons.httpclient.methods.multipart.FilePart.sendData(FilePart.java:223)


at org.apache.commons.httpclient.methods.multipart.Part.send(Part.java:312)


at org.apache.commons.httpclient.methods.multipart.Part.sendParts(Part.java:385)


at org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity.writeRequest(MultipartRequestEntity.java:164)


at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:499)


at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2114)


at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1096)


at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)


at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)


at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)


at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)