Search code examples
javawcfinteropjava-metro-frameworkout-parameters

Can Metro make Java webservices interoperable with WCF even if Java lacks out parameter support?


I have a WCF client that used to call a WCF method with an out parameter:

int SomeMethod(out int anotherReturnValue);

When reimplementing this method in a Java Webservice will I have to change this method contract? I heard that something called Metro made Java webservices interoperate with WCF, but I guess in this case I will have to change the contract. Is that right?


Solution

  • In Metro, You can annotate the out parameter with the @WebParam annotation. Then define the parameter to a Holder for your original type. For example:

    int someMethod(@WebParam(name="anotherReturnValue", mode=Mode.OUT)
        Holder<Integer>anotherReturnValue);
    

    See this article for more details: WebService hints and tips