Link to home
Start Free TrialLog in
Avatar of chrismarx
chrismarxFlag for United States of America

asked on

Using Web Services with JSP & Dreamweaver & Axis

hello,
 dreamweaver says that it can use web services with jsp, but all of the examples use coldfusion. I have followed basics of all the web services tutorials I could find for dreamweaver, but I have had not luck getting my page to work. the code below all compiles fine with javac except for  

net.xmethods.www.sd.TemperatureService_wsdl.TemperatureServiceLocator aTemperatureServiceLocator = new net.xmethods.www.sd.TemperatureService_wsdl.TemperatureServiceLocator();

net.xmethods.www.sd.TemperatureService_wsdl.TemperaturePortType aTemperaturePort = aTemperatureServiceLocator.getTemperaturePort();

which returns an error saying that the packages with the above names does not exist.
trying to actually view the page (running tomcat) returns the following errors


Generated servlet error:
The type org.apache.axis.client.Service cannot be resolved. It is indirectly referenced from required .class files

Generated servlet error:
Only a type can be imported. org.apache.axis.client.Call resolves to a package

Generated servlet error:
Only a type can be imported. org.apache.axis.client.Service resolves to a package

Generated servlet error:
Only a type can be imported. org.apache.axis.encoding.XMLType resolves to a package


here is the full code for the page:
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*, org.apache.axis.client.Call" errorPage="" %>

<%@page import="org.apache.axis.client.Service,org.apache.axis.encoding.XMLType" %>

<% net.xmethods.www.sd.TemperatureService_wsdl.TemperatureServiceLocator aTemperatureServiceLocator = new net.xmethods.www.sd.TemperatureService_wsdl.TemperatureServiceLocator();

net.xmethods.www.sd.TemperatureService_wsdl.TemperaturePortType aTemperaturePort = aTemperatureServiceLocator.getTemperaturePort();

float aNewton = aTemperaturePort.getTemp("02466");

float aSF = aTemperaturePort.getTemp("94103");

float aIthaca = aTemperaturePort.getTemp("14850");
%>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
The temperature in Newton today is <%= aNewton %> <br>

The temperature in San Francisco today is <%= aSF %> <br>

the temp in ithaca id <%= aIthaca %>

</body>
</html>



if anyone has any good resources or links as to how to use web services within dreamweaver or even the basics of how to know which methods to call for a service, etc, would be greatly appreciated!!
Avatar of Mayank S
Mayank S
Flag of India image

You need to download Axis for that and set up the JARs in your classpath:

http://ws.apache.org/axis/

You can use WSDL2Java to generate proxy classes for the web service and then call then. It will handle serialization/ de-serialization of parameters and connecting to the WS for you.
Avatar of chrismarx

ASKER

thank you,
 i was wondering whether that might be the problem, but the dreamweaver tutorials state that axis is installed by default when dreamweaver is installed (any way to check this?). i'll try your method, but in the meantime, could you also point me to some references/links about using web services in this way? when i deploy the wsdl file in dreamweaver, I can see all the methods available, but i have no idea about how one goes about using them-
Maybe the JARs are installed but not in your classpath. Refer to this on setting up the classpath.

http://www.mindprod.com/jgloss/classpath.html

Are you running this from an IDE or the console?
hi,
 sorry if i wasn't clear earlier. I was originally trying to get this page to work from within dreamweaver, which does take care of creating the necessary classes (although maybe its doing something wrong). if i try to load the page into the web browser I get the error messages like

Generated servlet error:
Only a type can be imported. org.apache.axis.client.Call resolves to a package


from a tip from another website, i tried to compile the **_jsp.java file in the catalina\localhost manually at the command line with javac. there i was able to actually get some helpful errors. after I resolved most of the classpath issues, the only remaining errors i got were like

package ---
net.xmethods.www.sd.TemperatureService_wsdl.TemperaturePortType aTemperaturePort = aTemperatureServiceLocator.getTemperaturePort(); does not exist,. etc

