Check out 4.3 in the FAQ.  This is almost certain to be something in your
classpath setup in Tomcat (tomcat.bat in the bin directory).  The server
cannot find the service class.  I don't know about Tomcat 4, but in 3.2.3
there were two places that required classpath edits (CLASSPATH near the top
and CP near the middle).  If Tomcat 4 is like 3.2.3, make sure your class is
accessible in CLASSPATH and that xerces is at the front of the CP
definition.

Hope this helps.

  mh

-----Original Message-----
From: venkata akella [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 04, 2001 5:44 PM
To: [EMAIL PROTECTED]
Subject: Getting Server.BadTargetObjectURI 


HI
  Can someone help me out here.
This is what I did.
Installed tomcat 4.0
Using soap2.2
and xerces2.0.0-beta3  

I did this setup on Win 2000 prof machine. 
I wrote a service with two methods. I have pasted that
class(TaxCalculator.java) here. I am able to deploy
this service using apache soap admin page. I can see
this in the list of deployed services on the admin
page. I wrote a client to access this service. I have
pasted that class(TaxCalClient.java) also at the end.
But when I tried to execute this class in my command
window its giving the following messages.

***** cut and pasted message displayed begin***

E:\Sastry\webservices\wsdemo>java TaxCalClient
invoke service
  URL= http://localhost:8080/soap/servlet/rpcrouter
  URN =urn:demo:taxcalculator
Fault= SOAP-ENV:Server.BadTargetObjectURI, Unable to
resolve target object: TaxCalculator

****** message end ***************

Here its giving Server.BadTargetObjectURI.. Can
someone help me why its giving this exception.
Please find the pasted service class and client class.



***Service class ***********

public class TaxCalculator  implements ITaxCalculator 
  {

  public double getStateTax(float totalSalary, String
stateCode) {

        // Get the percentage based on the statecode and
other factors

        System.out.println("State tax for the state" +
stateCode + " is"
                + totalSalary*0.3);
        return totalSalary * 0.3;

        }


  public double getFederalTax(float totalSalary, int
category) {

        System.out.println("fedefal tax for the salary " +
totalSalary 
                + " is " + totalSalary * 0.2 );

        return totalSalary * 0.2;

    }

  }


****Client class************

import java.net.*; 
 import java.util.*; 
 import wsdemo.*;
 import org.apache.soap.*;  
 import org.apache.soap.rpc.*; 

 public class TaxCalClient
   { 
   public static void main( String[] args ) throws
Exception 
     { 
     URL url = new URL(
"http://localhost:8080/soap/servlet/rpcrouter"; ); 
     String urn = "urn:demo:taxcalculator"; 

     Call call = new Call(); // prepare the service
invocation 
     call.setTargetObjectURI( urn ); 
     call.setMethodName( "getStateTax" ); 
     call.setEncodingStyleURI(
Constants.NS_URI_SOAP_ENC ); 

     Vector params = new Vector(); 
     params.addElement( new Parameter( "totalSalary",
Float.class, new Float(5000), null ) ); 
     params.addElement( new Parameter( "totalSalary",
String.class, "CA", null ) ); 
     call.setParams( params );
 
     try 
       { 
       System.out.println( "invoke service\n" + " 
URL= " + url + "\n  URN =" + 
          urn ); 
       Response response = call.invoke( url, "" ); //
invoke the service 
       if( !response.generatedFault() ) 
         { 
         Parameter result = response.getReturnValue();
// response was OK 
         System.out.println( "Result= " +
result.getValue() ); 
         } 
       else 
         { 
         Fault f = response.getFault(); // an error
occurred 
         System.err.println( "Fault= " +
f.getFaultCode() + ", " + 
           f.getFaultString() ); 
         } 
       } 
     catch( SOAPException e ) // call could not be
sent properly 
       { 
       System.err.println( "SOAPException= " +
e.getFaultCode() + ", " +  
         e.getMessage() ); 
       } 
     } 
   } 


Thanks in advance for your great help.
Sastry



__________________________________________________
Do You Yahoo!?
Buy the perfect holiday gifts at Yahoo! Shopping.
http://shopping.yahoo.com

Reply via email to