This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Java EE 5 Tutorial - Problem with Web Services Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Java EE 5 Tutorial - Problem with Web Services" Watch "Java EE 5 Tutorial - Problem with Web Services" New topic
Author

Java EE 5 Tutorial - Problem with Web Services

Deborah Greene
Greenhorn

Joined: May 22, 2008
Posts: 1
Hi,

I'm new to Java EE and web services and am trying to follow the Java EE 5 Tutorial. I'm using NetBeans 6.0.1. Working from the examples, I want to run the helloservice web service and simpleclient.

Using NetBeans I can deploy the service and test it. This seems to be working fine and http://localhost:8080/helloservice/HelloService?wsdl and http://localhost:8080/helloservice/HelloService?Tester both show the desired pages.

However, there are errors with the simpleclient. I get an error (posted at the end) when I try and run simpleclient. The errors occur because of the import statements:
import helloservice.endpoint.HelloService;
import helloservice.endpoint.Hello;

The error "package helloservice.endpoint does not exist" is present in the code. I guess it's configuration errors and something to do with wsimport, but shouldn't this be done automatically by NetBeans?

I have created another web services client using the 'new' -> 'web services client' NetBeans option, which works fine with the helloservice. It contains no import statements and the resultant project layout and client classes look very different to the simpleclient example.

I would appreciate any clarification or pointers in the right direction,
Thanks
Deborah



[code]
init:
deps-clean:
Deleting directory C:\Documents and Settings\debgre\My Documents\NetBeansProjects\examples\jaxws\simpleclient\build
clean:
init:
deps-jar:
wsimport-init:
Created dir: C:\Documents and Settings\debgre\My Documents\NetBeansProjects\examples\jaxws\simpleclient\build\generated\wsimport\client
Created dir: C:\Documents and Settings\debgre\My Documents\NetBeansProjects\examples\jaxws\simpleclient\build\generated\wsimport\binaries
wsimport-client-check-HelloService:
wsimport-client-HelloService:
Consider using <depends>/<produces> so that wsimport won't do unnecessary compilation
parsing WSDL...


[WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs ocumentation'. Saw 'Web Services'.
line 3 of http://127.0.0.1:8080/helloservice/HelloService/__container$publishing$subctx/WEB-INF/wsdl/HelloService_schema1.xsd

[WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs ocumentation'. Saw 'Web Services'.
line 6 of http://127.0.0.1:8080/helloservice/HelloService/__container$publishing$subctx/WEB-INF/wsdl/HelloService_schema1.xsd

[WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs ocumentation'. Saw 'Endpoint
'.
line 11 of http://127.0.0.1:8080/helloservice/HelloService/__container$publishing$subctx/WEB-INF/wsdl/HelloService_schema1.xsd

[WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs ocumentation'. Saw 'Information
'.
line 14 of http://127.0.0.1:8080/helloservice/HelloService/__container$publishing$subctx/WEB-INF/wsdl/HelloService_schema1.xsd

[WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs ocumentation'. Saw 'Service Name:'.
line 18 of http://127.0.0.1:8080/helloservice/HelloService/__container$publishing$subctx/WEB-INF/wsdl/HelloService_schema1.xsd

[WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs ocumentation'. Saw '{http://endpoint.helloservice/}HelloService'.
line 18 of http://127.0.0.1:8080/helloservice/HelloService/__container$publishing$subctx/WEB-INF/wsdl/HelloService_schema1.xsd

[WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs ocumentation'. Saw 'Port Name:'.
line 18 of http://127.0.0.1:8080/helloservice/HelloService/__container$publishing$subctx/WEB-INF/wsdl/HelloService_schema1.xsd

[WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs ocumentation'. Saw '{http://endpoint.helloservice/}HelloPort'.
line 18 of http://127.0.0.1:8080/helloservice/HelloService/__container$publishing$subctx/WEB-INF/wsdl/HelloService_schema1.xsd

[WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs ocumentation'. Saw 'Address:'.
line 21 of http://127.0.0.1:8080/helloservice/HelloService/__container$publishing$subctx/WEB-INF/wsdl/HelloService_schema1.xsd

[WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs ocumentation'. Saw 'http://127.0.0.1:8080/helloservice/HelloService'.
line 21 of http://127.0.0.1:8080/helloservice/HelloService/__container$publishing$subctx/WEB-INF/wsdl/HelloService_schema1.xsd

[WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs ocumentation'. Saw 'WSDL:'.
line 21 of http://127.0.0.1:8080/helloservice/HelloService/__container$publishing$subctx/WEB-INF/wsdl/HelloService_schema1.xsd

[WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs ocumentation'. Saw 'http://127.0.0.1:8080/helloservice/HelloService?wsdl'.
line 21 of http://127.0.0.1:8080/helloservice/HelloService/__container$publishing$subctx/WEB-INF/wsdl/HelloService_schema1.xsd

[WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs ocumentation'. Saw 'Implementation class:'.
line 21 of http://127.0.0.1:8080/helloservice/HelloService/__container$publishing$subctx/WEB-INF/wsdl/HelloService_schema1.xsd

[WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs ocumentation'. Saw 'helloservice.endpoint.Hello'.
line 21 of http://127.0.0.1:8080/helloservice/HelloService/__container$publishing$subctx/WEB-INF/wsdl/HelloService_schema1.xsd

[WARNING] s4s-elt-schema-ns: The namespace of element 'html' must be from the schema namespace, 'http://www.w3.org/2001/XMLSchema'.
line 1 of http://127.0.0.1:8080/helloservice/HelloService/__container$publishing$subctx/WEB-INF/wsdl/HelloService_schema1.xsd

[WARNING] s4s-elt-invalid: Element 'html' is not a valid element in a schema document.
line 1 of http://127.0.0.1:8080/helloservice/HelloService/__container$publishing$subctx/WEB-INF/wsdl/HelloService_schema1.xsd

[WARNING] src-import.2: The root element of document 'http://127.0.0.1:8080/helloservice/HelloService/__container$publishing$subctx/WEB-INF/wsdl/HelloService_schema1.xsd' has to have the namespace name 'http://www.w3.org/2001/XMLSchema' and the local name 'schema'.
line 1 of http://127.0.0.1:8080/helloservice/HelloService/__container$publishing$subctx/WEB-INF/wsdl/HelloService_schema1.xsd

[ERROR] Unexpected <html> appears at line 1 column 7
line 1 of http://127.0.0.1:8080/helloservice/HelloService/__container$publishing$subctx/WEB-INF/wsdl/HelloService_schema1.xsd

wsimport-client-generate:
Created dir: C:\Documents and Settings\debgre\My Documents\NetBeansProjects\examples\jaxws\simpleclient\build\jar
Copying 3 files to C:\Documents and Settings\debgre\My Documents\NetBeansProjects\examples\jaxws\simpleclient\build\jar\META-INF
wsimport-client-compile:
Compiling 1 source file to C:\Documents and Settings\debgre\My Documents\NetBeansProjects\examples\jaxws\simpleclient\build\jar
C:\Documents and Settings\debgre\My Documents\NetBeansProjects\examples\jaxws\simpleclient\src\java\simpleclient\HelloClient.java:13: package helloservice.endpoint does not exist
import helloservice.endpoint.HelloService;
C:\Documents and Settings\debgre\My Documents\NetBeansProjects\examples\jaxws\simpleclient\src\java\simpleclient\HelloClient.java:14: package helloservice.endpoint does not exist
import helloservice.endpoint.Hello;
C:\Documents and Settings\debgre\My Documents\NetBeansProjects\examples\jaxws\simpleclient\src\java\simpleclient\HelloClient.java:19: cannot find symbol
symbol : class HelloService
location: class simpleclient.HelloClient
static HelloService service;
C:\Documents and Settings\debgre\My Documents\NetBeansProjects\examples\jaxws\simpleclient\src\java\simpleclient\HelloClient.java:39: cannot find symbol
symbol : class Hello
location: class simpleclient.HelloClient
Hello port = service.getHelloPort();
4 errors
BUILD FAILED (total time: 1 second)
[]/code
krishnamoorthy kitcha
Ranch Hand

Joined: Feb 04, 2006
Posts: 96
Hi Deborah Greene ,

Please mount the Webservices api jar files like

mail.jar
This JAR file contains the JavaMail API and all service providers.

activation.jar
This JAR file contains the classes that make up the JavaBeans Activation Framework (JAF).

dom4j.jar
dom4j is an open-source XML framework for Java. It allows you to read, write, navigate, create, and modify XML documents. It integrates with DOM and SAX and is seamlessly integrated with full XPath support. The dom4j.jar file contains all the dom4j code and the XPath engine without the SAX and DOM interfaces. This is the JAR file to use if you are using JAXP and crimson.jar or xerces.jar.

saaj-api.jar and saaj-ri.jar
These two JAR files contain the APIs and Reference Implementation of SOAP with Attachments API for Java (SAAJ), which provide API and implementation to generate SOAP messages.

jaxrpc-api.jar and jaxrpc-ri.jar
These two JAR files contain the JAX-RPC APIs and Reference Implementation of Java API for XML-based Remote Procedure Call (RPC), which enable Java developers to build web applications and Web services that incorporate XML-based RPC functionality according to the SOAP specification.

jaxm-api.jar and jaxm-runtime.jar
These two JAR files contain the APIs and Reference Implementation of the Java API for XML Messaging (JAXM), which is an XML-based messaging system for sending and receiving SOAP messages.

jaxr-api.jar and jaxr-ri.jar
These two files contain the APIs and Reference Implementation for JAXR or the Java API for XML Registries, which provides a uniform standard API for accessing different kinds of XML registries. It includes detailed bindings between the JAXR information model and both the ebXML Registry and the UDDI registry specifications.

jaxp-api.jar
JAXP is the Java API for XML Processing. It supports processing of XML documents using DOM, SAX, and XSLT.

castor-0.9.3.9-xml.jar
Castor is an XML data-binding framework. Unlike DOM and SAX, which deal with the structure of an XML document, Castor enables you to deal with the data defined in an XML document through an object model that represents that data. Castor can marshal almost any beanlike Java object to and from XML.

commons-logging.jar
This JAR file contains a logging library package.

fscontext.jar and providerutil.jar
These two files contain the file-system service provider.
and finally mount j2ee api jars.

Test and tell me your feedback.

Regards
k.krishnamoorthy.
Nathalie Bernstein
Greenhorn

Joined: Jun 02, 2008
Posts: 1
Hello Deborah,

I am also new to web services and had exactly the same problem with the simpleclient example of the tutorial. I believe the JAR files have nothing to do with it, all the necessary libraries are already included into the NetBeans project. The following helps.
- In the Projects tab, locate the project simpleclient.
- Unfold Web Service References, select HelloService
- Right-click the mouse, Refresh Client
- Select the checkbox "Also replace local wsdl file with original wsdl located at"
- Click <Yes>
Senthil Kumar Somasundaram
Greenhorn

Joined: Jan 10, 2007
Posts: 2
I am new to J2EE too.. I had similar issue and followed refresh client solution and worked.. Thanks everybody
Lynn Beran
Greenhorn

Joined: Sep 08, 2009
Posts: 1
Nathalie Bernstein wrote:Hello Deborah,

I am also new to web services and had exactly the same problem with the simpleclient example of the tutorial. I believe the JAR files have nothing to do with it, all the necessary libraries are already included into the NetBeans project. The following helps.
- In the Projects tab, locate the project simpleclient.
- Unfold Web Service References, select HelloService
- Right-click the mouse, Refresh Client
- Select the checkbox "Also replace local wsdl file with original wsdl located at"
- Click <Yes>


I'm an asp.net developer and new to everything in Java, and also has the same error: package helloservice.endpoint does not exist. I don't see Web Service References under simpleclient project.

However, when right click the mouse on simpleclient, choose new Web Service Client and add the url for wsdl. this has made the error disappear.
 
GeeCON Prague 2014
 
subject: Java EE 5 Tutorial - Problem with Web Services