i have installed axis now, and i was able to see the happyaxis page. i put all the jar references in the classpath, but now I'm getting

log4j:WARN No appenders could be found for logger (org.apache.axis.i18n.ProjectR
esourceBundle).
log4j:WARN Please initialize the log4j system properly.
Processing file deploy.wsdd
<Admin>Done processing</Admin>

when i try to run the deploy.wsdd and i went ahead and tried to use the WSDL2Java with one of the supplied samples (AddressBook.wsdl) and got this:

log4j:WARN No appenders could be found for logger (org.apache.axis.i18n.ProjectR
esourceBundle).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" java.lang.NoClassDefFoundError: javax.wsdl.Definition

        at org.apache.axis.wsdl.toJava.JavaGeneratorFactory.class$(JavaGenerator
Factory.java:68)
        at org.apache.axis.wsdl.toJava.JavaGeneratorFactory.addDefinitionGenerat
ors(JavaGeneratorFactory.java:179)
        at org.apache.axis.wsdl.toJava.JavaGeneratorFactory.addGenerators(JavaGe
neratorFactory.java:133)
        at org.apache.axis.wsdl.toJava.JavaGeneratorFactory.<init>(JavaGenerator
Factory.java:111)
        at org.apache.axis.wsdl.toJava.Emitter.<init>(Emitter.java:159)
        at org.apache.axis.wsdl.WSDL2Java.createParser(WSDL2Java.java:209)
        at org.apache.axis.wsdl.gen.WSDL2.<init>(WSDL2.java:96)
        at org.apache.axis.wsdl.WSDL2Java.<init>(WSDL2Java.java:194)
        at org.apache.axis.wsdl.WSDL2Java.main(WSDL2Java.java:371)

any help is greatly appreciated!

>> org.apache.axis.client.Call

Pls post your JSP import statements. I guess the syntax is incorrect. Try:

<%@ page import = "org.apache.axis.client.* " %>
Ok, I changed to imports to include stars, but now I get this error

The type javax.xml.rpc.ServiceException cannot be resolved. It is indirectly referenced from required .class files

i looked this up, and it seems its related to the jaxrpc.jar file. its in my classpath, and I even tried just adding the file to the actual directory

echo %CLASSPATH%
C:\Documents and Settings\akg29.ITS_STUDENT>echo %CLASSPATH%
C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar;C:\oraclexe\ap
p\oracle\product\10.2.0\server\jlib\orai18n.jar;C:\oraclexe\app\oracle\product\1
0.2.0\server\jdbc\lib\classes12.zip;C:\Program Files\Apache Software Foundation\
Tomcat 5.5\webapps\axis\WEB-INF\lib\axis.jar;C:\Program Files\Apache Software Fo
undation\Tomcat 5.5\common\lib\servlet-api.jar;C:\Program Files\Apache Software
Foundation\Tomcat 5.5\common\lib\jsp-api.jar;C:\Program Files\Apache Software Fo
undation\Tomcat 5.5\common\lib\jasper-runtime.jar;C:\axis-bin-1_4\lib\axis.jar;C
:\axis-bin-1_4\lib\commons-discovery-0.2.jar;C:\axis-bin-1_4\lib\commons-logging
-1.0.4.jar;C:\axis-bin-1_4\lib\jaxrpc.jar;C:\axis-bin-1_4\lib\saaj.jar;C:\axis-b
in-1_4\lib\log4j-1.2.8.jar;C:\axis-bin-1_4\lib\xml-apis.jar;C:\axis-bin-1_4\lib\
xercesImpl.jar;


heres what the whole page looked like before



package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;

