Feb 27 2008
Creating SOAP Web Services with NetBeans 6


In this blog i will show you, how easily you can create Web Services with NetBeans 6. In further postings i will discuss how to manipulate the SOAP Message before the Web Service Operation is called.
For this example i am using JAX-WS 2.1 with NetBeans 6.0 .
Web Services Description Language (WSDL)
There are many ways how to get starting with Web Services. One variant is beginning with the creation of the WSDL. First, you must know what the Web Service should do. You have to consider what is the input and output of each Web Service Operation. In our example we have only one Operation, named as “getcalculateValues“. The input are two numbers, the result is only the sum of both.
Create these two files for our example:
webservices.wsdl
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <definitions xmlns:ns1="soapwebservices.jdevelop.eu" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:ns="http://schemas.xmlsoap.org/soap/encoding/" name="SOAPWebServices" targetNamespace="soapwebservices.jdevelop.eu"> <types> <xsd:schema> <xsd:import namespace="soapwebservices.jdevelop.eu" schemaLocation="webservices.xsd"/> </xsd:schema> </types> <message name="calculateValues"> <part name="calculateValues" element="ns1:calculateValues"/> </message> <message name="calculateValuesResponse"> <part name="calculateValuesResponse" element="ns1:calculateValuesResponse"/> </message> <portType name="SOAPWebServices"> <operation name="getCalculateValues"> <input message="ns1:calculateValues"/> <output message="ns1:calculateValuesResponse"/> </operation> </portType> <binding name="SOAPWebServicesPortBinding" type="ns1:SOAPWebServices"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="getCalculateValues"> <soap:operation soapAction="urn:http://blog.jdevelop.eu/services/getCalculateValues"/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> </binding> <service name="SOAPService"> <port name="WebServices" binding="ns1:SOAPWebServicesPortBinding"> <soap:address location="http://blog.jdevelop.eu:80/services"/> </port> </service> </definitions>
webservices.xsd
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <xs:schema xmlns:ns1="http://blog.jdevelop.eu/soapwebservices.xsd" xmlns:tns="soapwebservices.jdevelop.eu" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="soapwebservices.jdevelop.eu" version="1.0"> <xs:element name="calculateValues"> <xs:complexType> <xs:sequence> <xs:element name="value1" type="xs:decimal"/> <xs:element name="value2" type="xs:decimal"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="calculateValuesResponse"> <xs:complexType> <xs:sequence> <xs:element name="result" type="xs:decimal"/> <xs:element name="errormessage" type="xs:string" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
Create the NetBeans application
Start your NetBeans 6 and create a new “Web Application” -Project.
![]()
Name it “SOAPWebServices“, clear the “Context Path” and click “Finish“.
![]()
Now goto “File->New File->Web Services” and choose “Web Service from WSDL“.
If this menu is missing, you need to install the “Web Service Plugin” (Tools->Plugins->Available Plugins).
![]()
Enter the Web Service Name “ServiceImpl“, use “eu.jdevelop.soapwebservices.service” as
the package-name and browse to the file “webservices.wsdl“, which you have created in the previous step.
![]()
After pressing “Finish”, you will see this screen:
![]()
It’s now time to change the url-pattern. Open the file “sun-jaxws.xml” and exchange the url-pattern with “/soapwebservices“.
![]()
![]()
Do the same with the file “web.xml“.
![]()
![]()
Go ahead to the file “index.jsp” and insert in the “body“-tag:
<jsp:forward page="soapwebservices"></jsp:forward>
![]()
Your Dummy-Web Service is now ready for testing. Rightclick on the projectname and choose “Clean and Build“.
![]()
After that, click on “run“.
![]()
Browse to the url “http://localhost:8084” to see the result.
![]()
You can see the WSDL and the XML-Schema.
![]()
![]()
It’s now time to insert the business-logic. Add the following java classes to recieve this package-structure:
![]()
ServiceImpl.java
package eu.jdevelop.soapwebservices.service;
import eu.jdevelop.soapwebservices.CalculateValues;
import eu.jdevelop.soapwebservices.CalculateValuesResponse;
import eu.jdevelop.soapwebservices.SOAPWebServices;
import eu.jdevelop.soapwebservices.wrapper.impl.CalculateValuesWrapper;
import javax.jws.WebService;
/**
* This is the Service-Implementation of the Web Service. Here are the
* operations which can be called from web clients.
*
* @author Siegfried Bolz
*/
@WebService(serviceName = "SOAPService", portName = "WebServices", endpointInterface = "eu.jdevelop.soapwebservices.SOAPWebServices", targetNamespace = "soapwebservices.jdevelop.eu", wsdlLocation = "WEB-INF/wsdl/ServiceImpl/webservices.wsdl")
public class ServiceImpl implements SOAPWebServices {
public CalculateValuesResponse getCalculateValues(CalculateValues calculateValues) {
try {
CalculateValuesWrapper wrapper = new CalculateValuesWrapper();
return wrapper.getResult(calculateValues);
} catch (Exception x) {
throw new IllegalStateException(x);
}
}
} // .EOF
ILogic.java
package eu.jdevelop.soapwebservices.logic;
/**
* Use this interface to create logic-implementations for
* each web service operation.
*
* @author Siegfried Bolz
*/
public interface ILogic<t, V> {
public T doAction(V var)
throws Exception;
} // .EOF
CalculateValuesLogic.java
package eu.jdevelop.soapwebservices.logic.impl;
import eu.jdevelop.soapwebservices.CalculateValues;
import eu.jdevelop.soapwebservices.CalculateValuesResponse;
import eu.jdevelop.soapwebservices.logic.ILogic;
import java.math.BigDecimal;
/**
* This implementation is normaly used for executing operations.
* Here we calculate some values.
*
* @author Siegfried Bolz
*/
public class CalculateValuesLogic implements ILogic<calculateValuesResponse, CalculateValues>{
public CalculateValuesResponse doAction(CalculateValues var) throws Exception {
CalculateValuesResponse response = new CalculateValuesResponse();
try {
/**
* Simple addition of two values
*/
BigDecimal value1 = var.getValue1();
BigDecimal value2 = var.getValue2();
double sum = value1.doubleValue() + value2.doubleValue();
response.setResult(BigDecimal.valueOf(sum));
} catch (Exception x) {
/**
* On errors, return a valid bean with values. Do not send null!
*/
CalculateValuesResponse errorResponse = new CalculateValuesResponse();
errorResponse.setResult(BigDecimal.valueOf(0.0));
errorResponse.setErrormessage("An error has occurred!");
return errorResponse;
}
return response;
}
} // .EOF
IWrapper.java
package eu.jdevelop.soapwebservices.wrapper;
/**
* Use this interface to create wrapper-implementations for
* each web service operation.
*
* @author Siegfried Bolz
*/
public interface IWrapper<t, V> {
public T getResult(V var)
throws Exception;
} // .EOF
CalculateValuesWrapper.java
package eu.jdevelop.soapwebservices.wrapper.impl;
import eu.jdevelop.soapwebservices.CalculateValues;
import eu.jdevelop.soapwebservices.CalculateValuesResponse;
import eu.jdevelop.soapwebservices.logic.impl.CalculateValuesLogic;
import eu.jdevelop.soapwebservices.wrapper.IWrapper;
/**
* The wrapper calls the logic-implementation. Exchange or modify
* the wrapper if you want to use other logic-implementations.
*
* @author Siegfried Bolz
*/
public class CalculateValuesWrapper implements IWrapper<calculateValuesResponse, CalculateValues>{
public CalculateValuesResponse getResult(CalculateValues var) throws Exception {
CalculateValuesLogic logic = new CalculateValuesLogic();
return logic.doAction(var);
}
} // .EOF
When you are finished, you should see something similar in the Files-View:
![]()
Testing
Download, install and start “soapui” from http://www.soapui.org. Import the soapui-projectfile “SOAPWebServices-soapui-project.xml” (located in the example).
Open “Request1” and submit the request (click the green arrow).
![]()
Congratulations, your Web Service is now running 
Possible Problem
If you get the error:
Caused by: java.lang.LinkageError: JAXB 2.0 API is being loaded from the bootstrap classloader, but this RI (from jar: file:/C:/temp/SOAPWebServices/build/web/WEB-INF/lib/jaxb-impl.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.class) needs 2.1 API. Use the endorsed directory mechanism to place jaxb-api.jar in the bootstrap classloader. (See http://java.sun.com/j2se/1.5.0/docs/guide/standards/)
This means, that your JAX-WS version is newer than the JAXB 2.0 and JAX-WS 2.0 versions, which are part of JDK 6.
To solve this problem, just copy all JARs from $NETBEANS_HOME/java1/modules/ext/jaxws21/api/ to $TOMCAT_INSTALL_DIR/endorsed/ (the directory “endorsed” must be created if it doesn’t exist).
![]()
For further informations, look at http://wiki.netbeans.org/FaqEndorsedDirTomcat
Downloads
NetBeans 6 Project: download
69 responses so far
[...] Creating SOAP Web Services with NetBeans 6 — Another Random Developer Blog, 2/27 Developer Siegfried Boltz posts a detailed tutorial [...]
Hi, this is interesting. I wondering how I can manipulate the SOAP Header. I am doing some security stuff with SAML, I need to add the nodes to SOAP header and manipulate them in both the client side and server.
Hello,
I’m almost done running this tutorial but I’m stack at the part
“Download, install and start “soapui” from http://www.soapui.org. Import the soapui-projectfile “SOAPWebServices-soapui-project.xml” (located in the example). ”
Where exactly is this xml file?
Other than that, everything up to that point has been good.
Any comments would be appreciated.
Thanks.
Hello Jonathan,
if you extract the file “soapwebservices.zip”, the SOAPUI-File is located in the directory “/soapui” .
best regards
Siegfried
I got the same problem. Unfortunately, I couldn’t locate the file “soapwebservices.zip” you mentioned. Are we supposed to download it somewhere?
Thanks for your help.
Hello Tuan,
at the end of this blog-entry is the download-link located.
http://blog.jdevelop.eu/downloads/soapwebservices/soapwebservices.zip
Thank you so much. It works now.
Hello Siegfried,
Nice article here, it worked fine for me. But now I am at the point where I have to add Security and RM to my WS. With a WS generated bottom up it works fine but I have some problems adding Security and RM to the WS generated from WSDL. I click the WS in Netbeans, check the Security and RM properties, but the dont show up in the WSDL on the server after deploying. Did you have any similar problem and how did you sove it?
Cheers
Arne
Hello Arne,
my experience in adding Security is, that it is only working with GlassFish v2 (if you are using the NetBeans-features). But i haven’t done too much with Security (using VPN is easier). I am planning to do more research in this area.
Regards,
Siegfried
Hello Siegfried,
I am a raw beginner in NetBeans. Could you please tell me which files to customize if I want to send a WORD as the request and then receive the charecters of the word in an ARRAY in the response??
Thanks in advance.
Susovan
Hello Susovan,
first you have to modify the WSDL with the Schema. Rebuild the project to generate new Beans. After that you have to modify the ServiceImpl.java .
Take a look on “Table 1” at http://java.sun.com/developer/technicalArticles/WebServices/high_performance/ to see which Primitives are possible with JAX-WS 2.0
Hi Siegfried,
I was trying to run you example but I stuck after importing WSDL file. I managed to generate classes and create the blue backgound with the method name but failed to compile it.
I have got the following error during the compilation:
javac -d D:Documents and Settingsmirza.jahicMy DocumentsNetBeansProjectsWebServiceAppbuildgeneratedwsimportbinaries -classpath C:Program FilesJavajdk1.5.0_15libtools.jar;C:beaweblogic92serverlibweblogic.jar;C:beaweblogic92commonlibapache_xbean.jar;C:beaweblogic92serverlibschemaweblogic-container-binding.jar;C:beaweblogic92serverlibschemaweblogic-domain-binding.jar;C:beaweblogic92serverlibschemadiagnostics-binding.jar;C:beaweblogic92serverlibschemadiagnostics-image-binding.jar;C:beaweblogic92serverlibwlcipher.jar;C:beaweblogic92serverlibjsafe.jar;C:beaweblogic92serverlibwebservices.jar;C:beaweblogic92serverlibxmlx.jar;C:beaweblogic92serverlibojdbc14.jar;C:beaweblogic92serverlibjconn2.jar;C:beaweblogic92serverlibjconn3.jar;C:beaweblogic92serverlibjConnect.jar;C:beaweblogic92serverlibcssjdkutils.jar;C:beaweblogic92serverlibcssapi.jar;C:beaweblogic92serverlibcssimpl.jar;C:beaweblogic92serverlibengapi.jar;C:beaweblogic92serverlibengimpl.jar;C:beaweblogic92serverlibEccpressoAsn1.jar;C:beaweblogic92serverlibEccpressoCore.jar;C:beaweblogic92serverlibEccpressoJcae.jar;C:beaweblogic92serverlibantant.jar;C:beaweblogic92serverlibantant-nodeps.jar;C:beaweblogic92serverlibantant-antlr.jar;C:beaweblogic92serverlibantant-jakarta-bcel.jar;C:beaweblogic92serverlibantant-junit.jar;C:beaweblogic92serverlibantant-vaj.jar;C:beaweblogic92serverlibantant-apache-bsf.jar;C:beaweblogic92serverlibantant-jakarta-log4j.jar;C:beaweblogic92serverlibantant-launcher.jar;C:beaweblogic92serverlibantant-weblogic.jar;C:beaweblogic92serverlibantant-apache-resolver.jar;C:beaweblogic92serverlibantant-jakarta-oro.jar;C:beaweblogic92serverlibantant-netrexx.jar;C:beaweblogic92serverlibantant-xalan1.jar;C:beaweblogic92serverlibantant-commons-logging.jar;C:beaweblogic92serverlibantant-jakarta-regexp.jar;C:beaweblogic92serverlibantant-xalan2.jar;C:beaweblogic92serverlibantant-commons-net.jar;C:beaweblogic92serverlibantant-javamail.jar;C:beaweblogic92serverlibantant-starteam.jar;C:beaweblogic92serverlibantant-xslp.jar;C:beaweblogic92serverlibantant-contrib-1.0b1.jar;C:beaweblogic92serverlibantant-jdepend.jar;C:beaweblogic92serverlibantant-stylebook.jar;C:beaweblogic92serverlibantant-icontract.jar;C:beaweblogic92serverlibantant-jmf.jar;C:beaweblogic92serverlibantant-swing.jar;C:beaweblogic92serverlibantant-jai.jar;C:beaweblogic92serverlibantant-jsch.jar;C:beaweblogic92serverlibantant-trax.jar;C:beaweblogic92serverlibantjakarta-oro-2.0.7.jar;C:beaweblogic92serverlibantcommons-net-1.1.0.jar;C:beaweblogic92serverlibwlbase.jar;C:beaweblogic92serverlibwlutil.jar;C:beaweblogic92serverlibwlsqlserver.jar;C:beaweblogic92serverlibwldb2.jar;C:beaweblogic92serverlibwlsybase.jar;C:beaweblogic92serverlibwloracle.jar;C:beaweblogic92serverlibwlinformix.jar;C:beaweblogic92serverlibwlw-langx.jar;C:beaweblogic92javelinlibjavelinx.jar;C:beaweblogic92javelinlibbcel-5.1.jar;C:beaweblogic92commonlibwlw-util.jar;C:beaweblogic92serverlibxbean.jar;C:beaweblogic92serverliblogkitlogkit.jar;C:beaweblogic92commonlibpdev.jar;C:beaweblogic92commonlib;C:beaweblogic92commonlib3rdparty.jar;C:beaweblogic92commonlibplugin-wizard.jar;C:beaweblogic92commonlibcomdev.jar;C:beaweblogic92commonlibwizard.jar;C:beaweblogic92commonlibplugin.jar;C:beaweblogic92commonliboxy-cci.jar;C:beaweblogic92commonlibconfig.jar;C:beaweblogic92commonlibwlw-plaf.jar;C:beaweblogic92commonlibupgradecommon-plugin.jar;C:beaweblogic92commonlibjython.jar;C:beaweblogic92serverlibdebugging.jar;C:beaweblogic92serverlibwlw-system.jar;C:beaweblogic92serverlibjcom.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21activation.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21FastInfoset.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21http.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21apijaxb-api.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21jaxb-impl.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21jaxb-xjc.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21apijaxws-api.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21jaxws-rt.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21saaj-impl.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21sjsxp.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21resolver.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21stax-ex.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21streambuffer.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21jaxws-tools.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21apijsr173_api.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21apijsr181-api.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21apijsr250-api.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21apisaaj-api.jar -Xbootclasspath/p:C:Program FilesNetBeans 6.0.1java1modulesextjaxws21apijaxws-api.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21apijaxb-api.jar D:Documents and Settingsmirza.jahicMy DocumentsNetBeansProjectsWebServiceAppbuildgeneratedwsimportserviceeujdevelopsoapwebservicesCalculateValues.java D:Documents and Settingsmirza.jahicMy DocumentsNetBeansProjectsWebServiceAppbuildgeneratedwsimportserviceeujdevelopsoapwebservicesCalculateValuesResponse.java D:Documents and Settingsmirza.jahicMy DocumentsNetBeansProjectsWebServiceAppbuildgeneratedwsimportserviceeujdevelopsoapwebservicesObjectFactory.java D:Documents and Settingsmirza.jahicMy DocumentsNetBeansProjectsWebServiceAppbuildgeneratedwsimportserviceeujdevelopsoapwebservicesSOAPService.java D:Documents and Settingsmirza.jahicMy DocumentsNetBeansProjectsWebServiceAppbuildgeneratedwsimportserviceeujdevelopsoapwebservicesSOAPWebServices.java D:Documents and Settingsmirza.jahicMy DocumentsNetBeansProjectsWebServiceAppbuildgeneratedwsimportserviceeujdevelopsoapwebservicespackage-info.java
D:Documents and Settingsmirza.jahicMy DocumentsNetBeansProjectsWebServiceAppbuildgeneratedwsimportserviceeujdevelopsoapwebservicesSOAPWebServices.java:35: cannot find symbol
symbol : method partName()
location: @interface javax.jws.WebParam
@WebParam(name = “calculateValues”, targetNamespace = “soapwebservices.jdevelop.eu”, partName = “calculateValues”)
D:Documents and Settingsmirza.jahicMy DocumentsNetBeansProjectsWebServiceAppbuildgeneratedwsimportserviceeujdevelopsoapwebservicesSOAPWebServices.java:33: cannot find symbol
symbol : method partName()
location: @interface javax.jws.WebResult
@WebResult(name = “calculateValuesResponse”, targetNamespace = “soapwebservices.jdevelop.eu”, partName = “calculateValuesResponse”)
2 errors
compilation failed, errors should have been reported
D:Documents and Settingsmirza.jahicMy DocumentsNetBeansProjectsWebServiceAppnbprojectjaxws-build.xml:24: wsimport failed
BUILD FAILED (total time: 33 seconds)
I’m using NetBeans 6.0.1 and JAX-WS 2.1.
Am I missing some jar file maybe or similar?
Otherwise, I think that the article is great and I hope to see followers with even more interesting examples.
Regards
Mirza
Hello Mirza,
when i look at the last error message:
D:Documents and Settingsmirza.jahicMy DocumentsNetBeansProjectsWebServiceAppnbprojectjaxws-build.xml:24: wsimport failed
it seems that something is wrong with the WSDL-file. Use the WSDL-file included in my example, don’t try to copy and paste it from this web page.
Have you tried to download and run my example? download
Hi,
Yes, I tried to copy and paste from the website. I’ll try to use files from download link.
Thanks
Mirza
Hi,
Same problem even if I used you WSDLs.
javac -d D:Documents and Settingsmirza.jahicMy DocumentsNetBeansProjectsWebServiceAppbuildgeneratedwsimportbinaries -classpath C:Program FilesJavajdk1.5.0_15libtools.jar;C:beaweblogic92serverlibweblogic.jar;C:beaweblogic92commonlibapache_xbean.jar;C:beaweblogic92serverlibschemaweblogic-container-binding.jar;C:beaweblogic92serverlibschemaweblogic-domain-binding.jar;C:beaweblogic92serverlibschemadiagnostics-binding.jar;C:beaweblogic92serverlibschemadiagnostics-image-binding.jar;C:beaweblogic92serverlibwlcipher.jar;C:beaweblogic92serverlibjsafe.jar;C:beaweblogic92serverlibwebservices.jar;C:beaweblogic92serverlibxmlx.jar;C:beaweblogic92serverlibojdbc14.jar;C:beaweblogic92serverlibjconn2.jar;C:beaweblogic92serverlibjconn3.jar;C:beaweblogic92serverlibjConnect.jar;C:beaweblogic92serverlibcssjdkutils.jar;C:beaweblogic92serverlibcssapi.jar;C:beaweblogic92serverlibcssimpl.jar;C:beaweblogic92serverlibengapi.jar;C:beaweblogic92serverlibengimpl.jar;C:beaweblogic92serverlibEccpressoAsn1.jar;C:beaweblogic92serverlibEccpressoCore.jar;C:beaweblogic92serverlibEccpressoJcae.jar;C:beaweblogic92serverlibantant.jar;C:beaweblogic92serverlibantant-nodeps.jar;C:beaweblogic92serverlibantant-antlr.jar;C:beaweblogic92serverlibantant-jakarta-bcel.jar;C:beaweblogic92serverlibantant-junit.jar;C:beaweblogic92serverlibantant-vaj.jar;C:beaweblogic92serverlibantant-apache-bsf.jar;C:beaweblogic92serverlibantant-jakarta-log4j.jar;C:beaweblogic92serverlibantant-launcher.jar;C:beaweblogic92serverlibantant-weblogic.jar;C:beaweblogic92serverlibantant-apache-resolver.jar;C:beaweblogic92serverlibantant-jakarta-oro.jar;C:beaweblogic92serverlibantant-netrexx.jar;C:beaweblogic92serverlibantant-xalan1.jar;C:beaweblogic92serverlibantant-commons-logging.jar;C:beaweblogic92serverlibantant-jakarta-regexp.jar;C:beaweblogic92serverlibantant-xalan2.jar;C:beaweblogic92serverlibantant-commons-net.jar;C:beaweblogic92serverlibantant-javamail.jar;C:beaweblogic92serverlibantant-starteam.jar;C:beaweblogic92serverlibantant-xslp.jar;C:beaweblogic92serverlibantant-contrib-1.0b1.jar;C:beaweblogic92serverlibantant-jdepend.jar;C:beaweblogic92serverlibantant-stylebook.jar;C:beaweblogic92serverlibantant-icontract.jar;C:beaweblogic92serverlibantant-jmf.jar;C:beaweblogic92serverlibantant-swing.jar;C:beaweblogic92serverlibantant-jai.jar;C:beaweblogic92serverlibantant-jsch.jar;C:beaweblogic92serverlibantant-trax.jar;C:beaweblogic92serverlibantjakarta-oro-2.0.7.jar;C:beaweblogic92serverlibantcommons-net-1.1.0.jar;C:beaweblogic92serverlibwlbase.jar;C:beaweblogic92serverlibwlutil.jar;C:beaweblogic92serverlibwlsqlserver.jar;C:beaweblogic92serverlibwldb2.jar;C:beaweblogic92serverlibwlsybase.jar;C:beaweblogic92serverlibwloracle.jar;C:beaweblogic92serverlibwlinformix.jar;C:beaweblogic92serverlibwlw-langx.jar;C:beaweblogic92javelinlibjavelinx.jar;C:beaweblogic92javelinlibbcel-5.1.jar;C:beaweblogic92commonlibwlw-util.jar;C:beaweblogic92serverlibxbean.jar;C:beaweblogic92serverliblogkitlogkit.jar;C:beaweblogic92commonlibpdev.jar;C:beaweblogic92commonlib;C:beaweblogic92commonlib3rdparty.jar;C:beaweblogic92commonlibplugin-wizard.jar;C:beaweblogic92commonlibcomdev.jar;C:beaweblogic92commonlibwizard.jar;C:beaweblogic92commonlibplugin.jar;C:beaweblogic92commonliboxy-cci.jar;C:beaweblogic92commonlibconfig.jar;C:beaweblogic92commonlibwlw-plaf.jar;C:beaweblogic92commonlibupgradecommon-plugin.jar;C:beaweblogic92commonlibjython.jar;C:beaweblogic92serverlibdebugging.jar;C:beaweblogic92serverlibwlw-system.jar;C:beaweblogic92serverlibjcom.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21activation.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21FastInfoset.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21http.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21apijaxb-api.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21jaxb-impl.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21jaxb-xjc.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21apijaxws-api.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21jaxws-rt.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21saaj-impl.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21sjsxp.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21resolver.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21stax-ex.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21streambuffer.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21jaxws-tools.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21apijsr173_api.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21apijsr181-api.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21apijsr250-api.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21apisaaj-api.jar -Xbootclasspath/p:C:Program FilesNetBeans 6.0.1java1modulesextjaxws21apijaxws-api.jar;C:Program FilesNetBeans 6.0.1java1modulesextjaxws21apijaxb-api.jar D:Documents and Settingsmirza.jahicMy DocumentsNetBeansProjectsWebServiceAppbuildgeneratedwsimportserviceeujdevelopsoapwebservicesCalculateValues.java D:Documents and Settingsmirza.jahicMy DocumentsNetBeansProjectsWebServiceAppbuildgeneratedwsimportserviceeujdevelopsoapwebservicesCalculateValuesResponse.java D:Documents and Settingsmirza.jahicMy DocumentsNetBeansProjectsWebServiceAppbuildgeneratedwsimportserviceeujdevelopsoapwebservicesObjectFactory.java D:Documents and Settingsmirza.jahicMy DocumentsNetBeansProjectsWebServiceAppbuildgeneratedwsimportserviceeujdevelopsoapwebservicesSOAPService.java D:Documents and Settingsmirza.jahicMy DocumentsNetBeansProjectsWebServiceAppbuildgeneratedwsimportserviceeujdevelopsoapwebservicesSOAPWebServices.java D:Documents and Settingsmirza.jahicMy DocumentsNetBeansProjectsWebServiceAppbuildgeneratedwsimportserviceeujdevelopsoapwebservicespackage-info.java
D:Documents and Settingsmirza.jahicMy DocumentsNetBeansProjectsWebServiceAppbuildgeneratedwsimportserviceeujdevelopsoapwebservicesSOAPWebServices.java:35: cannot find symbol
symbol : method partName()
location: @interface javax.jws.WebParam
@WebParam(name = “calculateValues”, targetNamespace = “soapwebservices.jdevelop.eu”, partName = “calculateValues”)
D:Documents and Settingsmirza.jahicMy DocumentsNetBeansProjectsWebServiceAppbuildgeneratedwsimportserviceeujdevelopsoapwebservicesSOAPWebServices.java:33: cannot find symbol
symbol : method partName()
location: @interface javax.jws.WebResult
@WebResult(name = “calculateValuesResponse”, targetNamespace = “soapwebservices.jdevelop.eu”, partName = “calculateValuesResponse”)
2 errors
compilation failed, errors should have been reported
D:Documents and Settingsmirza.jahicMy DocumentsNetBeansProjectsWebServiceAppnbprojectjaxws-build.xml:24: wsimport failed
BUILD FAILED (total time: 1 minute 23 seconds)
I guess , I have to take closer look to this problem.
Regards
Mirza
Hi,
It works now, I switched to Glass Fish 2 insted of weblogic. I tested it with SOAP UI and it looks ok.
Do you have any sample code to call this service from the JSP instead?
Thanks
Mirza
No i don’t have a sample code. If you want to call this web service from a JSP-file, use scriptlets to invoke the corresponding classes.
Thanks,
I fixed it , it works fine.
Mirza
Great, what was the problem?
Hi,
It seems that my weblogic server was not properly configured for web services , this was making problems during the compilation of you classes, so I switched to Glass Fish and same code compiled.
After testing it I chaged Index.jsp and added the code for calling your webservice from the jsp, it works fine. It would be great to see some example with security issues.
JSP Page
<%
try {
String value1 =request.getParameter(“value1″);
String value2 =request.getParameter(“value2″);
SOAPService service = new SOAPService();
eu.jdevelop.soapwebservices.SOAPWebServices port = service.getWebServices();
// TODO initialize WS operation arguments here
CalculateValues calculateValues = new CalculateValues();
calculateValues.setValue1(new BigDecimal(value1));
calculateValues.setValue2(new BigDecimal(value2));
// TODO process result here
CalculateValuesResponse result = port.getCalculateValues(calculateValues);
out.println(“Result = “+result.getResult()+”");
} catch (Exception ex) {
// TODO handle custom exceptions here
}
%>
Hello Siegfried,
Your post was very informative.
I am trying to create this example on Netbeans 5.1 but when I am trying to create the blank web service I am getting an error that says
“To create Web Services in this project, the java source level must be atleast jdk 1.5″
I am already using jdk 1.5
Do you have any idea what the problem could be?
Thanks in Advance
Debraj
Hello Debraj,
open the Project Properties, go to the Category “Source” and choose JDK5 at “Source/Binary Format”. Hope this was the solution for you.
Regards,
Siegfried
Hi,
Pls ignore my question above….. dint see the last comment…. Thanks a lot
Regards,
Jay
I have done Clean and build… but when I run… it says “Build of soapweservices (run) failed”
I have TomCat5 installed.
Please post an detailed error message from the NetBeans Output-console. Maybe there are some problems with Tomcat 5. Can you try Tomcat 6 to see if there is an error?
Deployment error:
Access to Tomcat server has not been authorized. Set the correct username and password with the “manager” role in the Tomcat customizer in the Server Manager.
See the server log for details.
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:166)
at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:104)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor285.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:277)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:460)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:151)
Caused by: java.lang.IllegalStateException: Access to Tomcat server has not been authorized. Set the correct username and password with the “manager” role in the Tomcat customizer in the Server Manager.
at org.netbeans.modules.tomcat5.TomcatManagerImpl.list(TomcatManagerImpl.java:389)
at org.netbeans.modules.tomcat5.TomcatManager.modules(TomcatManager.java:623)
at org.netbeans.modules.tomcat5.TomcatManager.getAvailableModules(TomcatManager.java:434)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.getAvailableTMIDsMap(TargetServer.java:331)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.checkUndeployForSharedReferences(TargetServer.java:287)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.checkUndeployForSharedReferences(TargetServer.java:236)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.checkUndeployForSharedReferences(TargetServer.java:233)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.processLastTargetModules(TargetServer.java:355)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.init(TargetServer.java:143)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.deploy(TargetServer.java:479)
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:151)
… 16 more
Caused by: org.netbeans.modules.tomcat5.AuthorizationException
at org.netbeans.modules.tomcat5.TomcatManagerImpl.list(TomcatManagerImpl.java:390)
… 26 more
BUILD FAILED (total time: 0 seconds)
This is the error message. How do i set the authentication ?
Open the file “tomcat-users.xml“, located in [APACHE-DIRECTORY]/conf and replace the content with this:
<?xml version=’1.0′ encoding=’utf-8′?>
<tomcat-users>
<role rolename=”manager”/>
<role rolename=”admin”/>
<user username=”manager” password=”manager” roles=”manager,admin”/>
</tomcat-users>
After this open in your NetBeans the Server-Konfiguration (Tools->Server) and enter “manager” as the new password for the role “manager“.
Now while building i get the following error
C:Jayesh-Pls dont deleteLearn JavaNetBeamSOAPWebServicesnbprojectjaxws-build.xml:11: taskdef class com.sun.tools.ws.ant.WsImport cannot be found
BUILD FAILED (total time: 0 seconds)
WsImport task is part of jaxws-tools.jar, which is part of JAX-WS 2.0 library in the IDE. You can also download it separately from https://jax-ws.dev.java.net/2.1.4/, or use the version from newest JDK 6 (just remove your old JDK and install the new one). Also note that if you’re using JAX-WS library you should also put JAXB library on the classpath.
An other option is to copy all JAX-WS file to the directory JAVA_HOME/jre/lib/endorsed. Take a look at the section Possible Problem at the end of this blog.
The easiest way is to install NetBeans 6.1 with jdk1.6.0_06 .
i have jdk1.6 installed. even tried copying endorsed folder to JRE/lib folder
Which jdk 6 version do you have installed? This bug was fixed with a version >1.6.3 . Also try Tomcat 6 or GlassFish 2.
I am using jdk1.6.0_06 and have added the JAX-WS library to the classpath. Let me try out with Tomcat 6.0 as well
the funny part is that previously and it was building without any errors but did not run bcoz tomcat 5 was not configured correctly. now the build itself is giving me issues.
I am able to build and run it but when it launchs in IE it gives me an error.
HTTP Status 404 – /soapwebservices/
——————————————————————————–
type Status report
message /soapwebservices/
description The requested resource (/soapwebservices/) is not available.
——————————————————————————–
Sun-Java-System/Web-Services-Pack-1.4
Have you removed the Context Path? click
yes the context path is removed.
I am trying to download ur code and deploy it on Glassfish
Let me see what happens :)
Still no go… following error comes up when I run it.
Deployment error:
The Sun Java System Application Server could not start.
More information about the cause is in the Server log file.
Possible reasons include:
– IDE timeout: refresh the server node to see if it’s running now.
– Port conflicts. (use netstat -a to detect possible port numbers already used by the operating system.)
– Incorrect server configuration (domain.xml to be corrected manually)
– Corrupted Deployed Applications preventing the server to start.(This can be seen in the server.log file. In this case, domain.xml needs to be modified).
– Invalid installation location.
See the server log for details.
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:166)
at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:104)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor47.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:277)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:460)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:151)
Caused by: org.netbeans.modules.j2ee.deployment.impl.ServerException: The Sun Java System Application Server could not start.
More information about the cause is in the Server log file.
Possible reasons include:
– IDE timeout: refresh the server node to see if it’s running now.
– Port conflicts. (use netstat -a to detect possible port numbers already used by the operating system.)
– Incorrect server configuration (domain.xml to be corrected manually)
– Corrupted Deployed Applications preventing the server to start.(This can be seen in the server.log file. In this case, domain.xml needs to be modified).
– Invalid installation location.
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance._start(ServerInstance.java:1297)
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.startTarget(ServerInstance.java:1251)
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.startTarget(ServerInstance.java:1062)
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.start(ServerInstance.java:939)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.startTargets(TargetServer.java:428)
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:143)
… 16 more
BUILD FAILED (total time: 7 minutes 40 seconds)
Corrupted Deployed Applications preventing the server to start.(This can be seen in the server.log file).
Open server.log and search for an deployment error.
Your problems are scary!
Hurray atlast it worked….. :)
I completely uninstalled Netbeans6.1 and reinstalled it. then did an update on Netbeans… downloaded all plugins… installed them ……. It works now.
Thanks a lot Siegfried….. appreciate ur help……….
Thanks Siegfried…. it works now.
I reinstalled netbeans 6.1 and then updated the plugins and it works now
Great job! So you can now enjoy all my tutorials. Have a lot of fun!
Hi Siegfried,
When I am about to change the url-pattern, I realized that the file “sun-jaxws.xml” is not there, and the content of “web.xml” is very short compare to what you have. Any reason why? Sorry I am new in this.
Regards,
Alex
Hi Alex,
have you followed all steps in this blog? NetBeans creates automatically both files for you. Perhaps, it is an NetBeans error. Try again all steps with NetBeans 6.1 .
Regards,
Siegfried
Hi Siegfried,
Yes, I followed every single step, and I am using NetBeans 6.1 currently. Still the same issue persists.
Regards,
Alex
Hi Siegfried,
I managed to get it works, somehow, but I am facing another issue. Basically, this is how my XML Schema looks like for output;
I managed to get the value from the “Response” and “ResponseDetail” elements but not to set the value.
This is how I set the value;
response.getDataResponse.get(0).setResponse(“100 – Failed”);
response.getDataResponse.get(0).setResponseDetail(“Structure incorrect”);
But I encountered “java.lang.IndexOutOfBoundExceptions: Index: 0, Size: 0
Can you give me some tips?
Regards,
Alex
Hello Alex,
could be a mismatch in the XML schema. Please post the created Java Response-File.
Regards,
Siegfried
Hi Siegfried,
I am not sure if you got my email, anyway, below is the Java Response-File.
package com.onsemi.middleware.ws;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* Java class for anonymous complex type.
*
* The following schema fragment specifies the expected content contained within this class.
*
*
* <complexType>
* <complexContent>
* <restriction base=”{http://www.w3.org/2001/XMLSchema}anyType”>
* <sequence>
* <element name=”UnitOfWork” maxOccurs=”unbounded” minOccurs=”0″>
* <complexType>
* <complexContent>
* <restriction base=”{http://www.w3.org/2001/XMLSchema}anyType”>
* <sequence>
* <element name=”ServiceResponse” type=”{http://www.w3.org/2001/XMLSchema}string”/>
* <element name=”ServiceResponseDetail” type=”{http://www.w3.org/2001/XMLSchema}string”/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
*
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = “”, propOrder = {
“unitOfWork”
})
@XmlRootElement(name = “centralDataResponse”)
public class CentralDataResponse {
@XmlElement(name = “UnitOfWork”)
protected List unitOfWork;
/**
* Gets the value of the unitOfWork property.
*
*
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a
setmethod for the unitOfWork property.*
*
* For example, to add a new item, do as follows:
*
* getUnitOfWork().add(newItem);
*
*
*
*
* Objects of the following type(s) are allowed in the list
* {@link CentralDataResponse.UnitOfWork }
*
*
*/
public List getUnitOfWork() {
if (unitOfWork == null) {
unitOfWork = new ArrayList();
}
return this.unitOfWork;
}
/**
* Java class for anonymous complex type.
*
* The following schema fragment specifies the expected content contained within this class.
*
*
* <complexType>
* <complexContent>
* <restriction base=”{http://www.w3.org/2001/XMLSchema}anyType”>
* <sequence>
* <element name=”ServiceResponse” type=”{http://www.w3.org/2001/XMLSchema}string”/>
* <element name=”ServiceResponseDetail” type=”{http://www.w3.org/2001/XMLSchema}string”/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
*
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = “”, propOrder = {
“serviceResponse”,
“serviceResponseDetail”
})
public static class UnitOfWork {
@XmlElement(name = “ServiceResponse”, required = true)
protected String serviceResponse;
@XmlElement(name = “ServiceResponseDetail”, required = true)
protected String serviceResponseDetail;
/**
* Gets the value of the serviceResponse property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getServiceResponse() {
return serviceResponse;
}
/**
* Sets the value of the serviceResponse property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setServiceResponse(String value) {
this.serviceResponse = value;
}
/**
* Gets the value of the serviceResponseDetail property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getServiceResponseDetail() {
return serviceResponseDetail;
}
/**
* Sets the value of the serviceResponseDetail property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setServiceResponseDetail(String value) {
this.serviceResponseDetail = value;
}
}
}
Regards,
Alex
Hello Alex,
i think i have solved your problem:
package testapp;
import com.onsemi.middleware.ws.CentralDataResponse;
import com.onsemi.middleware.ws.CentralDataResponse.UnitOfWork;
/**
*
* @author Siegfried Bolz
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
UnitOfWork unit = new UnitOfWork();
unit.setServiceResponse(“100 – Failed”);
unit.setServiceResponseDetail(“Structure incorrect”);
CentralDataResponse response = new CentralDataResponse();
response.getUnitOfWork().add(unit);
System.out.println(response.getUnitOfWork().get(0).getServiceResponse());
}
}
can you suggest me how to log all the events occuring in a web service which is created.
You can do this in the method “public CalculateValuesResponse getCalculateValues(CalculateValues calculateValues)“. For more detailed information take a look at my other blog How to modify JAX-WS SOAP-Messages. You can add your logging in the class ServerSOAPHandler.
sir i hav poblem in running weblogic 10 in netbeans6.1…..can any any one tell me how to run ..plz tell me
Sir, Thanks for your nice blog. I was trying to run the sample in Netbeans 6.1 with Weblogic 10; but getting doployment error. Can you please help me?
Regards,
Damodar…
Thanks Mr. Siegfried for this worthful article. But i have a problem now. I create the webservice same as following your steps but i when the last step comes where you clicks at run and my application get deployed over server nothing opens again http://localhost:8084. I have tried this address both on Opera and IExplorer but nothing returns. Also i changed the port number to 8080 but invain. Infact when i click run a web page opens over which i got the message that requested resource is not available. So please help me i m in great need. I will appreciate if you will solve my problem.
Thanks waiting 4 worthful reply..
Hello Dreamcatcher,
have you tried the full URL as displayed in this picture: click ? Don’t forget to add the context “soapwebservices” to the URL.
hi i got this error while running this application can u plz help me to solve this
Using CATALINA_BASE: C:Tomcat_6_0_14
Using CATALINA_HOME: C:Tomcat_6_0_14
Using CATALINA_TMPDIR: C:Tomcat_6_0_14temp
Using JRE_HOME: C:Program FilesJavajdk1.5.0_06
java.lang.NoClassDefFoundError: FilesJavajdk1/5/0_06libtools/jar;C:Tomcat_6_0_14binbootstrap/jar -Dcatalina/base=C:Tomcat_6_0_14 -Dcatalina/home=C:Tomcat_6_0_14 -Djava/io/tmpdir=C:Tomcat_6_0_14temp org/apache/catalina/startup/Bootstrap start
Exception in thread “main”
Starting of Tomcat failed.
Deployment error:
Starting of Tomcat failed.
See the server log for details.
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:163)
at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:104)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor374.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:277)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:460)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:151)
Caused by: org.netbeans.modules.j2ee.deployment.impl.ServerException: Starting of Tomcat failed.
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance._start(ServerInstance.java:1270)
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.startTarget(ServerInstance.java:1224)
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.startTarget(ServerInstance.java:1035)
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.start(ServerInstance.java:912)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.startTargets(TargetServer.java:417)
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:140)
… 16 more
BUILD FAILED (total time: 1 second)
Hi Mr. Siegfried
The above error came at deployment time only i m using tomcat 6.14 and jdk 1.5 it works fine in glass fish.i got a error in tomcat only.
Been through the tutorial four times, create a new project each time, using NetBeans 6.5.
It doesn’t create the sun-jaxws.xml file.
Hi there I have downloaded the free fersion of soapui but I cannot find from where to install it. There is no installation file that i can find. It should be build or what? Any ideas?
Hi
thanks lot for the article, it helps lot,
but if I use JBoss server without using Apache tomcat it is bit difficult. Can u tell me where I have to do the below step with JBOSS.
“It’s now time to change the url-pattern. Open the file “sun-jaxws.xml” and exchange the url-pattern with “/soapwebservices“.”
In JBOSS there wasn’t sun-jaxws.xml file (I searched, but couldnt find it).
Please help me
Thanks lot,
It worked like a charm for me, I am happy to use it, Thanks Siegfried Bolz , for this nice thing, Your article was no less than a movie download that we get as tutorials.
hi..
actually i have a big problem, i need to apply SOAP in my final year project for my final semester..the problem is to send the form through SOAP. but i doesn’t know how to start it..could you give some help to me..thaks
hello there !!!
i teste this class but i’ve got this probleme. :s
12:39:27,427 ERROR [STDERR] javax.xml.soap.SOAPException: SOAPEnvelope already has a header element
12:39:27,427 ERROR [STDERR] at org.jboss.ws.core.soap.SOAPEnvelopeImpl.addHeader(SOAPEnvelopeImpl.java:118)
12:39:27,427 ERROR [STDERR] at com.tritux.webservices.ServerSOAPHandler.handleMessage(ServerSOAPHandler.java:117)
12:39:27,427 ERROR [STDERR] at com.tritux.webservices.ServerSOAPHandler.handleMessage(ServerSOAPHandler.java:1)
12:39:27,427 ERROR [STDERR] at org.jboss.ws.core.jaxws.handler.HandlerChainExecutor.handleMessage(HandlerChainExecutor.java:305)
12:39:27,427 ERROR [STDERR] at org.jboss.ws.core.jaxws.handler.HandlerChainExecutor.handleMessage(HandlerChainExecutor.java:142)
12:39:27,427 ERROR [STDERR] at org.jboss.ws.core.jaxws.handler.HandlerDelegateJAXWS.callResponseHandlerChain(HandlerDelegateJAXWS.java:105)
12:39:27,427 ERROR [STDERR] at org.jboss.ws.core.server.ServiceEndpointInvoker.callResponseHandlerChain(ServiceEndpointInvoker.java:129)
12:39:27,427 ERROR [STDERR] at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:269)
12:39:27,428 ERROR [STDERR] at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:468)
12:39:27,428 ERROR [STDERR] at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:293)
12:39:27,428 ERROR [STDERR] at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:203)
12:39:27,428 ERROR [STDERR] at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:129)
12:39:27,428 ERROR [STDERR] at org.jboss.wsf.common.servlet.AbstractEndpointServlet.service(AbstractEndpointServlet.java:85)
12:39:27,428 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
12:39:27,428 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
12:39:27,428 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
12:39:27,428 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
12:39:27,428 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
12:39:27,428 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
12:39:27,428 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
12:39:27,428 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
12:39:27,428 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
12:39:27,428 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
12:39:27,428 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
12:39:27,428 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
12:39:27,428 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
12:39:27,428 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
12:39:27,428 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
12:39:27,428 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
12:39:27,428 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
12:39:27,428 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
12:39:27,429 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
12:39:27,429 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
12:39:27,429 ERROR [STDERR] at java.lang.Thread.run(Thread.java:619)
12:44:22,254 INFO [ServletContextListener] Welcome to Seam 2.1.0.SP1
12:44:27,899 WARN [Component] Component class should be serializable: org.jboss.seam.ui.facelet.mockHttpSession
12:44:27,933 WARN [Component] Component class should be serializable: sessionInfoAction
12:44:27,959 WARN [PersistentPermissionResolver] no permission store available – please install a PermissionStore with the name ‘org.jboss.seam.security.jpaPermissionStore’ if persistent permissions are required.
12:44:45,097 INFO [BootstrapAction] Initializing Administration Console v1.3.2.GA…
12:44:49,055 WARN [SystemInfoFactory] System info API not accessible on this platform (native shared library not found in java.library.path).
12:44:49,386 INFO [PluginContainerResourceManager] Discovering Resources…
12:44:49,565 WARN [JMXDiscoveryComponent] Unable to complete base jmx server discovery (enable DEBUG for stack): java.lang.UnsupportedOperationException: No native library available – Cannot get the process table information without native support
12:45:15,934 INFO [Version] Hibernate Validator 3.1.0.GA
12:45:15,961 INFO [Version] Hibernate Commons Annotations 3.1.0.GA
Hi,
Im new to Web Services. I have an application in which the client will send a request to get some information about the customer through web services.
How can the user access my web service? Do i need to create a web page which will in turn cal my web service or directly can they access my web service?
Thanks for the reply.
Hi I ve this problem and I dont know where to make the changes. Do help me. Thanks in advance
init:
undeploy-clean:
deps-clean:
do-clean:
Deleting directory C:Project10WebServicesSoap1SOAPWebServicesbuild
check-clean:
clean:
init:
deps-module-jar:
deps-ear-jar:
deps-jar:
wsimport-init:
Created dir: C:Project10WebServicesSoap1SOAPWebServicesbuildgenerated-sourcesjax-ws
wsimport-service-ServiceImpl:
Created dir: C:Project10WebServicesSoap1SOAPWebServicesbuildgeneratedjax-wsCacheserviceServiceImpl
command line: wsimport -d C:Project10WebServicesSoap1SOAPWebServicesbuildgeneratedjax-wsCacheserviceServiceImpl -extension -Xnocompile -Xendorsed -keep -s C:Project10WebServicesSoap1SOAPWebServicesbuildgeneratedjax-wsCacheserviceServiceImpl -catalog C:Project10WebServicesSoap1SOAPWebServicescatalog.xml -verbose C:Project10WebServicesSoap1SOAPWebServices/src/conf/xml-resources/web-services/ServiceImpl/wsdl/webservices.wsdl
parsing WSDL…
generating code…
eujdevelopsoapwebservicesCalculateValues.java
eujdevelopsoapwebservicesCalculateValuesResponse.java
eujdevelopsoapwebservicesObjectFactory.java
eujdevelopsoapwebservicesSOAPService.java
eujdevelopsoapwebservicesSOAPWebServices.java
eujdevelopsoapwebservicespackage-info.java
Copying 6 files to C:Project10WebServicesSoap1SOAPWebServicesbuildgenerated-sourcesjax-ws
Copying 2 files to C:Project10WebServicesSoap1SOAPWebServicesbuildwebWEB-INFwsdlServiceImpl
wsimport-service-generate:
Created dir: C:Project10WebServicesSoap1SOAPWebServicesbuildwebWEB-INFclasses
Created dir: C:Project10WebServicesSoap1SOAPWebServicesbuildwebMETA-INF
Copying 1 file to C:Project10WebServicesSoap1SOAPWebServicesbuildwebMETA-INF
Copying 4 files to C:Project10WebServicesSoap1SOAPWebServicesbuildweb
library-inclusion-in-archive:
Copying 1 file to C:Project10WebServicesSoap1SOAPWebServicesbuildwebWEB-INFlib
Copying 1 file to C:Project10WebServicesSoap1SOAPWebServicesbuildwebWEB-INFlib
Copying 1 file to C:Project10WebServicesSoap1SOAPWebServicesbuildwebWEB-INFlib
Copying 1 file to C:Project10WebServicesSoap1SOAPWebServicesbuildwebWEB-INFlib
Copying 1 file to C:Project10WebServicesSoap1SOAPWebServicesbuildwebWEB-INFlib
Copying 1 file to C:Project10WebServicesSoap1SOAPWebServicesbuildwebWEB-INFlib
library-inclusion-in-manifest:
Created dir: C:Project10WebServicesSoap1SOAPWebServicesbuildempty
Compiling 7 source files to C:Project10WebServicesSoap1SOAPWebServicesbuildwebWEB-INFclasses
C:Project10WebServicesSoap1SOAPWebServicesbuildgenerated-sourcesjax-wseujdevelopsoapwebservicesSOAPService.java:46: cannot find symbol
symbol : constructor Service(java.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFeature[])
location: class javax.xml.ws.Service
super(__getWsdlLocation(), SOAPSERVICE_QNAME, features);
C:Project10WebServicesSoap1SOAPWebServicesbuildgenerated-sourcesjax-wseujdevelopsoapwebservicesSOAPService.java:54: cannot find symbol
symbol : constructor Service(java.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFeature[])
location: class javax.xml.ws.Service
super(wsdlLocation, SOAPSERVICE_QNAME, features);
C:Project10WebServicesSoap1SOAPWebServicesbuildgenerated-sourcesjax-wseujdevelopsoapwebservicesSOAPService.java:62: cannot find symbol
symbol : constructor Service(java.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFeature[])
location: class javax.xml.ws.Service
super(wsdlLocation, serviceName, features);
3 errors
C:Project10WebServicesSoap1SOAPWebServicesnbprojectbuild-impl.xml:413: The following error occurred while executing this line:
C:Project10WebServicesSoap1SOAPWebServicesnbprojectbuild-impl.xml:232: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 8 seconds)
Hi
I am new to the webservices will u provide any example how to give security to bottom up webservices in netbeans 6.5 and using tomcat6.0.
Thanks in advance
Daisy: please take a look the under link for your problem:
http://blogs.sun.com/ritzmann/entry/metro_2_0_on_java
This is probably going to be a basic question, but where is the entry point? Is it stated in the WSDL?
I’m sorry before, I’ve just downloaded your codes from http://blog.jdevelop.eu/downloads/soapwebservices/soapwebservices.zip, but I got errors ‘cannot find symbol class: CalculateValues and CalculateValuesResponse. Where can I get these files? Thanks before…
Hello,
I have done upto adding the Java interface and class files to the packages. I could not perform the actions under Testing as the download zipped folder also looks like a Netbeans project folder with the same name that of SOAPWebServices. I could see the “SOAPWebServices-soapui-project.xml” under soapui folder.
Please explain how to do the instructions given below:
install and start “soapui” from http://www.soapui.org. Import the soapui-projectfile “SOAPWebServices-soapui-project.xml” (located in the example).
when i try run my new webservice ,the following errors occurs:
Deployment error:
The Sun Java System Application Server could not start.
More information about the cause is in the Server log file.
Possible reasons include:
– IDE timeout: refresh the server node to see if it’s running now.
– Port conflicts. (use netstat -a to detect possible port numbers already used by the operating system.)
– Incorrect server configuration (domain.xml to be corrected manually)
– Corrupted Deployed Applications preventing the server to start.(This can be seen in the server.log file. In this case, domain.xml needs to be modified).
– Invalid installation location.
See the server log for details.
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:163)
at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:104)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor333.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:277)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:460)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:151)
Caused by: org.netbeans.modules.j2ee.deployment.impl.ServerException: The Sun Java System Application Server could not start.
More information about the cause is in the Server log file.
Possible reasons include:
– IDE timeout: refresh the server node to see if it’s running now.
– Port conflicts. (use netstat -a to detect possible port numbers already used by the operating system.)
– Incorrect server configuration (domain.xml to be corrected manually)
– Corrupted Deployed Applications preventing the server to start.(This can be seen in the server.log file. In this case, domain.xml needs to be modified).
– Invalid installation location.
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance._start(ServerInstance.java:1270)
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.startTarget(ServerInstance.java:1224)
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.startTarget(ServerInstance.java:1035)
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.start(ServerInstance.java:912)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.startTargets(TargetServer.java:417)
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:140)
… 16 more
BUILD FAILED (total time: 5 seconds)