facebook

Error trying webservice client tutorial

  1. MyEclipse Archived
  2.  > 
  3. Web Services
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #267261 Reply

    I followed the steps of the tutorial — and I get the following error:

    Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/commons/httpclient/methods/RequestEntity
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
    at java.lang.Class.getConstructor0(Unknown Source)
    at java.lang.Class.getConstructor(Unknown Source)
    at org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:108)
    at org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
    at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
    at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
    at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:75)
    at org.codehaus.xfire.client.Client.invoke(Client.java:335)
    at org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
    at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
    at $Proxy13.convertPlaceToLonLatPt(Unknown Source)
    at com.myeclipse.terraws.TerraServiceClient.main(TerraServiceClient.java:130)

    Here’s the code for the main procedure:

        public static void main(String[] args) {
    
            TerraServiceClient client = new TerraServiceClient();
    
            //create a default service endpoint
            TerraServiceSoap terraServiceSoap = client.getTerraServiceSoap();
                
             // Setup query
            Place place = new Place();
            place.setCity("Dallas");
            place.setState("Texas");
            place.setCountry("United States");
    
    //         Process result
            LonLatPt result = terraServiceSoap.convertPlaceToLonLatPt(place);
            System.out.println("City: " + place.getCity() + ", " + place.getState() + ", " + place.getCountry());
            System.out.println("Latitude = " + result.getLat() + "  Longitude: " + result.getLon());
    
            System.out.println("test client completed");
            System.exit(0);
        }
    
    }
    

    I’m sure it’s something I’ve done wrong, but I’m stumped. The error occurs on the first attempt at the soap call:

    LonLatPt result = terraServiceSoap.convertPlaceToLonLatPt(place);

    Lee

    #267262 Reply

    tomeksz
    Member

    Check what http-client version you have in classpath.

    #267266 Reply

    @tomeksz wrote:

    Check what http-client version you have in classpath.

    There isn’t one — but it’s a java propject so I’m not surprised. The build path has the following.

    MyEclipse Jre 5.1
    Xfire 1.2 Core
    Xfire 1.2 JAXB2

    Lee

    #267267 Reply

    tomeksz
    Member

    so you need some more jars 🙂

    This is ( more or less ) classpath i have ( classpath created by maven ) :
    commons-codec-1.3.jar
    commons-httpclient-3.0.jar
    commons-logging-1.0.4.jar
    jaxen-1.1-beta-9.jar
    jdom-1.0.jar
    stax-api-1.0.1.jar
    stax-utils-20040917.jar
    wsdl4j-1.6.1.jar
    wstx-asl-3.2.0.jar
    XmlSchema-1.1.jar

    I’m not sure if every jar is required ( must check this out someday;)

    #267270 Reply

    @tomeksz wrote:

    so you need some more jars 🙂

    This is ( more or less ) classpath i have ( classpath created by maven ) :
    commons-codec-1.3.jar
    commons-httpclient-3.0.jar
    commons-logging-1.0.4.jar
    jaxen-1.1-beta-9.jar
    jdom-1.0.jar
    stax-api-1.0.1.jar
    stax-utils-20040917.jar
    wsdl4j-1.6.1.jar
    wstx-asl-3.2.0.jar
    XmlSchema-1.1.jar

    I’m not sure if every jar is required ( must check this out someday;)

    Not sure how to load those jars. Are there steps in the tutorial that I missed? Was “Java Project” not the proper type to pick?

    Lee

    #267271 Reply

    @tomeksz wrote:

    so you need some more jars 🙂

    Thanks for the clue! I did the demo steps over again — only choosing Web Service Project instead of java project — which gave me the needed libs.

    Also — the “cut and paste” code for the “main” method has a bug the line

     LonLatPt result = terraServiceSoap.convertPlaceToLonLatPt(place);

    should be

     LonLatPt result = service.convertPlaceToLonLatPt(place);

    finally — one needs to add an import statement to the top of the TerraServiceClient.java file:

    import com.terraservice_usa.*;

    Thanks for your help — hopefully someone at Genuitec will update the demo instructions.

    Lee

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Error trying webservice client tutorial

You must be logged in to post in the forum log in