Hi,
I need to build up a web service using java. I am using,
Netbeans 5.5.1
JDK 1.5
is there any thing else that i should plug in to my project environment apart from this to build up a web service.
and i am very new to java web services. so please help by providing any tutorial that i can start over, with Netbeans.
12 2887
Hi,
I need to build up a web service using java. I am using,
Netbeans 5.5.1
JDK 1.5
is there any thing else that i should plug in to my project environment apart from this to build up a web service.
and i am very new to java web services. so please help by providing any tutorial that i can start over, with Netbeans.
Yep, you need at least a Servlet container such as Tomcat. Servlets handle
http requests and supply dynamically created html responses.
good luck and
kind regards,
Jos
Hi,
I need to build up a web service using java. I am using,
Netbeans 5.5.1
JDK 1.5
is there any thing else that i should plug in to my project environment apart from this to build up a web service.
and i am very new to java web services. so please help by providing any tutorial that i can start over, with Netbeans.
If that's ur urgent requirement then I won't comment anything.
But if you are doing it for learning purpose, then I would rather say, first expertize on web applications. Web services is quite a broad term, and if u are new to java, then u will be lost.
The sequence of learning should be (according to me),
1. Expertize core java field.
2. Expertize Web applications field.
3. Get introduced to (very basic) Web Component development field (EJBs) (optional, but will help in understanding many things.) (I myself am not much introduced to this field).
4. Then come to Web services field.
See wikipedia Link for web services.
Yep, you need at least a Servlet container such as Tomcat. Servlets handle
http requests and supply dynamically created html responses.
good luck and
kind regards,
Jos
Thank you so much jos.
Both these application servers available in my machine.
Tom cat 5.5.17
Sun java system application server 9
I am sorry I didn't mention it in my original post.
I went through this tutorial sample application. http://qa.netbeans.org/modules/j2ee/.../hello_ws.html
and build the sample application as they have mentioned.
Web service is here.
package org.netbeans.end2end.hellosample; - import javax.jws.HandlerChain;
-
import javax.jws.WebMethod;
-
import javax.jws.WebService;
-
import javax.jws.WebParam;
-
-
@WebService(serviceName="GreeterWs")
-
@HandlerChain(name = "HelloWebService_handlerChain", file = "HelloWebService_handler.xml")
-
public class HelloWebService
-
{
-
/**
-
* Web service operation
-
*/
-
@WebMethod(operationName="sayHi")
-
public String operation(@WebParam(name="name")String param)
-
{
-
// TODO implement operation
-
return "Hi"+ param;
-
}
-
@WebMethod()
-
public String sayHello(String s)
-
{
-
// TODO implement operation
-
return "Hello"+ s;
-
}
-
-
}
-
message handler is here with some errors. -
package org.netbeans.end2end.hellosample;
-
-
import java.util.Collections;
-
import java.util.Set;
-
import javax.xml.namespace.QName;
-
import javax.xml.soap.SOAPMessage;
-
import javax.xml.ws.handler.MessageContext;
-
import javax.xml.ws.handler.soap.SOAPHandler;
-
import javax.xml.ws.handler.soap.SOAPMessageContext;
-
-
-
public class MessageHandler implements SOAPHandler<SOAPMessageContext>
-
{
-
-
public boolean handleMessage(SOAPMessageContext messageContext)
-
{
-
//SOAPMessage msg = messageContext.getMessage();
-
log(messageContext);
-
return true;
-
}
-
-
private void log(SOAPMessageContext messageContext)
-
{
-
Boolean outcoming = (Boolean)
-
messageContext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
-
if(outcoming.booleanValue())
-
{
-
System.out.println("\nOutcoming Message:");
-
}else
-
{
-
System.out.println("\nIncoming Message:");
-
}
-
SOAPMessage message= messageContext.getMessage();
-
try{
-
message.writeTo(System.out);
-
System.out.println("\n");
-
}catch(Exception e)
-
{
-
System.out.println("Exception "+e);
-
}
-
}
-
-
}
-
-
C:\Sun\SDK\samples\javaee5\webservices\HelloWs\src \java\org\netbeans\end2end\hellosample\MessageHand ler.java:12: org.netbeans.end2end.hellosample.MessageHandler is not abstract and does not override abstract method getHeaders() in javax.xml.ws.handler.soap.SOAPHandler
public class MessageHandler implements SOAPHandler<SOAPMessageContext>
What is the reason here.
C:\Sun\SDK\samples\javaee5\webservices\HelloWs\src \java\org\netbeans\end2end\hellosample\MessageHand ler.java:12: org.netbeans.end2end.hellosample.MessageHandler is not abstract and does not override abstract method getHeaders() in javax.xml.ws.handler.soap.SOAPHandler
public class MessageHandler implements SOAPHandler<SOAPMessageContext>
What is the reason here.
Exactly what the compiler whines about : your class implements the interface
SOAPHandler; that implies that your class is either abstract or not. If your
class is abstract your class doesn't need to implement all methods declared
in that interface. Your class isn't abstract so it should implement all methods
declared in the interface but it doesn't: method getHeaders() is a method from
that interface but your class doesn't implement it.
kind regards,
Jos
Fantastic jos. Now i got a clear idea.Thanks.
oops But I failed to solve the problem.
I used the netbeans wizard to create this message handler.
File -> new file -> web services -> message Handler
and add the coding as in the tutorial that i used. http://qa.netbeans.org/modules/j2ee/...reatingHandler
Did i missed something in my coding. - package org.netbeans.end2end.hellosample;
-
-
import java.util.Collections;
-
import java.util.Set;
-
import javax.xml.namespace.QName;
-
import javax.xml.soap.SOAPMessage;
-
import javax.xml.ws.handler.MessageContext;
-
import javax.xml.ws.handler.soap.SOAPHandler;
-
import javax.xml.ws.handler.soap.SOAPMessageContext;
-
-
-
public class MessageHandler implements SOAPHandler<SOAPMessageContext>
-
{
-
-
public boolean handleMessage(SOAPMessageContext messageContext)
-
{
-
log(messageContext);
-
return true;
-
}
-
-
private void log(SOAPMessageContext messageContext)
-
{
-
Boolean outcoming = (Boolean)
-
messageContext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
-
if(outcoming.booleanValue())
-
{
-
System.out.println("\nOutcoming Message:");
-
}else
-
{
-
System.out.println("\nIncoming Message:");
-
}
-
SOAPMessage message= messageContext.getMessage();
-
try{
-
message.writeTo(System.out);
-
System.out.println("\n");
-
}catch(Exception e)
-
{
-
System.out.println("Exception "+e);
-
}
-
}
-
-
}
http://www.netbeans.org/kb/55/websvc-jax-ws.html
Let me know whether this sample is working or not.
I failed with first one now second one also not working.
i made it as they mentioned but getting this error. - init:
-
deps-module-jar:
-
deps-ear-jar:
-
deps-jar:
-
library-inclusion-in-archive:
-
library-inclusion-in-manifest:
-
compile:
-
compile-jsps:
-
do-dist:
-
dist:
-
In-place deployment at D:\NetBeans\WS\CalculatorWSApplication\build\web
-
Start registering the project's server resources
-
Finished registering server resources
-
moduleID=CalculatorWSApplication
-
deployment started : 0%
-
Deploying application in domain failed; com.sun.tools.apt.Main.process(Lcom/sun/mirror/apt/AnnotationProcessorFactory;[Ljava/lang/String;)I
-
D:\NetBeans\WS\CalculatorWSApplication\nbproject\build-impl.xml:453: Deployment error:
-
The module has not been deployed.
-
See the server log for details.
-
BUILD FAILED (total time: 1 second)
line number 453 under build-impl.xml as like this. - <target name="-run-deploy-nb" if="netbeans.home">
-
<nbdeploy debugmode="false" clientUrlPart="${client.urlPart}" forceRedeploy="${forceRedeploy}"/>
-
</target>
Hi Guys,
Sorry for struggling with this. I really need your help.
I tried lots of tutorial all over the net. but only thing what i can do with them,
I can build the project with Netbeans 5.5.
Once i tried to deploy it to the web container deployment error appears. - Deploying application in domain failed; com.sun.tools.apt.Main.process(Lcom/sun/mirror/apt/AnnotationProcessorFactory;[Ljava/lang/String;)I
-
D:\NetBeans\firstcup-dukes-age\nbproject\build-impl.xml:453: Deployment error:
-
The module has not been deployed.
-
See the server log for details.
-
BUILD FAILED (total time: 5 seconds)
And the server log is here: - Exception occured in J2EEC Phase
-
java.lang.NoSuchMethodError: com.sun.tools.apt.Main.process(Lcom/sun/mirror/apt/AnnotationProcessorFactory;[Ljava/lang/String;)I
-
at com.sun.tools.ws.wscompile.CompileTool.buildModel(CompileTool.java:605)
-
at com.sun.tools.ws.wscompile.CompileTool.run(CompileTool.java:538)
-
at com.sun.tools.ws.util.ToolBase.run(ToolBase.java:56)
-
at com.sun.tools.ws.util.WSToolsObjectFactoryImpl.wsgen(WSToolsObjectFactoryImpl.java:44)
-
at com.sun.enterprise.webservice.WsUtil.runWsGen(WsUtil.java:1820)
-
at com.sun.enterprise.webservice.WsUtil.genWSInfo(WsUtil.java:2089)
-
at com.sun.enterprise.deployment.backend.ModuleDeployer.loadDescriptors(ModuleDeployer.java:396)
-
at com.sun.enterprise.deployment.backend.WebModuleDeployer.deploy(WebModuleDeployer.java:155)
-
at com.sun.enterprise.deployment.backend.ModuleDeployer.doRequestFinish(ModuleDeployer.java:160)
-
at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:169)
-
at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:95)
-
at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:871)
-
at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:266)
-
at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:739)
-
at com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:174)
-
at com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:210)
-
What is this com.sun.tools.apt.Main.process() why i am getting same error for all the web services samples.?
I'm no web/servlet guru by any means but those exceptions smell like an
installation/configuration error. When the system can't find one of its own
components something is rotten in the state of Denmark.
I apologize for not having a pre-cooked solution for you but if I were you I'd
check the installation of it all. I had to do that once, using Tomcat, and it was
a mess, I can tell you that.
best of luck and
kind regards,
Jos
Hi Guys,
Sorry for struggling with this. I really need your help.
I tried lots of tutorial all over the net. but only thing what i can do with them,
I can build the project with Netbeans 5.5.
Once i tried to deploy it to the web container deployment error appears. - Deploying application in domain failed; com.sun.tools.apt.Main.process(Lcom/sun/mirror/apt/AnnotationProcessorFactory;[Ljava/lang/String;)I
-
D:\NetBeans\firstcup-dukes-age\nbproject\build-impl.xml:453: Deployment error:
-
The module has not been deployed.
-
See the server log for details.
-
BUILD FAILED (total time: 5 seconds)
And the server log is here: - Exception occured in J2EEC Phase
-
java.lang.NoSuchMethodError: com.sun.tools.apt.Main.process(Lcom/sun/mirror/apt/AnnotationProcessorFactory;[Ljava/lang/String;)I
-
at com.sun.tools.ws.wscompile.CompileTool.buildModel(CompileTool.java:605)
-
at com.sun.tools.ws.wscompile.CompileTool.run(CompileTool.java:538)
-
at com.sun.tools.ws.util.ToolBase.run(ToolBase.java:56)
-
at com.sun.tools.ws.util.WSToolsObjectFactoryImpl.wsgen(WSToolsObjectFactoryImpl.java:44)
-
at com.sun.enterprise.webservice.WsUtil.runWsGen(WsUtil.java:1820)
-
at com.sun.enterprise.webservice.WsUtil.genWSInfo(WsUtil.java:2089)
-
at com.sun.enterprise.deployment.backend.ModuleDeployer.loadDescriptors(ModuleDeployer.java:396)
-
at com.sun.enterprise.deployment.backend.WebModuleDeployer.deploy(WebModuleDeployer.java:155)
-
at com.sun.enterprise.deployment.backend.ModuleDeployer.doRequestFinish(ModuleDeployer.java:160)
-
at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:169)
-
at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:95)
-
at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:871)
-
at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:266)
-
at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:739)
-
at com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:174)
-
at com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:210)
-
What is this com.sun.tools.apt.Main.process() why i am getting same error for all the web services samples.?
It's usually advisable to test the installation using one of their test projects that they provide with their programs. Have you been able to deploy the project before?
Thank you guys,
When I build other web Application (Not web services), Netbeans allows me to build, deploy projects successfully.
And i used the tutorial samples under sun/netbeans for Web sevices.
Ok I'll remove the J2SE and J2EE from the system and NB also.
Will be right back after a fresh installation.
Hi,
I reinstalled JDK and netbeans.
Current configurations: -
C:\>java -version
-
java version "1.5.0"
-
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
-
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)
Netbeans 5.5.1 under this location: http://www.netbeans.info/downloads/start.php http://us1.mirror.netbeans.org/downl..._1-windows.exe
And I didn't update the IDE for any other add-ons using update manager.
Now the problem is different than previous one.
I tried this sample application. http://qa.netbeans.org/modules/j2ee/.../hello_ws.html
Again once i come up with deploy it getting this error.
under Output-HelloWs window: - init:
-
deps-module-jar:
-
deps-ear-jar:
-
deps-jar:
-
library-inclusion-in-archive:
-
library-inclusion-in-manifest:
-
wsgen-init-nonJSR109:
-
wsgen-HelloWebService-nonJSR109:
-
Exception in thread "main" java.lang.NoSuchMethodError: com.sun.tools.apt.Main.process(Lcom/sun/mirror/apt/AnnotationProcessorFactory;[Ljava/lang/String;)I
-
at com.sun.tools.ws.wscompile.WsgenTool.buildModel(WsgenTool.java:175)
-
at com.sun.tools.ws.wscompile.WsgenTool.run(WsgenTool.java:102)
-
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
-
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
-
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
-
at java.lang.reflect.Method.invoke(Method.java:585)
-
at com.sun.tools.ws.Invoker.invoke(Invoker.java:100)
-
at com.sun.tools.ws.WsGen.main(WsGen.java:38)
-
Command invoked: wsgen "C:\Program Files\Java\jdk1.5.0\jre\bin\java.exe" -Djava.endorsed.dirs=${jaxws.endorsed.dir} -classpath "C:\Program Files\Java\jdk1.5.0\lib\tools.jar;D:\NetBeans\HelloWs\build\web\WEB-INF\classes;C:\Program Files\netbeans-5.5.1\ide7\modules\ext\jaxws21\activation.jar;C:\Program Files\netbeans-5.5.1\ide7\modules\ext\jaxws21\FastInfoset.jar;C:\Program Files\netbeans-5.5.1\ide7\modules\ext\jaxws21\http.jar;C:\Program Files\netbeans-5.5.1\ide7\modules\ext\jaxws21\api\jaxb-api.jar;C:\Program Files\netbeans-5.5.1\ide7\modules\ext\jaxws21\jaxb-impl.jar;C:\Program Files\netbeans-5.5.1\ide7\modules\ext\jaxws21\jaxb-xjc.jar;C:\Program Files\netbeans-5.5.1\ide7\modules\ext\jaxws21\api\jaxws-api.jar;C:\Program Files\netbeans-5.5.1\ide7\modules\ext\jaxws21\jaxws-rt.jar;C:\Program Files\netbeans-5.5.1\ide7\modules\ext\jaxws21\jaxws-tools.jar;C:\Program Files\netbeans-5.5.1\ide7\modules\ext\jaxws21\api\jsr173_api.jar;C:\Program Files\netbeans-5.5.1\ide7\modules\ext\jaxws21\api\jsr181-api.jar;C:\Program Files\netbeans-5.5.1\ide7\modules\ext\jaxws21\jsr250-api.jar;C:\Program Files\netbeans-5.5.1\ide7\modules\ext\jaxws21\api\saaj-api.jar;C:\Program Files\netbeans-5.5.1\ide7\modules\ext\jaxws21\saaj-impl.jar;C:\Program Files\netbeans-5.5.1\ide7\modules\ext\jaxws21\sjsxp.jar;C:\Program Files\netbeans-5.5.1\ide7\modules\ext\jaxws21\stax-ex.jar;C:\Program Files\netbeans-5.5.1\ide7\modules\ext\jaxws21\streambuffer.jar" com.sun.tools.ws.WsGen -d D:\NetBeans\HelloWs\build\web\WEB-INF\classes -keep -wsdl -r D:\NetBeans\HelloWs\build\generated\wsgen\service -s D:\NetBeans\HelloWs\build\generated\wsgen\service org.netbeans.end2end.hellosample.HelloWebService
-
D:\NetBeans\HelloWs\nbproject\build-impl.xml:303: wsgen failed
-
BUILD FAILED (total time: 0 seconds)
-
web service -
package org.netbeans.end2end.hellosample;
-
-
import javax.jws.HandlerChain;
-
import javax.jws.WebMethod;
-
import javax.jws.WebParam;
-
import javax.jws.WebService;
-
-
@WebService(serviceName="GreeterWs")
-
@HandlerChain(name = "HelloWebService_handlerChain", file = "HelloWebService_handler.xml")
-
public class HelloWebService
-
{
-
@WebMethod(operationName="sayHi")
-
public String operation(@WebParam(name="name")String param)
-
{
-
return "Hi" + param;
-
}
-
-
@WebMethod
-
public String sayHello(String s)
-
{
-
return "Hello" +s;
-
}
-
-
-
}
-
Message Handler - package org.netbeans.end2end.hellosample;
-
-
import java.util.Collections;
-
import java.util.Set;
-
import javax.xml.namespace.QName;
-
import javax.xml.soap.SOAPMessage;
-
import javax.xml.ws.handler.MessageContext;
-
import javax.xml.ws.handler.soap.SOAPHandler;
-
import javax.xml.ws.handler.soap.SOAPMessageContext;
-
-
-
public class MessageHandler implements SOAPHandler<SOAPMessageContext>
-
{
-
-
-
public boolean handleMessage(SOAPMessageContext messageContext)
-
{
-
//SOAPMessage msg = messageContext.getMessage();
-
log(messageContext);
-
return true;
-
}
-
private void log(SOAPMessageContext messageContext)
-
{
-
Boolean outcoming = (Boolean)
-
messageContext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
-
if(outcoming.booleanValue())
-
{
-
System.out.println("\nOutcoming Message:");
-
}else
-
{
-
System.out.println("\nIncoming Message:");
-
}
-
SOAPMessage message= messageContext.getMessage();
-
try{
-
message.writeTo(System.out);
-
System.out.println("\n");
-
}catch(Exception e)
-
{
-
System.out.println("Exception "+e);
-
}
-
}
-
-
public Set<QName> getHeaders()
-
{
-
return Collections.EMPTY_SET;
-
}
-
-
public boolean handleFault(SOAPMessageContext messageContext)
-
{
-
return true;
-
}
-
-
public void close(MessageContext context)
-
{
-
}
-
-
}
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: asj |
last post by:
Just when I say web services may be hyped, here comes a news report
that says Swedish Referendum Results will be delivered in real time
over the internet using Java web services.
In one sense,...
|
by: asj |
last post by:
BIG news from the web services front. Amazon will use web services to
tie all its vendors together. The company implementing the system will
be using Java/C++ (migrating to all-java later).
...
|
by: wawa_piggy |
last post by:
My .net application is to consume a Java web services exposed using
AXIS.
The web service will extract the user name and password to perform some
custom authentication.
/** Java **/
userId =...
|
by: BestofAbhi |
last post by:
I am consuming Java Web Services in .NET. The Java Web Services have been
coded using Apache Axis.
The binding style in the WSDL is 'Document' and type is 'Literal'.
I have added these Java...
|
by: Abhijit Salvi |
last post by:
I am consuming Java Web Services in .NET. The Java Web Services have
been coded using Apache Axis.
The binding style in the WSDL is 'Document' and type is 'Literal'.
I have added these Java...
|
by: John |
last post by:
I have WSDL file with <wsdl:fault> element. When I use Websphere WSAD
to generate Java proxy classes from WSDL, I am able to see the custom
exception classes that correspond to the <wsdl:fault>...
|
by: datagrep |
last post by:
>From solution design and offshore software development to outsourcing
application support and improvement, Datagrep's offers a compelling
alternative to minimize software development costs, and...
|
by: bugnthecode |
last post by:
Hi,
I am trying to put together a small app that uses one of my company's
web service. Originally I interfaced with this web service using java,
and have the example code. I believe the web...
|
by: Laxmikumar |
last post by:
Iam new to web services, Iam using net beans-5.5.1 IDE
whlie deploying the web service application the following error is occured.
can anyone help me..??? please.
init:
deps-module-jar:...
|
by: vani1987 |
last post by:
Hi,
I'm new to the web services. I've to call the two java web services from other network system from classic ASP page. There are two java webservices are hosted in one server and this ASP...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |