facebook

Parameter name with xFire web service other than in0, … ?

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

    clmichel
    Member

    Hi, I experimented with the WebService wizard in MyEclipse 5.1.0GA and wrote a very simple demo WS for converting amounts between euro and bef, based on the following bean:

    package mypkg;

    public class ConverterService {
    private static final float RATIO = 40.3399f;
    public ConverterService() {
    }
    public float euroToBef(float amount) {
    return amount * RATIO;
    }
    public float befToEuro(float amount) {
    return amount / RATIO;
    }
    }

    The wizard generated the services.xml file:
    <beans xmlns=”http://xfire.codehaus.org/config/1.0″&gt;
    <service>
    <name>ConverterService</name>
    <serviceClass>mypkg.ConverterService</serviceClass>
    <style>wrapped</style>
    <use>literal</use>
    <scope>application</scope>
    </service>
    </beans>

    and the WS can be deployed on jBoss 4.0.4. No problem as this point.

    My only concern is how to have XFire name my parameter “amount”, as in the bean, and NOT the default in0 ?? I need this to ensure compatibility with a previous version of such a WS.

    I couldn’t find my way in the xFire documentation…

    With regards,
    Claude

    #263790 Reply

    Brian Fernandes
    Moderator

    Calude,

    You should be able to use annotations to solve this issue.
    Something like:

    @WebMethod
    public float euroToBef(@WebParam(name=“amount”,header=true) float amount) {
        return amount * RATIO;
    }

    should do the trick. You can read more about annotations here: http://xfire.codehaus.org/JSR+181+Annotations

    #263804 Reply

    clmichel
    Member

    Hi Brian,
    Thank you for the quick response. I allready read the (very few) lines about annotations in the XFire documentation without finding any answer to my problem.
    As I replayed the scenario over and over (…), I discovered that the WSDL generated by the XFire servlet is different if you generate the WS from the implementation class than from both an interface and an implementation class:
    – from implementation only: parameter names are OK (amount in my example)
    – from interface and implementation: names are lost and replaced by in0, …

    It sounds like a XFire bug …
    With regards,

    Claude

    #263814 Reply

    Brian Fernandes
    Moderator

    Claude,

    That’s an interesting conclusion – it does seem like an XFire bug.

    When you used the implementation class only, did you still require the annotations to retain the parameter names or were the annotations not necessary?

    #263983 Reply

    clmichel
    Member

    No, the only difference is in the services.xml file: with interface + implementation class, the parameters are named in0, in1, …; with implementation class alone, the names of the parameters are those defined in the implementation. No need for annotations.

    Thank you anyway,

    Claude

    #264427 Reply

    BIA
    Member

    hello,

    i am having the same problem, but i am not able to fix it.

    i tryed the annotiations:

    
    public class HANSEImpl implements IHANSE {
        @WebMethod
      public String michi_test(@WebParam(name="test",header=true)String test)
      {
            return "hello world: " + test;
        }
        
    }
    

    but nothing happend. still <xsd:element name=”in0″ type=”xsd:string” nillable=”true” minOccurs=”1″ maxOccurs=”1″ />

    and how can i only use the implementation class in services.xml?

    thx
    lukas

    #264428 Reply

    BIA
    Member

    hello,

    i am having the same problem, but i am not able to fix it.

    i tryed the annotiations:

    
    public class HANSEImpl implements IHANSE {
        @WebMethod
      public String michi_test(@WebParam(name="test",header=true)String test)
      {
            return "hello world: " + test;
        }
        
    }
    

    but nothing happend. still <xsd:element name=”in0″ type=”xsd:string” nillable=”true” minOccurs=”1″ maxOccurs=”1″ />

    and how can i only use the implementation class in services.xml?

    thx
    lukas

    #265123 Reply

    AshMcConnell
    Member

    Hi Folks,

    We had the same problem, we discovered that you needed to compile the java with full debug information (using javac -g:lines,vars,source) *AND* only use the implementation class rather than implementation + interface.

    You use the implementation class only specified by serviceClass in the services.xml

    We are having difficulty setting the serviceClass as an implementation rather than an interface when using Spring. If anyone has any ideas, please let me know!

    I hope this is of use to someone.

    All the best,
    Ash

    #265125 Reply

    optimad
    Participant

    Hi there,

    We have been getting the same issue and want to look at annotations but all the examples seem to be java 5 dependant. Does this work on previous versions of java? Is there any way to do the same thing using bindings or the MessageContext?

    Thanks for your help

    Daniel (Optimad)

    #265128 Reply

    AshMcConnell
    Member

    Hi Daniel,

    I’m sorry we have been using java 5. We haven’t tried to get it working without i’m afraid.

    All the best,
    Ash

    #265131 Reply

    AshMcConnell
    Member

    Hi Daniel,

    We tried without annotations and it came up with the proper params, the key was changing the javac to produce debugging info.

    I hope this helps.
    All the best,
    Ash

Viewing 11 posts - 1 through 11 (of 11 total)
Reply To: Parameter name with xFire web service other than in0, … ?

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