Value class implementations stomped

Forgive me if this question has been posted before; I'm relatively new here and there's so much traffic it's hard to keep up with everything. Also forgive me if this is a stupid question; I'm new to JAX-RPC and Web services and there hasn't been a lot of documentation to help me get up to speed.
I'm trying to understand whether some behavior I'm seeing is intentional or a bug, and if intentional, why it's happening.
Let's say for a moment that I have a class called Foo that does some work and I want to make it into a Web service. Foo has one interesting method, doSomething(), that returns an instance of class Bar. I create new FooServiceIntf and FooServiceImpl classes that define a doSomething() method that turns around and calls Foo.doSomething() to do the actual work. [I'm trying to simulate wrapping an existing API.]
The problem is that while Bar conforms to the "value type" restrictions in the JAX-RPC spec, it isn't a simple bearer of data; it includes some implementation that's used by Foo.doSomething() to create the return values.
I use deploytool (J2EE 1.4 beta 2) to create a portable WAR file with Foo, Bar, FooServiceIntf, and FooServiceImpl (plus the requisite XML files). This seems to work fine. Deploying it with deploytool also appears to work fine, but when I try to call the service, it barfs with a NoSuchMethodError because Foo is trying to call a method on Bar that no longer exists. I investigate and discover that this is because deploytool has overwritten my version of Bar with its own version of Bar that just includes the getter and setter methods for the data members that get sent over the wire.
In other words, it appears that instead of just using the Bar.class file from the original WAR file, it's creating a whole new Bar.class from the WSDL description in the WAR file. I've noticed wscompile does this too. It appears to only happen if Bar happens to exist in the package where wscompile writes all the classes it generates (specified by config.xml when you're running wscompile; I'm guessing deploytool defaults this to the location of the service endpoint interface class [FooServiceIntf in my case]).
If I'm writing a client and all I have is the WSDL file, this is what I'd want wscompile to do, and I can imagine situations where I'd want wscompile and deploytool to do this with the server as well. But it doesn't seem like this is what it should ALWAYS do; if I've supplied a perfectly good Bar.class, it should just use it.
Is this a bug in wscompile and deploytool, or is this intentional? And if it's intentional, why is this the right behavior and what am I doing wrong?
Thanks in advance for any help you can give...
--Rich Gillam
Language Analysis Systems, Inc.

Rich,
I can't anwser your deploytool questions because I always use Ant to build and deploy my apps. However, I have a few suggestions that may help:
wscompile will only stomp your files if you run it with the "-gen:client" option. Check deploytool for an option you can set to ensure that wscompile runs only with "-gen:server".
In your previous post, you mention that you can't use Ant. However, JWSDP's JAX-RPC tools are all command-line oriented. Just add JWSDP_HOME/jaxrpc/bin to your PATH and you can run wscompile and wsdeploy (which is just a wrapper for "wscompile -gen:server") from a shell script, batch file, or makefile.
Basic deployment sequence using JWSDP RI:
1. Write and compile service interface, service implementation and supporting classes.
2. Copy classes to WEB-INF/classes and jar WEB-INF into a war file.
3. Run wsdeploy (which reads from the war file created in step 2) to create WSDL and service ties in deployable war file (wsdeploy reads config info from jaxrpc-ri.xml).
4. Deploy the new war file using your app server's usual technique.
The JWSDP tutorial's JAX-RPC section has a good overview of these steps. See http://java.sun.com/webservices/tutorial.html
For details on wscompile and wsdeploy, see http://forum.java.sun.com/thread.jsp?thread=298464&forum=331&message=1185325
Hope this helps,
Mike

