Apply with LinkedIn: data-url is not working

27 posts / 0 new
Last post
Anil Kumar K's picture
Joined: 07/20/2011
Thu, 07/28/2011 - 07:47
Apply with LinkedIn: data-url is not working

Hi,
I am using Apply with LinkedIn plugin in my web application.

Getting profiles immediately if using data-email="email@company.com"
But not getting any data in server with data-url

For my web application using following environment
Java, Spring framework

Following code is added in JSP
in Head tag:
<script type="text/javascript" src="http://platform.linkedin.com/in.js">
api_key: Valid API key
</script>

in Body tag,
<script type="IN/Apply"
data-companyid="1195173"
data-jobtitle="Sr Mobile web tester"
data-joblocation="Horsham, PA"
data-url="http://localhost:8000/iMomentous/rest/jobPostingXml" data-urlFormat="xml">
</script>

I can see the button "Apply with LinkedIn" in browser whenever the JSP executed.
Not getting any data in the server after submitting the application.

The following code is using to handle to the input stream.

@RequestMapping(value = "/rest/jobPostingXml", method = RequestMethod.POST)
public String getLiXML(HttpServletRequest req, HttpServletResponse resp) {
log.info("getLiXML in");
try{
String postBody = IOUtils.toString(req.getInputStream(), "UTF-8");
// to do
}catch (Exception e) {
log.error("error occured while getLiXML: "+e);
}
return "xml";
}

Any mistake in my code to handle the LinkedIn profile XML.

Thanks,
Anil K

Jonathan Seitel's picture
Developer Advocate
Joined: 02/03/2011
Thu, 07/28/2011 - 11:07

I notice that you're pointing data-url to a localhost address. This isn't going to work because your endpoint has to be reachable by LinkedIn servers. If you move it to a publicly accessible location, it will probably work.

Best,
Jon

Eugene O&#039;Neill's picture
Developer Advocate
Joined: 01/07/2011
Thu, 07/28/2011 - 12:49

Check out LocalTunnel

One of our engineers recently introduced me to this service. It allows you to create a publicly reachable URL that points to your localhost instance. Pretty nifty for testing purposes and it should work for you.

Let us know if it works for you.

Anil Kumar K's picture
Joined: 07/20/2011
Fri, 07/29/2011 - 08:51

Thanks guys, Its working on public accessible.

I integrated in one of my development application.
http://officeteam.imomentous.com

some of job links from my site:
http://officeteam.imomentous.com/OfficeTeam/jobdescription.html?did=J3G0LG61L0VFF3G522V
http://officeteam.imomentous.com/OfficeTeam/jobdescription.html?did=J3F7386VMJVRGSX5GXP
http://officeteam.imomentous.com/OfficeTeam/jobdescription.html?did=J3I7ZZ6QF8BVPJGPNNL

I have 2 more major issues:
1. pop-up of profile (Application submission) is not mobile compatible
2. After getting user profile I am redirecting to another page(Thankyou), Its not working

Queries are:
1. How to customize the profile pop-up based on device resolution.
2. Why redirection is not working after submit the application

Is there any solutions for above things ...?

Jonathan Seitel's picture
Developer Advocate
Joined: 02/03/2011
Fri, 07/29/2011 - 09:43

Hi Anil,
Thanks for the feedback. For mobile, we'll need to design an experience that's optimized for smaller form-factors -- definitely something we'll look into in the future.

For your redirect, how are you trying to do it? The way I've seen it done is to use data-onSuccess and set window.location from the callback.

Best,
Jon

joseph iruafemi's picture
Joined: 07/30/2011
Sat, 07/30/2011 - 20:19

Hi,

I seem to be having issues with receiving the POST from linkedin after application has been submitted. Is the data-url required to be the same url as the page on which the user applied for the job?

data-email is working as expected.

Thanks for your help.