public final class tempWeb_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static java.util.List _jspx_dependants;

  public Object getDependants() {
    return _jspx_dependants;
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html; charset=iso-8859-1");
      pageContext = _jspxFactory.getPageContext(this, request, response,
                        "", true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
 net.xmethods.www.sd.TemperatureService_wsdl.TemperatureServiceLocator aTemperatureServiceLocator = new net.xmethods.www.sd.TemperatureService_wsdl.TemperatureServiceLocator();

net.xmethods.www.sd.TemperatureService_wsdl.TemperaturePortType aTemperaturePort = aTemperatureServiceLocator.getTemperaturePort();

float aNewton = aTemperaturePort.getTemp("02466");

float aSF = aTemperaturePort.getTemp("94103");

float aIthaca = aTemperaturePort.getTemp("14850");

      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n");
      out.write("<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n");
      out.write("<head>\r\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />\r\n");
      out.write("<title>Untitled Document</title>\r\n");
      out.write("</head>\r\n");
      out.write("\r\n");
      out.write("<body>\r\n");
      out.write("The temperature in Newton today is ");
      out.print( aNewton );
      out.write(" <br>\r\n");
      out.write("\r\n");
      out.write("The temperature in San Francisco today is ");
      out.print( aSF );
      out.write(" <br>\r\n");
      out.write("\r\n");
      out.write("the temp in ithaca id ");
      out.print( aIthaca );
      out.write(" \r\n");
      out.write("\r\n");
      out.write("</body>\r\n");
      out.write("</html>");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          out.clearBuffer();
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}


here are the changes

package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;
import org.apache.axis.client.*;
import javax.xml.rpc.ServiceException.*;
import org.apache.axis.encoding.XMLType.*;



Sorry I've not personally used Dreamweaver before. Which server does it use? Are you running this from within the IDE? It must be using its own classpath whch is different from the system class-path. You need to put the jaxrpc and other required JARs in a place from where the IDE or server can load it, e.g., it could be the build path of your project or a WEB-INF\lib directory I guess.
i had to install tomcat to load jsp files from dreamweaver. I'm not sure if its running "within the IDE", i mean the page loads from my localhost address. yes, i was trying to determine the build path, this is all slightly new territory for me. the root folder is in the tomcat/webapps, i've placed al the axis related jar's in the WEB-INF/lib directory. the actual java classes are created in the catalina/localhost/(rootdirectoryname) folder,  and i've also added all the axis classes including the jaxrpc.jar file to this folder as well.

my fear is that dreamweaver is perhaps not using the latest version of Axis (there is almost no references about this anywhere) and that it's not creating the proxy stubs correctly. however, as i mentioned, i can't seem to configure my own installation of axis corretly to run the WSDL2Java program myself.

i really appreciate your help here. is there any possibility that someone here could try to load up the page from the code above, after generating the necessary classes from
http://www.xmethods.net/sd/2001/TemperatureService.wsdl
on their own machine to see whether that's where the problem might lie?

otherwise, perhaps you could help me to address some of the previous issues with the axis installation
thanks!!
would you suggest trying to get this to work through one of the java ide's? and if so, which one do you think would be easiest (most helpful) in setting up "drag and drop" web services?
>> i had to install tomcat to load jsp files from dreamweaver.

Then you need to put those JARs in the classpath of Tomcat which means you need to put them into the common\lib folder of Tomcat (so that all web apps can use them) otherwise put them in the WEB-INF\lib folder of your project (so that only this web app can use them).

Try Eclipse - www.eclipse.org, with the plug-ins at www.eclipseplugincentral.com

But first, let's get this working.
i believe progress is being made!!
i no longer get any of the errors related to missing class references etc., now I'm finally down to errors with the actual code in the page, which were the only errors i recieved when trying to compile the page manually.

now, i get this error:

org.apache.jasper.JasperException: Exception in JSP: /tempWeb.jsp:7

4:
5: <% net.xmethods.www.sd.TemperatureService_wsdl.TemperatureServiceLocator aTemperatureServiceLocator = new net.xmethods.www.sd.TemperatureService_wsdl.TemperatureServiceLocator();
6:
7: net.xmethods.www.sd.TemperatureService_wsdl.TemperaturePortType aTemperaturePort = aTemperatureServiceLocator.getTemperaturePort();
8:
9: float aNewton = aTemperaturePort.getTemp("02466");
10:


Stacktrace:
      org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:506)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