Similar Messages

  • How can I read the filter dependent values in abap class implementation ?

    Hi Experts,
    I need read the filter dependent values in my Z Class implementation but I don´t know how to do it.
    In classic badi was via FT_VAL parameter.
    Now how can I do it ?
    Regars,
    Bala

    Rogerio,
    In case of badis the field flt_val gets added automatically as an import parameter when you check FILTER DEPENDENT check box. This is to restrict which implementation of the badi should be executed, if there are more than one.
    There is no such concept when you are building a class.
    If you want one of your methods to be executed on in certain cases, you need add the required logic within the method.
    If you are referring to the FILTER check box in the pic below, that is used for a different purpose. It is used to filter what is displayed on the class builder screen. F1 on the field to know more about the same.
    Thanks,
    Vikram.M

  • Implementing constructor outside class implementation..

    REPORT  ZTUSH.
    CLASS counter DEFINITION.
      PUBLIC SECTION.
        METHODS CONSTRUCTOR.
        CLASS-METHODS: set IMPORTING value(set_value) TYPE i,
                 increment,
                 get EXPORTING value(get_value) TYPE i.
       PRIVATE SECTION.
       CLASS-DATA count TYPE i.
    ENDCLASS.
    METHOD CONSTRUCTOR.
    WRITE:/ 'I AM CONSTRUCTOR DUDE'.
    ENDMETHOD.
    CLASS counter IMPLEMENTATION.
    METHOD set.
        count = set_value.
      ENDMETHOD.
    ENDCLASS.
    DATA cnt TYPE REF TO counter.
    START-OF-SELECTION.
      CREATE OBJECT cnt.
      CALL METHOD counter=>set EXPORTING set_value = number.
    I THOUGHT WE CAN DEFINE CONSTRUCTOR METHOD OUTSIDE CLASS IMPLEMENTATION AS IN JAVA. But when I do that I get an error, method can be implemented only withing class. Why?

    Hello Rajesh
    I do not fully understand what you mean by "I THOUGHT WE CAN DEFINE CONSTRUCTOR METHOD OUTSIDE CLASS IMPLEMENTATION AS IN JAVA". However, if you mean that we can create an object without having an explicit CONSTRUCTOR method defined then this is possible in ABAP like in Java (see coding below).
    Regards
      Uwe
    REPORT ztush.
    *       CLASS counter DEFINITION
    CLASS counter DEFINITION.
      PUBLIC SECTION.
    *METHODS CONSTRUCTOR.
        CLASS-METHODS: set IMPORTING value(set_value) TYPE i,
        increment,
        get EXPORTING value(get_value) TYPE i.
      PRIVATE SECTION.
        CLASS-DATA count TYPE i.
    * NO explicit constructor
    *METHOD CONSTRUCTOR.
    *WRITE:/ 'I AM CONSTRUCTOR DUDE'.
    *ENDMETHOD.
    ENDCLASS.                    "counter DEFINITION
    *       CLASS counter IMPLEMENTATION
    CLASS counter IMPLEMENTATION.
      METHOD set.
        count = set_value.
      ENDMETHOD.                    "set
      METHOD get.
      ENDMETHOD.                    "get
      METHOD increment.
      ENDMETHOD.                    "increment
    ENDCLASS.                    "counter IMPLEMENTATION
    DATA cnt TYPE REF TO counter.
    START-OF-SELECTION.
    * Implicit constructor is called
      CREATE OBJECT cnt.
      CALL METHOD counter=>set
        EXPORTING
          set_value = 5.
    END-OF-SELECTION.

  • Using a List as the value class of a Map - How?

    Hello,
    I have a managed-property of the following type
    Map<String, List<String>> myMap;How can I set the values for the List in the faces-config.xml?
    I tried sth like this, but this is no valid XML according to the schema.
    Any ideas?
    Regards,
    Jan
    <managed-property>
    <property-name>myMap</property-name>
      <property-class>java.util.TreeMap</property-class>
      <map-entries>
      <key-class>java.lang.String</key-class>
      <value-class>java.lang.ArrayList</value-class>
        <map-entry>
          <key>key1</key>
          <value>
          <list-entries>
            <value>value1</value>
            <value>value2</value>
          </list-entries>
          </value>
        </map-entry>
      </map-entries>
    </managed-property>

    You don't need a cfloop. Try an IN(...) clause instead.
    Obviously you have to validate that the #riderlist# is not empty
    first or the query will error.
    SELECT riderId,
    SUM(IIf(month(rideDate)=1, rideDistance, 0)) AS janSum,
    SUM(IIf(month(rideDate)=2, rideDistance, 0)) AS febSum,
    SUM(IIf(month(rideDate)=3, rideDistance, 0)) AS marSum,
    SUM(IIf(month(rideDate)=4, rideDistance, 0)) AS aprSum,
    SUM(IIf(month(rideDate)=5, rideDistance, 0)) AS maySum,
    SUM(IIf(month(rideDate)=6, rideDistance, 0)) AS junSum,
    SUM(IIf(month(rideDate)=7, rideDistance, 0)) AS julSum,
    SUM(IIf(month(rideDate)=8, rideDistance, 0)) AS augSum,
    SUM(IIf(month(rideDate)=9, rideDistance, 0)) AS sepSum,
    SUM(IIf(month(rideDate)=10, rideDistance, 0)) AS octSum,
    SUM(IIf(month(rideDate)=11, rideDistance, 0)) AS novSum,
    SUM(IIf(month(rideDate)=12, rideDistance, 0)) AS decSum
    FROM mileageLog
    WHERE riderId IN (<cfqueryparam value="#riderList#"
    cfsqltype="the column type here" list="true"> )
    AND Year(rideDate)=#useYear#
    GROUP BY riderId
    ORDER BY riderId

  • Copy characteristic value(class 023 ) from the material master to the batch

    Dear All,
    Is there a way to copy the characteristic value (class 123) from material master to the batch master automatically once we create a batch of that material
    I tried to create a dependency, but didnu2019t know what to write in the dependency editor
    Please advise

    I dont know if its possible in standard,  you can try and create a reference batch, and use the below user exit I found in SAP library :
    Set Up Customer Exit for Determining Source Batch
    You can use function module exit EXIT_SAPLV01Z_011 in SAP enhancement SAPLV1ZN when assigning characteristic values to batches. You use this to specify a reference batch when creating a new batch with the central function module VB_CREATE_BATCH.
    Further notes
    The reference batch must always be specified completely. This means the reference material, source batch and reference plant details must have been entered if the batch is determined at plant level.
    All batch master data is copied. If the batch is classified in this enhancement, the values assigned to the corresponding characteristics are copied.
    In the exit, you can use a communication structure with the application data for the respective business transaction (for example, plant or material type). If you require further information, you must obtain it yourself in one of the user exits (such as time, user name, or date, for example).

  • Class implementation for interface

    Hello,
    I am a beginner in ABAP Objects.
    In the coding of method if_swf_ifs_workitem_exit~event_raised of class CL_SWF_UTL_EXIT_NEW
    There is the instruction follow :
    *Get the workflow container
    irh_container ?= im_workitem_context-> get_wf_container()
    Im_workitem_context is interface type  "IF_WAPI_WORKITEM_CONTEXT"
    If I execute in debug mode I see the implemtation class of this interface (im_workitem_context)  is "CL_SWF_RUN_WORKITEM_CONTEXT"
    But where this information of implementation is defined ? (I saw nothing)
    Regards
    Christine
    Edited by: chris_75 on Sep 7, 2010 4:22 PM

    Interfaces allow to implement highly scalable object oriented applications.
    Interface is a kind of a template for a real class which forces this class to implement methods defined in an interface.
    The main characteristics of an interfaces are:
    - they DO NOT contain any implementations (so there is nothing like INTERFACE ... IMPLEMENTATION - they have only DEFINITIONS - implementations are within classes)
    - they have only PUBLIC sections.
    Why we need an interface. The answer is simple:
    We want to handle some objects uniformly from one application compotent, whereas these objects may behave differently inside.
    Example:
    Let's say we need to build a sorting program for numbers.
    The program would have an interface variable L_RIF_SORTER of an interface LIF_SORTER. LIF_SORTER has a method definition SORT with an C_TAB changing parameter.
    Sorting application would call the sorting algorithm as follows:
    L_RIF_SORTER->SORT( CHANGING c_tab = l_tab ).
    Now is the main point:
    We want to have 2 kinds of sorting algorithms implemented, let's say BUBBLE SORT and QUICK SORT.
    To do so, we implement 2 classes: LCL_BUBBLE_SORT and LCL_QUICK_SORT.
    Both classes implement interface using the statment INTERFACES in a public section.
    The user would have to choose the algorithm from an input field. Depending on the content of this field the sorting application would instantiate one class or the other using the statement:
    CREATE OBJECT l_rif_sorter TYPE (variable_with_class_name).
    THis is the point where ABAP gets to know the real object and its type behind the interface.
    This approach is generally called the STRATEGY PATTERN. See Wikipedia for this.
    I hope I answered your question.
    Regards,

  • Internal class implementing interface extending abstract interface :P

    Confused ha? Yeah me too. RIght here it goes.
    Theres an abstract interface (abstractIFace) that has for example method1() method2() and method3(). There are two other interfaces iFace1 and iFace2 that extend abstractIFace. Still with me? :P iFace1 only uses method2() whereas iFace2 uses method1(), method2() and method3(). Internal classes implementing these are then used. The reason is so that when returning an object one method can be used that will return different types of objects. But this doesnt work. It says that all the classes in the abstractIFace must be used/implemented but I only want method2() in iFace1 and all in iFace2.
    Just say what the f*ck if this is too confusing cos i think it is and i did a crap job explaining!! :P

    public interface IFace {
        void method1();
        void method2();
        void method3();
    public class Test {
        private static class Class1 implements IFace {
            public void method1() {
                System.out.println("method1");
            public void method2() {
                System.out.println("method2");
            public void method3() {
                System.out.println("method3");
        private static class Class2 implements IFace {
            public void method1() {
                throw new UnsupportedOperationException();
            public void method2() {
                System.out.println("method2");
            public void method3() {
                throw new UnsupportedOperationException();
        public static IFace createObject(boolean flag) {
            return flag ? (IFace) new Class1() : new Class2();
    }

  • Can a class implements more than one interface?

    Hello
    Can a class implements more than one interface?
    Thanks

    Of course, this doesn't mean that it won't be a problem though. If the two interfaces have methods with the same signature, but different return types, you won't be able to implement them together. I.E.
    interface InterfaceA {
      public int doSomething(String myString);
    interface InterfaceB {
      public String doSomething(String myString);
    // Now the classes
    // Gives error "Duplicate method doSomething(String) in type ClassA"
    public class ClassA implements InterfaceA, InterfaceB {
      public int doSomething(String myString) {
        System.out.println("A");
        return 0;
      public String doSomething(String myString) {
        System.out.println("B");
        return 0;
    // Gives error "The return type is incompatible with InterfaceB.doSomething(String)"
    public class ClassB implements InterfaceA, InterfaceB {
      public int doSomething(String myString) {
        System.out.println("A");
        return 0;
    // Gives error "The return type is incompatible with InterfaceA.doSomething(String)"
    public class ClassC implements InterfaceA, InterfaceB {
      public String doSomething(String myString) {
        System.out.println("B");
        return 0;
    }

  • How can i call java class implemented as service from ExtJS after successfull activation of a page ?

    Hi ,
    I want to call a java class implemented as a service in felix . This should be called after succesfull activation of the page .
    I want to use ExtJs implemented in /libs/cq/ui/widgets/source/widgets/wcm/SiteAdmin.Actions.js file CQ.wcm.SiteAdmin.activatePage method.
    Please suggest something on this .

    Hi Sham ,
    i tried this ,
    var response = CQ.HTTP.post(
            CQ.shared.HTTP.externalize("/bin/replicate.json"),
            callback,
            { "_charset_":"utf-8", "path":paths, "cmd":"Activate" }
    if (CQ.HTTP.isOk(response)) {
         CQ.HTTP.post("/bin/sample.json",
                  null,
                  {"_charset_":"utf-8","path":paths});
    It is giving an alert messege on siteadmin screen as "Unspecified Error" .
    What can be the problem , am i missing something here?

  • Error "You may only define methods within "CLASS class IMPLEMENTATION"

    We have code in LMIGOSMC so that the vendor batch number appears in the MIGO transaction for certain movement types.  We have created another, custom movement type in which this functionality should be available so I need to add it to LMIGOSMC.  When I go in and try to make the modification I am getting the following error:
    "You may only define methods within "CLASS class IMPLEMENTATION ...ENDCLASS".
    What am I doing wrong?

    Hi,
    You are not doing anything wrong with regard to the syntax error you are getting.  During the syntax check of include program LMIGOSMC, the system is not aware of the CLASS... ENDCLASS statements within the program LMIGOSM4.  Try the syntax check at the LMIGOSM4 program level (or even better, at the SAPLMIGO level) and you will see that the error is not given.
    Regards,
    Jamie

  • Is there any statement to indentify if a class implements an interface?

    Is there any statement to indentify if a class implements a particular interface?

    If you want to check if a class implements an interface, look up the interface here:
    http://java.sun.com/j2se/1.4.2/docs/api/index.html
    and look under "All Known Subinterfaces:"
    If you want to check if an object is of that interface:if(yourObject instanceof SomeInterface)
        // do something
    }

  • Public class implements interface

    I am taking my first crack at interfaces: I have superclass A which is a parent of class B, which implements interface C. I need to use class B to make 3 variable instances within class A. I think I will use interface C to make calculations based on the 3 variables. Where do you recommend that I declare and set values for the 3 variables if I need to output the values at the top, in superclass A?
    I'm just a little unclear on pulling these objcts together... thanks in advance.

    I am taking my first crack at interfaces: I have
    superclass A which is a parent of class B, which
    implements interface C. I need to use class B to make
    3 variable instances within class A. I think I will
    use interface C to make calculations based on the 3
    variables. Where do you recommend that I declare and
    set values for the 3 variables if I need to output the
    values at the top, in superclass A?
    I'm just a little unclear on pulling these objcts
    together... thanks in advance. If your variables are going to be used by your superclass A then they had better be declared there. You can work with them whereever you want.
    I'm not sure what you are saying about "...use interface C to make calculations based on the 3 variables." You can't do calculations inside an interface. Furthermore, if B extends A and implements C then A and C are going to be completely separate entities. Any reference to C, even if it is actually an object of type B, will not be able to use anything in A--unless you cast it to B, in which case there is no use in making an interface at all.
    I probably just confused you, but oh well...
    Jeff

  • How to find out message in a class implementation.

    Hi gurus,
    I am implementing a class : CL_UKM_COMMITMENT_NOTIFICATION
                        with the method : II_UKM_COMMITMENT_NOTIFICATION~EXECUTE_ASYNCHRONOUS
    The problem is, I am passing the required data to test it, but am not being able to find out the error, as the implementation is not working.
    Is there a way I can find out the error????
    Thanks in advance.

    Hi,
    I am doing the same thing.
    This class is supposed to post data,which is passed in the class, into a database table.
    But after executing it, eventhought there is no error, and the sy-subrc value is 0, the data is not getting posted in the database table. I still cant find out where is the problem lying.
    So, is there any other way to find that out?

  • Problem with NotSerializableException on class implementing Serializable

    Hi,
    Any idea as to why I get this exception, and what I can do to avoid it ?
    java.io.NotSerializableException: util.NumberStore$UserI have this, relatively simple, class
    class User implements Serializable
         private static long serialVersionUID = 1L;
         private String uid;
         private String nr;
         public User(){}
         public User( String uid, String nr ) {
              this.uid = uid;
              this.nr = nr;
         public String getUid()     {
              return uid;
         public String getNr() {
              return nr;
         public void setUid(String uid){
              this.uid = uid;
         public void setNr(String nr){
              this.nr = nr;
    }When loading and saving it, I use these two methods:
         private void saveLocalList()
              FileOutputStream f = null;
              try {
                   f = new FileOutputStream("./users.dat");
                   ObjectOutputStream out = new ObjectOutputStream(f);
                   for (User u: numbers)
                        out.writeObject(u);
                   f.close();
              } catch (IOException e) {
                   System.err.println("User info not saved:"+e.getLocalizedMessage());
                   if (f != null)
                        try {
                             f.close();
                        } catch (IOException e1) {
         private boolean loadLocalList()
              FileInputStream f = null;
              try {
                   f = new FileInputStream("./users.dat");
                   ObjectInputStream input = new ObjectInputStream(f);
                   numbers = new ArrayList<User>();
                   User u = (User) input.readObject();
                   while (u != null)
                        numbers.add(u);
                        u = (User) input.readObject();
                   f.close();
                   return true;
              } catch (FileNotFoundException e) {
                   return false;
              } catch (IOException e) {
                   e.printStackTrace();
                   if (f != null)
                        try {
                             f.close();
                        } catch (IOException e1) {
                             // ignore close errors
                   return false;
              } catch (ClassNotFoundException e) {
                   if (f != null)
                        try {
                             f.close();
                        } catch (IOException e1) {
                             // ignore close errors
                   return false;
         }Both the User class and the methods are found within the NumberStore class.

    The User class indeed does not contain any references at all to the NumberStore classIf 'User' is nested inside 'NumberStore' and it isn't static, User does indeed have a hidden reference to the outer class NumberStore. That's how the syntax 'NumberStore.this' works.
    I can say with absolute certainty that an object which was not marked as serializable was written to the users.dat file.Quite apart from the fact that the source code of ObjectOutputStream makes it utterly impossible, I don't see how you can possibly say that 'with absolute certainty'. For a start there's no information in the file to indicate what interfaces were and weren't implemented by the class of the serialized object at the time it was serialized.
    I'm not absolutely positive about whether or not it bombed out on this occassion, or when trying to re-read it next time aroundNotSerializableException is only thrown when writing, not when reading, so that answers that.
    Do you still have the file? I'd like to see exactly what was written. In any case a serialization file that copped any kind of IOException when being written should have been thrown away immediately, you're right about that.
    BTW your reading code is wrong. You shouldn't be testing for null, unless you are deliberately writing a null as a sentinel value. You should be catching EOFException.

  • Run time error in ALV editable on Class implementation

    I am getting a runtime error GETWA_NOT_ASSIGNED again ( This error was resolved yesterday thanks to an expert ) after I implemented a class to handle screen events in an editable ALV . Without the class the program was working and was able to insert the changed values into the internal table. I want to use these values to make changes another field on the same row . Is there a solution .
    I have copied the code from BCALV_EDIT_03. I can post my code.
    I am almost reaching my deadline date so , I will appreciate any help.

    Yes , I have altered a lot in handle_data_change . Its only when I try to use the pr_data_changed->modify_cell
    method call , I get into the runtime error.
    This is the syntax that I have used. :
    CALL METHOD pr_data_changed->modify_cell
                    EXPORTING i_row_id    = ps_good_planetype-row_id
                              i_fieldname = 'BAL_QUANT'
                              i_value     = ls_saplane-sel_quant.

Maybe you are looking for