Visit the main Crossref website

HTTP post --- urgent help

I am new to crossref I am working for e-publishing. I have a task to push data to crossref automatically via HTTP post.

When I post the data via an HTTP post, I am getting 200 responses.

host: https://doi.crossref.org/servlet/deposit

But the article is not reflected in the cross-ref site

Here, I have copied the HTTP postcode for your reference,

public HashMap<String, Object> crossrefUploadTool(String metaFile, HashMap<String, Object> eachSpub)
throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException {

String metaFileName = new File(metaFile).getName();

HashMap<String, Object> responseObj = new HashMap<String, Object>();

SSLContext sslContext = SSLContextBuilder.create().loadTrustMaterial(new TrustSelfSignedStrategy()).build();
HostnameVerifier allowAllHosts = new NoopHostnameVerifier();
SSLConnectionSocketFactory connectionFactory = new SSLConnectionSocketFactory(sslContext, allowAllHosts);
CloseableHttpClient client = HttpClients.custom().setSSLSocketFactory(connectionFactory).build();

System.out.println(“redirectUri:::” + eachSpub.get(“host”));

org.apache.http.client.methods.HttpPost post;

String responseString = null;

try {

post = new org.apache.http.client.methods.HttpPost(eachSpub.get(“host”) + “?operation=doMDUpload?login_id=”

  • eachSpub.get(“username”) + “?” + “login_passwd=” + eachSpub.get(“password”));

post.setHeader(“Accept”, “image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, /”);

post.setHeader(“Content-Type”, “multipart/form-data;boundary=---------------------------7d22911b10028e”);

post.setHeader(“User-Agent”, “Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461)”);

post.setHeader(“Accept-Language”, “en-us”);

post.setHeader(“Content-Disposition”, “form-data; name=fname” + “; filename=” + metaFileName);

File file = new File(metaFile);

FileEntity entity = new FileEntity(file);

post.setEntity(entity);

CloseableHttpResponse postresponse = client.execute(post);

responseString = org.apache.http.util.EntityUtils.toString(postresponse.getEntity());

responseObj = (HashMap<String, Object>) Utils.stringToMap(responseString);

post.releaseConnection();

responseObj.put(“statusCode”, postresponse.getStatusLine().getStatusCode());

if (postresponse.getStatusLine().getStatusCode() == 200) {
responseObj.put(“response”, responseString);
} else {
responseObj.put(“response”, “400 Bad Request error”);
}
responseObj.put(“success”, 1);

System.out.println(“responseObj:::” + responseObj);
System.out.println(“responseString:::” + responseString);

client.close();

} catch (Exception e1) {
responseObj.put(“response”, true);
e1.printStackTrace();

}

return responseObj;
}

Hi, and thanks for your question.

I replied to your message in this post

Based on your instruction updated the user name, Now am getting the below response.

How do i ensure the data posted in cross-ref.

![](upload://xspAPEnjaGTMynnpZt5IwvyRs90.gif)

, success=1, statusCode=200}
responseString:::

![](upload://xspAPEnjaGTMynnpZt5IwvyRs90.gif)

I’m glad to see that worked!

statusCode 200 is a success message. That means your HTTPs POST did send the metadata deposits to our system for processing. It does not mean that the deposits were processed yet or that your DOIs were successfully registered.

After the deposits are processed, you can verify your deposit status by reviewing the submission log that is emailed to you (or to whichever email address was included in the <email_address> tags of the submitted xml) after your deposits are finished processing.

If you do not receive the submission log emails, you can also retrieve your logs using our system interface as described in our documentation site here Submission queue and log - Crossref

Here i have copied the submission log for your reference. I can see only last day manually pushed articles.

Again i tried in the morning 6th jan. none of the article uploaded via http post

If possible please share any sample code for http post. So that i will try with that .

Thanks in advance. Be blessed by divine.

There’s no way for us to tell which of your deposits were submitted via manual upload and which were submitted via https post.

There was at least one instance in which you submitted the same file twice. See submissions 1516933650 and 1516934078. The first was processed successfully and the second failed with a timestamp error, which is exactly what you’d expect if you submitted the same exact xml file twice in a row. Is it possible that one of those was the one you tried to send by https post?

We have sample submissions here.

1 Like

its good to hear from you. Now its working fine. Thank you so much for your support.

1 Like