javax.servlet.ServletException: Could not initialize class net.xmethods.www.sd.TemperatureService_wsdl.TemperatureBindingStub
      org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:843)
      org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:776)
      org.apache.jsp.tempWeb_jsp._jspService(tempWeb_jsp.java:90)
      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

java.lang.NoClassDefFoundError: Could not initialize class net.xmethods.www.sd.TemperatureService_wsdl.TemperatureBindingStub
      net.xmethods.www.sd.TemperatureService_wsdl.TemperatureServiceLocator.getTemperaturePort(TemperatureServiceLocator.java:45)
      net.xmethods.www.sd.TemperatureService_wsdl.TemperatureServiceLocator.getTemperaturePort(TemperatureServiceLocator.java:40)
      org.apache.jsp.tempWeb_jsp._jspService(tempWeb_jsp.java:52)
      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


here's the new list of all the jar's in the tomcat common/lib folder -

 axis-ant.jar
 axis.jar
 commons-discovery-0.2.jar
 commons-el.jar
 commons-logging-1.0.4.jar
 jasper-compiler-jdt.jar
 jasper-compiler.jar
 jasper-runtime.jar
 jaxrpc.jar
 jsp-api.jar
 log4j-1.2.8.jar
 log4j.properties
 naming-factory-dbcp.jar
 naming-factory.jar
 naming-resources.jar
 saaj.jar
 servlet-api.jar
 tools.jar
 wsdl4j-1.5.1.jar
 xercesImpl.jar
 xml-apis.jar


also, i know you're not familiar with dreamweaver, but the tutorials were very specific when they said that dreamweaver installs axis (Apache Soap 3.0) by default. it was already listed in the dreamweaver options as a proxy generator. however, i couldn't find any axis related jars anywhere on my system except in the places i already put them. there's only one dreamfolder that seems to be related to the dreamweaver install called classes, that has crimson.jar, webservices.jar, wsdl2java.jar and xerces.jar -that's it. i imagine that these were used by dreamweaver setting up the proxy, and that somehow these are the files that are being used by tomcat? too?

i have used eclipse, i'll see about trying to get it set up for webservices. thank you for sticking through this with me. any other ideas about how to continue  troubleshooting?
i see the noclassdeffounderror message down in the root cause. do i need to somehow put references to these classes (which are being created from the wsdl) in the classpath or something?
trying to anticipate your questions, here's the code for the class that was mentioned in this error--

Could not initialize class net.xmethods.www.sd.TemperatureService_wsdl.TemperatureBindingStub


here's the code-
/**
 * TemperatureBindingStub.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis WSDL2Java emitter.
 */

package net.xmethods.www.sd.TemperatureService_wsdl;

public class TemperatureBindingStub extends org.apache.axis.client.Stub implements net.xmethods.www.sd.TemperatureService_wsdl.TemperaturePortType {
    private java.util.Vector cachedSerClasses = new java.util.Vector();
    private java.util.Vector cachedSerQNames = new java.util.Vector();
    private java.util.Vector cachedSerFactories = new java.util.Vector();
    private java.util.Vector cachedDeserFactories = new java.util.Vector();

    static org.apache.axis.description.OperationDesc [] _operations;

