Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Help - class grade depends on this! javax.xml.namespace does not exist

843834Mar 30 2004 — edited Mar 30 2004
I am trying to develp a command line client for a very simple web service I have developed (very much on the lines of the HelloWorld web service).

I keep getting the following error and I can't figure out which jar file I am missing. Any suggestions? I have all jaxrpc jar files on the classpath.

THIS IS THE JAVAC COMMAND I AM COMPILING MY CODE WITH:

C:\>javac -classpath .;C:\jwsdp-1.3\jaxrpc\lib\jaxrpc-api.jar;C:\jwsdp-1.3\jaxrpc\lib\jaxrpc-impl.jar;C:\jwsdp-1.3\jaxrpc\lib\jaxrpc-spi.jar DynamicClient.java

THESE ARE THE ERRORS I AM GETTING:

DynamicClient.java:1: package javax.xml.namespace does not exist
import javax.xml.namespace.QName;
^
DynamicClient.java:15: package javax.xml.namespace does not exist
javax.xml.namespace.QName serviceName = new QName(
^
DynamicClient.java:15: cannot resolve symbol
symbol : class QName
location: class DynamicClient
javax.xml.namespace.QName serviceName = new QName(
^
DynamicClient.java:22: cannot resolve symbol
symbol : class QName
location: class DynamicClient
javax.xml.namespace.QName operationName = new QName(
^
4 errors

AND HERE IS THE ACTUAL CODE THAT I AM COMPILING:
import javax.xml.namespace.*;
import javax.xml.namespace.QName;
import javax.xml.rpc.*;
import javax.xml.rpc.Call;
import javax.xml.rpc.ParameterMode;
import javax.xml.rpc.Service;
import javax.xml.rpc.ServiceFactory;
import javax.xml.rpc.encoding.XMLType;

public class DynamicClient {

    public static void main(String args[]) {
      String SERVER_URL = "http://localhost:8080";
      try {
            // Qualified name for web service
            javax.xml.namespace.QName serviceName = new javax.xml.namespace.QName(
                    SERVER_URL+"/TemperatureConversion/tempConversion?WSDL", "TemperatureConversion");
            ServiceFactory factory = ServiceFactory.newInstance();
            Service service = factory.createService(serviceName);

            Call call = service.createCall();

            javax.xml.namespace.QName operationName = new javax.xml.namespace.QName(
                    //BODY_NAMESPACE_VALUE,
                    "http://localhost:8080/TemperatureConversion", "celciusToFahrenheit");

            call.setOperationName(operationName);
            // The input parameter
            call.addParameter(
                    "String_1",         // parameter name
                    XMLType.XSD_STRING, // parameter XML type QName
                    String.class,       // parameter Java type class
                    ParameterMode.IN);  // parameter mode
                    
            // The return
            call.setReturnType(XMLType.XSD_STRING);
            
            // The operation is an RPC-style operation.
            call.setProperty(
                    Call.OPERATION_STYLE_PROPERTY, "rpc");
                    
            // The encoding style property value comes from the
            // binding's operation's input clauses encodingStyle
            // attribute.
            call.setProperty(
                    Call.ENCODINGSTYLE_URI_PROPERTY,
                    "http://schemas.xmlsoap.org/soap/encoding/");
                    
            // The target endpoint
            call.setTargetEndpointAddress(SERVER_URL+"/TemperatureConversion/tempConversion");

            // Invoke the operation
            String [] actualArgs = new String[1];
            actualArgs[0] = args[0];
            String returnStr = (String) call.invoke(actualArgs);

            //output the returned URI
            System.out.println(returnStr);
        }
        catch (Throwable t) {
            t.printStackTrace();
        }
    }
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 27 2004
Added on Mar 30 2004
3 comments
530 views