Hi John,

WO web services are based on a Axis implementation that went EOL in 2006. While it was state of the art at the time, I think you'll have better luck using Java 6's built in JAX-WS stuff instead.

In particular, if you are consuming web services, I found WO web services to be significantly lacking. It doesn't do much for you with complex objects modeled in XSD schemas. It can't even correctly parse a WSDL with XSD imports.

If you are vending a WS, it might work okay, but if I remember correctly, the preferred WOWS way to do it is with RPC style. Wrapped document literal style is probably a better choice in most cases...

http://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/

Another gotcha occurs when you are using D2W. WOWS uses an incompatible rule model, and the _WSRuleUtilities class will inject it in its static initializer block... borking your app with a random crash because ERD2W will correct that automatically but the task and entity will be null after the correction resulting in pageForConfigurationNamed() throwing an exception. The WSAssistant is also completely useless under 5.4 because of the incompatible rule model too, just in case you might have thought the D2WS stuff looked cool.


Ramsey

On Jan 4, 2011, at 12:32 PM, John Huss wrote:

No, it seems the accessible value isn't persistent -- a subsequent call to getDeclaredMethods will return an object without the flag set. But I can hack on WO to fix it. Maybe this could go into Wonder?

// In Application's constructor

        try {
Field field = WOWSDDRegistrar.class.getDeclaredField("_instance");
                field.setAccessible(true);
                field.set(WOWSDDRegistrar.class, new FixedWOWSDDRegistrar());
        } catch (Exception e) {
log.error("Unable to patch WOWSDDRegistrar: " + e.getMessage());
        }


// New class
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.List;

import com.webobjects.appserver.WOWSDDRegistrar;

public class FixedWOWSDDRegistrar extends WOWSDDRegistrar {

        protected List<String> getDeclaredMethodsForClass(Class<?> clazz) {
                List<String> result = new ArrayList<String>();
                for (Method method : clazz.getDeclaredMethods()) {
if (Modifier.isPublic(method.getModifiers()) && Modifier.isStatic(method.getModifiers())) {
                                result.add(method.getName());
                        }
                }
                return result;
        }}
        
}


On Tue, Jan 4, 2011 at 11:12 AM, Mike Schrag <[email protected]> wrote:
if you Main.class.getMethod("yourMethod").setAccessible(true)
it will probably work

On Jan 4, 2011, at 12:11 PM, John Huss wrote:

Ok, so it's use in WOWSDDRegistrar.getDeclaredMethodsForClass is incorrect then, and that's why I can't create a Document style web service. I love WO 5.4! I'll file a radar.

Thanks,
John

On Tue, Jan 4, 2011 at 11:03 AM, Mike Schrag <[email protected]> wrote: I don't think that means what you think it does ... isAccessible only returns true if you setAccessible, which tells the VM to skip VM security checks when you call the method.

You might want Modifier.isPublic(method.getModifiers()) ?

ms

On Jan 4, 2011, at 11:58 AM, John Huss wrote:

Does anyone know why this code doesn't print anything?

import java.lang.reflect.Method;

public class Main {

        public static void main(String[] args) {
                for (Method method : Main.class.getDeclaredMethods()) {
                        if (method.isAccessible()) {
                                System.out.println(method.getName());
                        }
                }
        }
        
}

I would expect it to print "main" since there is one public method named "main" in class Main. Isn't that what isAccessible does?

John
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/mschrag%40pobox.com

This email sent to [email protected]




_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/ramsey%40xeotech.com

This email sent to [email protected]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to