    static {
        _operations = new org.apache.axis.description.OperationDesc[1];
        org.apache.axis.description.OperationDesc oper;
        oper = new org.apache.axis.description.OperationDesc();
        oper.setName("getTemp");
        oper.addParameter(new javax.xml.namespace.QName("", "zipcode"), new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, org.apache.axis.description.ParameterDesc.IN, false, false);
        oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "float"));
        oper.setReturnClass(float.class);
        oper.setReturnQName(new javax.xml.namespace.QName("", "return"));
        oper.setStyle(org.apache.axis.enum.Style.RPC);
        oper.setUse(org.apache.axis.enum.Use.ENCODED);
        _operations[0] = oper;

    }

    public TemperatureBindingStub() throws org.apache.axis.AxisFault {
         this(null);
    }

    public TemperatureBindingStub(java.net.URL endpointURL, javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
         this(service);
         super.cachedEndpoint = endpointURL;
    }

    public TemperatureBindingStub(javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
        if (service == null) {
            super.service = new org.apache.axis.client.Service();
        } else {
            super.service = service;
        }
    }

    private org.apache.axis.client.Call createCall() throws java.rmi.RemoteException {
        try {
            org.apache.axis.client.Call _call =
                    (org.apache.axis.client.Call) super.service.createCall();
            if (super.maintainSessionSet) {
                _call.setMaintainSession(super.maintainSession);
            }
            if (super.cachedUsername != null) {
                _call.setUsername(super.cachedUsername);
            }
            if (super.cachedPassword != null) {
                _call.setPassword(super.cachedPassword);
            }
            if (super.cachedEndpoint != null) {
                _call.setTargetEndpointAddress(super.cachedEndpoint);
            }
            if (super.cachedTimeout != null) {
                _call.setTimeout(super.cachedTimeout);
            }
            if (super.cachedPortName != null) {
                _call.setPortName(super.cachedPortName);
            }
            java.util.Enumeration keys = super.cachedProperties.keys();
            while (keys.hasMoreElements()) {
                java.lang.String key = (java.lang.String) keys.nextElement();
                _call.setProperty(key, super.cachedProperties.get(key));
            }
            return _call;
        }
        catch (java.lang.Throwable t) {
            throw new org.apache.axis.AxisFault("Failure trying to get the Call object", t);
        }
    }

    public float getTemp(java.lang.String zipcode) throws java.rmi.RemoteException {
        if (super.cachedEndpoint == null) {
            throw new org.apache.axis.NoEndPointException();
        }
        org.apache.axis.client.Call _call = createCall();
        _call.setOperation(_operations[0]);
        _call.setUseSOAPAction(true);
        _call.setSOAPActionURI("");
        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
        _call.setOperationName(new javax.xml.namespace.QName("urn:xmethods-Temperature", "getTemp"));

        setRequestHeaders(_call);
        setAttachments(_call);
        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {zipcode});

        if (_resp instanceof java.rmi.RemoteException) {
            throw (java.rmi.RemoteException)_resp;
        }
        else {
            extractAttachments(_call);
            try {
                return ((java.lang.Float) _resp).floatValue();
            } catch (java.lang.Exception _exception) {
                return ((java.lang.Float) org.apache.axis.utils.JavaUtils.convert(_resp, float.class)).floatValue();
            }
        }
    }

}
oh, and the classes are the the tomcat/webapps/(rootdirectorty)/web-inf/classes/(in a whole bunch of subfolders)
sorry for the deluge of posts, but I think i made some more progress.
quick question first. adding those jar files to the common/lib folder only seemed to make a difference after i restarted the computer. do i need to restart tomcat for changes made to /lib or other folders to take place?

after studying the above error, i thought that maybe the app couldn't find the classes that were generated from the wsdl file, so i added those to the common/lib folder as well. after doing that and restarting, i now get an entirely different error message.


org.apache.jasper.JasperException: RPC
      org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

javax.servlet.ServletException: RPC
      org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:843)
      org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:776)
      org.apache.jsp.tempWeb_jsp._jspService(tempWeb_jsp.java:90)
      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

java.lang.NoSuchFieldError: RPC
      net.xmethods.www.sd.TemperatureService_wsdl.TemperatureBindingStub.<clinit>(TemperatureBindingStub.java:27)
      net.xmethods.www.sd.TemperatureService_wsdl.TemperatureServiceLocator.getTemperaturePort(TemperatureServiceLocator.java:45)
      net.xmethods.www.sd.TemperatureService_wsdl.TemperatureServiceLocator.getTemperaturePort(TemperatureServiceLocator.java:40)
      org.apache.jsp.tempWeb_jsp._jspService(tempWeb_jsp.java:52)
      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)



a brief look at other people's problems here seem to indicate that this might be due (as i feared) to a different version of wsdlJava being used to extract the classes. what do you think?
>>  see the noclassdeffounderror message down in the root cause.

