Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!

revathi kurum

Ranch Hand
+ Follow
since Dec 04, 2013
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by revathi kurum

thanks what means i need to expose to customers that data only
6 years ago
Hi

i have xml-outout now i need to import to jsp page by using checkboxes, help

Thanks
6 years ago
thanks actually i want soap web-services please help
6 years ago
Hi good morning,

My question is how to access various 3rd party services(events.con, career.com, indeed.com)in server side actually i tried single services its working in clent side, but how i can access various services in servlet and its should go to clent as a single response.
6 years ago
Hi,

Actually i created webservices if i will test this webservices it will give WSDL file by using that one i can get the result in client(phonegap)



package sss;

import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

/**
*
* @author Compaq
*/
@WebService()
public class Job {

/**
* Web service operation
*/
@WebMethod(operationName = "carrer")
public String carrer(@WebParam(name = "L")
String L) throws IOException, ParserConfigurationException, SAXException
{

StringBuilder str=new StringBuilder();
//out.println("Hai");

try
{

URL url = new URL("http://api.careerbuilder.com/v1/jobsearch?DeveloperKey=WDH36716NGKGL3VVCDN8&locationcity="+L);

URLConnection uconn=url.openConnection();

HttpURLConnection conn=(HttpURLConnection)uconn;

conn.connect();

Object content=conn.getContent();

InputStream stream=(InputStream) content;

DocumentBuilderFactory docBuilderFactory=DocumentBuilderFactory.newInstance();

DocumentBuilder docBuilder=docBuilderFactory.newDocumentBuilder();

Document doc=docBuilder.parse(stream);

doc.getDocumentElement().normalize();

//str.append("<career>");

NodeList joblist=doc.getElementsByTagName("JobSearchResult");

for(int i=0;i<joblist.getLength();i++)

{

Node job=joblist.item(i);

if(job.getNodeType()== Node.ELEMENT_NODE){

Element firstPersonElement=(Element)job;

NodeList companytag=firstPersonElement.getElementsByTagName("Company");

Element com_name=(Element)companytag.item(0);

NodeList textComList=com_name.getChildNodes();

NodeList titletag = firstPersonElement.getElementsByTagName("JobTitle");

Element title_name = (Element) titletag.item(0);

NodeList textTitleList = title_name.getChildNodes();

NodeList didtag = firstPersonElement.getElementsByTagName("DID");

Element did_text = (Element) didtag.item(0);

NodeList textDidList = did_text.getChildNodes();

String title = ((Node) textTitleList.item(0)).getNodeValue().replaceAll("&","a");

String company = ((Node) textComList.item(0)).getNodeValue().replaceAll("&","a");

String did = ((Node) textDidList.item(0)).getNodeValue().replaceAll("&","a");

// str.append("<br>"+title+"<br>"+company+"<br>"+did);

//str.append("<results>");

// str.append("<jobtitle>");

str.append(company);

//str.append(title);

// str.append(System.getProperty("line.separator"));

// str.append("</jobtitle>");

// str.append("<company>");

// str.append(company);

//str.append(System.getProperty("line.separator"));

// str.append("</company>");

// str.append("<jobid>");

// str.append(did);

// str.append(System.getProperty("line.separator"));

// str.append("</jobid>");

// str.append("</results>");

}

}

}catch(Exception e){

System.out.println(e);

}

//str.append("</career>");

// out.println(str.toString());

String data=str.toString();



return data;
}
}

problem is its showing error in server i mean it will not come any WSDL file like below showing error


Exceptions details : null
java.lang.NullPointerException at java.io.File.(File.java:222) at org.glassfish.webservices.monitoring.WebServiceTesterServlet.initializePort(WebServiceTesterServlet.java:505) at org.glassfish.webservices.monitoring.WebServiceTesterServlet.doGet(WebServiceTesterServlet.java:165) at org.glassfish.webservices.monitoring.WebServiceTesterServlet.invoke(WebServiceTesterServlet.java:100) at org.glassfish.webservices.JAXWSServlet.doGet(JAXWSServlet.java:195) at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97) at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:239) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57) at com.sun.grizzly.ContextTask.run(ContextTask.java:69) at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330) at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309) at java.lang.Thread.run(Thread.java:619)


Thanks advance
6 years ago
I posted servlet and phone gap codes how i will get result in phonegap what type code i can add please help me


Thanks
6 years ago
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter pw = response.getWriter();
String location = request.getParameter("textLocation");
String keyword = request.getParameter("textKeyword");

String typeofurl = request.getParameter("typeofurl");


if(typeofurl.equalsIgnoreCase("careerbuilder")){
System.out.println("career builder");
URL url = new URL("http://api.careerbuilder.com/v1/jobsearch?DeveloperKey=WDH36716NGKGL3VVCDN8&keyword="+keyword+"&PerPage=10&Location="+location);
InputStream i = url.openStream();
DataInputStream d = new DataInputStream(new BufferedInputStream(i));
String s =null;
boolean flag = true;
while((s = dis.readLine())!= null){
if(flag){
pw.println("<table width=300 border=0>");
flag = false;
}
if(s.contains("<Company>")){
pw.println("<tr><td><h2><br/>"+getXMLValueFromTag(s)+"</h2></td></tr>");
}else if(s.contains("<EmploymentType>")){
pw.println("<tr><td>"+getXMLValueFromTag(s)+"</br>");
}else if(s.contains("<Location>")){
pw.println(getXMLValueFromTag(s)+"</br>");
}else if(s.contains("<JobTitle>")){
pw.println(getXMLValueFromTag(s)+"</br></td></tr>");
}
}
pw.println("</table>");
is.close();
6 years ago
$.ajax({
type : 'POST',
url : 'http://10.0.2.2:7070/server/Jdbc', // Servlet URL
data:{
uname:uname,
pwd:pwd,
},
success : function(data) {
if("SUCCESS"==data){
alert("Login Success!!");
} else {
alert("Invalid Login!!");
}
},
6 years ago
Hi

Normally i created one servlet page now how can i get the result in phone gap please suggest me
6 years ago
like that it is showing

Dec 24, 2013 9:39:57 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Dec 24, 2013 9:39:57 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Dec 24, 2013 3:13:49 PM org.apache.catalina.core.ApplicationContext log
INFO: Marking servlet Carrer as unavailable
Dec 24, 2013 3:13:49 PM org.apache.catalina.core.ApplicationContext log
SEVERE: Error loading WebappClassLoader
context: /Event_Client
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@1fee6fc
Job.Carrer
java.lang.ClassNotFoundException: Job.Carrer
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1095)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:809)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)
Dec 24, 2013 3:13:49 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Allocate exception for servlet Carrer
java.lang.ClassNotFoundException: Job.Carrer
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1095)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:809)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)
Dec 24, 2013 3:17:20 PM org.apache.catalina.core.StandardWrapperValve invoke
INFO: Servlet Carrer is currently unavailable
Dec 24, 2013 3:17:39 PM org.apache.catalina.core.StandardWrapperValve invoke
INFO: Servlet Carrer is currently unavailable
Dec 24, 2013 3:18:38 PM org.apache.catalina.core.StandardWrapperValve invoke
INFO: Servlet Carrer is currently unavailable
Dec 24, 2013 3:21:23 PM org.apache.catalina.core.StandardWrapperValve invoke
INFO: Servlet Carrer is currently unavailable
6 years ago