Anil Kumar K's picture
Joined: 07/20/2011
- (Reply to #6) Mon, 08/01/2011 - 01:26

Hi Joseph,

I am also working the data-url, Its need not be same.
Few points from experience.

1. the page which you are adding should be public accessible.
2.The code which you are writing to handle POST response from LinkedIn should properly respond.

Observe the following links:
http://officeteam.imomentous.com/OfficeTeam/jobdescription.html?did=J3G0LG61L0VFF3G522V

http://officeteam.imomentous.com/OfficeTeam/jobdescription.html?did=J3I2MK5WMNTVTKWRRMS

The code for plugin and POST response (in Java)
In Head tag
<script src="js/iemobile.js"></script>
<script type="text/javascript" src="http://platform.linkedin.com/in.js">
api_key: valid API key
</script>
In Body tag,
<script type="IN/Apply"
data-companyid="company id"
data-jobtitle="job title"
data-joblocation="job location"
data-url="http://officeteam.imomentous.com/OfficeTeam/rest/jobPostingXml" data-urlFormat="xml">
</script>

Java method: to handle post response
@RequestMapping(value = "/rest/jobPostingXml", method = RequestMethod.POST)
public String getLiXML(HttpServletRequest req, HttpServletResponse resp) {

try{
String postBody = IOUtils.toString(req.getInputStream(), "UTF-8");
System.out.println(postBody );
}catch (Exception e) {
//
}
return "thankyou";
}

I think above code will give you some clarification on data-url in Apply with LinkedIn.

Thanks,
ANIL K

Anil Kumar K's picture
Joined: 07/20/2011
- (Reply to #5) Mon, 08/01/2011 - 02:53

Thanks Jonathan, for your reply.

For redirection I added data-onSuccess, but its not executing/calling the JavaScript function
when closing the profile pop-up after submitting the application
some job links:
http://officeteam.imomentous.com/OfficeTeam/jobdescription.html?did=J3I8DP5YY2ZDYFSDHPT

http://officeteam.imomentous.com/OfficeTeam/jobdescription.html?did=J3F6646KR5L171YZGVF

http://officeteam.imomentous.com/OfficeTeam/jobdescription.html?did=J3I3ZG73GXJJGPSFXY6

We are providing for mobile solutions for different job recruiting ATS. so we are hoping for customized pop-up in future.

Thanks,
ANIL K

Jonathan Seitel's picture
Developer Advocate
Joined: 02/03/2011
Mon, 08/01/2011 - 13:51

Hi Anil,
In your demo page, it looks like you spelled your function incorrectly when you defined it near the end of the file (with three "s" characters). Once you fix that, it should work fine.

Joseph, let us know if you're still having problems.

Thanks,
Jon

Anil Kumar K's picture
Joined: 07/20/2011
Thu, 08/04/2011 - 06:30

Thanks Jonathan,

I corrected function name, it working fine..

Thanks,
ANIL K

Jeremy Johnstone's picture
Developer Advocate
Joined: 04/17/2011
- (Reply to #10) Thu, 08/04/2011 - 10:35

Awesome! Thanks for letting us know!

-Jeremy

Joined: 09/28/2011
Wed, 10/12/2011 - 04:26

Hi,
I am having issues with receiving the POST from linkedin after application has been submitted.I have written the following code to get the plugin and to handle with POST response.

Code for generating plugin:
<script src="http://platform.linkedin.com/in.js" type="text/javascript">
api_key: Valid API key
</script>
<script type="IN/Apply" data-jobid="202963" data-companyid="613812" data-jobtitle="technical analyst" data-joblocation="Hyderabad"
data-url="http://ldemo.wisestep.com/Dev/ApplyWithLinkedInResponse.aspx"
data-phone="optional" data-coverletter="optional" data-size="medium">
</script>

Code to handle Response:
using (MemoryStream ms = new MemoryStream())
{
while (true)
{
int read = Request.InputStream.Read(buffer, 0, 5000);
if (read <= 0)
{
responseString = Encoding.UTF8.GetString(ms.ToArray());
break;
}

ms.Write(buffer, 0, read);
}
}
JavaScriptSerializer serializer = new JavaScriptSerializer();
var application = serializer.DeserializeObject(responseString);
But i am unable to get the response.Plz let me know if am missing something or written something wrong.
Thank you
Nirod Kumar Panda

Jeremy Johnstone's picture
Developer Advocate
Joined: 04/17/2011
Wed, 10/12/2011 - 13:22

Hi Nirod,

Have you tried logging responseString to see if the problem is in your deserialization or in the string you are reading in?

-Jeremy

Joined: 09/12/2011
Thu, 10/13/2011 - 08:36

Hi,

We have been successfully using the data-url attribute for capturing xml from LinkedIn however when using a non standard port for reply, the reply is never received.

eg http:\\externalIP:11000\apply\linkedin

Is there any known issue with this approach? Is the only option Host Headers?

Jeremy Johnstone's picture
Developer Advocate
Joined: 04/17/2011
Thu, 10/13/2011 - 09:12

Is that the URL you are providing to the data-url attribute? If so, that's the problem, not the port number. :)

The URL should be: http://externalIP:11000/apply/linkedin

Joined: 09/12/2011
Thu, 10/13/2011 - 09:35

My mistake & wish it was that easy and appreciate the quick response :)

http://***.***.**.***:11000/Apply/LinkedIn"

The forward slash are true forward slashes. As said, when the port number is left off and the application is run under a site with port 80 there is no issue. When the application is run under the site with port 11000, nothing. The port 11000 is open and receives http posts however nothing is ever received for the data-url from LinkedIn (debugging within VS2010)....I will be trying with host headers tomorrow but as this will be port 80 I do not see an issue but would like to know if there is an issue with the extra port attribute for reference...

Thanks

Jeremy Johnstone's picture
Developer Advocate
Joined: 04/17/2011
Mon, 10/17/2011 - 12:20

Hi Anthony,

I am surprised this fails then. I'll follow up with our engineering team for clarification.

-Jeremy

Steven Citron-Pousty's picture
Joined: 08/02/2011
Thu, 12/08/2011 - 11:54

Gerald:
Please give us a more complete description of your problem. Can you also please provide a url for the apply page and for the service that should be receiving the post.

Did you troubleshoot the problem using the helpful steps that Anil gives in response to Joseph?

I would also like to reccomend you actually start a new thread rather than adding to this one. It will make our discussion clearer .
Thanks
Steve

Will Redd's picture
Joined: 09/26/2011
Wed, 12/21/2011 - 22:45

I noticed the same issue described by Anthony Sessions - specifying a data-url that has a non-standard HTTP port means that no POST is received from LinkedIn (the port is open to the world), while using the standard port 80 works as expected. Using a data-url with an explicit port 80 also works (i.e. http:/some-domain.com:80/some-path), so I don't think URL parsing is the problem.

I can work around this, but it might make life easier for future developers to note this limitation (or better yet, eliminate it).

Jeremy Johnstone's picture
Developer Advocate
Joined: 04/17/2011
Mon, 01/02/2012 - 11:24

Hi Will,

I'll reach out to the team and see if this was added for a security reason or if it's just a lack in functionality on our end.

Thanks!

-Jeremy

Bishnubrata Panigrahi's picture
Joined: 03/16/2011
Tue, 02/21/2012 - 03:52

Hi,

I have the same issue like Nirod Kumar Panda (#12),
I am not able to receive the HTTP Post to my page even after successfully applying.
Here is my code snippets:

<script type="text/javascript" src="http://platform.linkedin.com/in.js">
api_key: API_KEY
</script>

<script type="IN/Apply"
data-companyname="BisComp"
data-jobTitle="Though developer 25BR"
data-url="http://dev.PublicURL.com/maestroweb/startworkflow.aspx"
data-urlFormat="xml"
data-onclick="myOnclickFunction"
data-onsuccess="myOnsucesssFunction" >

</script>
<script type="text/javascript">
function myOnclickFunction(r) {
alert("click");
}
function myOnsucesssFunction(r) {
alert("success");
}
</script>

here both the alerts are firing properly.

Here is my Server side code for parsing the response:
byte[] buffer = new byte[5000];
string responseString;

using (MemoryStream ms = new MemoryStream())
{
while (true)
{
int read = Request.InputStream.Read(buffer, 0, 5000);
if (read <= 0)
{
responseString = Encoding.UTF8.GetString(ms.ToArray());
break;
}

ms.Write(buffer, 0, read);
}
}

Here the issue is my page is never called by LinkedIn and this code is never executed.. :(

Please suggest.

Thanks,
Bishnu.

Steven Citron-Pousty's picture
Joined: 08/02/2011
Tue, 02/21/2012 - 09:34

Greetings Bishnu:
Are you sure you are not getting a response on your server? Can you please just log a message whenever that ASPX page is called?
Thanks
Steve

Joined: 01/26/2012
Tue, 03/06/2012 - 03:24

Hi all,
I'm getting the same issue when using ports 8081 & 8082. I cant use port 80 as thats used for something else. my code is very similar to #21 except i use port 8082

My data-url is a page on my machine, which is running port mapped in my router as internal.mydomain.com:8082/LinkedInHandler.ashx

I've added code to write the response to a text file & can see text when i post to the page from a test page i have set up, but LinkedIn never posts to my URL.
I thought perhaps it was due to the port i've specified (8082) so used a URL shortener goo.gl but still the same issue. Is it not possible to use a custom port as I've done, or do i need to do something differently?

<script type="IN/Apply" data-companyid="123456" data-jobtitle="Chief Cat Wrangler"
data-joblocation="London" data-themecolor="#f16522" data-url="internal.mydomain.com:8082/LinkedInHandler.ashx"
data-onsuccess="myOnsuccessFunction">
</script>

Jeremy Johnstone's picture
Developer Advocate
Joined: 04/17/2011
Tue, 03/06/2012 - 20:31

Hi Bill,

Please do not post the same post in multiple threads. The same people are replying to all and duplicating just causes us extra work (thus slowing down responses for everyone).

-Jeremy

Bishnubrata Panigrahi's picture
Joined: 03/16/2011
Sun, 03/11/2012 - 01:19

Hi,

Thanks Steve.
Now page is logging the message when ever it is called from LinkedIn.

Now i am all set.

Thanks,
Bishnu.

Nishad Rahman  [LION 3000+]'s picture
Joined: 03/04/2012
Thu, 05/10/2012 - 05:54

Hello Anil,
I am having trouble implementing this. The data-url just does not get triggered. any clue what is wrong ?

<script src="//platform.linkedin.com/in.js" type="text/javascript">
api_key: myapikeyhere
</script>
<script type="IN/Apply" data-companyname="doctorsbooking" data-jobtitle="Marketing" data-joblocation="Bangalore" data-logo="http://doctorsbooking.com/logo.png" data-phone="required" data-url="http://www.doctorsbooking.com/apply/index.php" ></script>

Michael Plunkett's picture
Joined: 05/09/2011
Tue, 05/15/2012 - 08:55

My data-url is not being pinged at all either - checked web logs and nothing. The page containing the "Apply with LinkedIn" button does require a login - could this be the culprit?

** Edit: I created a test page that was public-facing and still didn't get a ping to my data-url. **