Which class is that for? Its JAR also needs to be in common\lib and then Tomcat needs to be restarted,
>> a brief look at other people's problems here seem to indicate that this might be due (as i feared) to a different version of wsdlJava being used to extract the classes
>> java.lang.NoSuchFieldError: RPC

I'd say you should use WSDL2Java again to regenerate the proxies from the WSDL and use them.
ok, i was able to resolve the previous problems not being able to run

C:\>java org.apache.axis.wsdl.WSDL2Java http://www.xmethods.net/sd/2001/Temperat
ureService.wsdl

but then i found out that i needed to also add a reference in the classpath to the wsdl4j-1.5.1.jar file (this was not mentioned in the axis documentation) and now i've got the java files created with the latest version of the wsdl2java rather than the stored .jar file from dreamweaver.

i still get this error when running the above command, but it does excute and the java files are created:
log4j:WARN No appenders could be found for logger (org.apache.axis.i18n.ProjectR
esourceBundle).
log4j:WARN Please initialize the log4j system properly.


now that i have the new java files, what should i do with them? i've discovered that the important place for the proxy classes to be is in the web-inf/classes folder (where one would expect). in any case, when dreamweaver was handling the proxy classes, it created the java files and the classes too. running the wsdl2Java command line only gave me the java files. trying the compile them manually gave me errors, saying that in order to compile it needed some of the other classes (which were still just java files) to be there, but i couldn't compile those without the others (sorry if that's confusing)
just a side note -- you are totally a lifesaver here, i would triple the points if i could!
>> log4j:WARN Please initialize the log4j system properly.

That's ok - Axis is internally using log4J for logging and its not been initialized properly, so no worries.
 
>> now that i have the new java files, what should i do with them?

Just include the package and start using the classes to connect to the web-service.

>> running the wsdl2Java command line only gave me the java files

Yes, you need to compile them into .java files - either use DreamWeaver to compile or use javac.exe from the command prompt. For that, you will again need to ensure that the JARs are in the classpath. You can also copy all the JARs and put them into the jre\lib\ext folder to make it simple. Otherwise see my comment here for understanding class-path:

https://www.experts-exchange.com/questions/22450095/Full-code-to-connect-from-Java-to-Access-on-same-machine.html#18722480

>> you are totally a lifesaver here, i would triple the points if i could

Thanks, am just doing what I like to.... you're good at picking things up with my small comments. After all, we do this only in our free time - I'm also working in office right now :)
ok, i figured out that the .java files all needed to be compiled together at once, using javac *.java (all the files were in the sam directory with nothing else).  and, low and behold, the site ran!!!!!! (there is a god)

apparently the majority of problems were indeed a result of the bad classes that dreamweaver created. i looked at the files and saw some big differences. does this mean that the the methods that dreamweaver exposes may also be "off"? since that would mean that basically dreamweaver can't even be used. my page now works, but i'm just getting -999.0 for all the temperatures in the various cities. now i'm wondering whether this is just the service or whether the code in dreamweaver is off somehow.

one last final question?
for this example web service to work first the service locator is invoked:

net.xmethods.www.sd.TemperatureService_wsdl.TemperatureServiceLocator aTemperatureServiceLocator = new net.xmethods.www.sd.TemperatureService_wsdl.TemperatureServiceLocator();

then the TemperaturePort:

net.xmethods.www.sd.TemperatureService_wsdl.TemperaturePortType aTemperaturePort = aTemperatureServiceLocator.getTemperaturePort();


and then the actual methods:

float aNewton = aTemperaturePort.getTemp("02466");

float aSF = aTemperaturePort.getTemp("94103");

float aIthaca = aTemperaturePort.getTemp("14850");


i'm now about to embark actually trying to use the web services that i actually need to use (not this example) and I'm a little lost as how to set up the flow for how to actually use the methods listed. is this documented anywhere?
ASKER CERTIFIED SOLUTION
Avatar of Mayank S
Mayank S
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
you have been most helpful, worth everypoint
Thanks.