views:

522

answers:

2

UPDATE: I have submitted my question to the CXF User's mailing list, here.

UPDATE: I have currently signed all of my jars. I still can't seem to get CXF setup in a way that it can find the WSDL. My last attempt was to place the WSDL inside of my WAr file so I can access it through a web browser. I set the wsdllocation inside of the client to the URL (http://www.example.com/app/example.wsdl). I am now getting the following exception:

Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError
at com.sun.xml.internal.ws.util.xml.XmlUtil.createDefaultCatalogResolver(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(Unknown Source)
at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(Unknown Source)
at javax.xml.ws.Service.<init>(Unknown Source)

Googling has turned up pretty much nothing on this.

I am creating a web service client from a given WSDL using Apache CXF. I am running into problems however when trying to access the service, I get this exception:

Can not initialize the default wsdl from ../resource/example.wsdl
Exception in thread "AWT-EventQueue-0" java.security.AccessControlException: access denied (java.util.PropertyPermission user.dir read)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)

I am not signing my web start application, and would prefer not to since I am not accessing any resources from the client's machine. The WSDL mentioned is packaged within my jar. The problem is caused by this from the CXF generated client code:

    URL url = null;
    try {
        url = new URL("../resource/example.wsdl");
    } catch (MalformedURLException e) {
        System.err.println("Can not initialize the default wsdl from ../resource/example.wsdl");
        // e.printStackTrace();
    }
    WSDL_LOCATION = url;

How can I correctly point CXF to this WSDL? I am also worried about the WebService annotation on the class:

@WebServiceClient(name = "Example", 
              wsdlLocation = "../resource/example.wsdl",
              targetNamespace = "http://services.example.com/") 

Do I also need to change this?

+1  A: 

You are going to need to change that wsdlLocation to a classpath: reference.

use -wsdlLocation as shown here.

bmargulies
What exactly do I use for a the value for that though? The WSDL is located inside my jar, just specifying the wsdl name causes a security exception as it is trying to load from user.dir.
Casey
a classpath:/org/foo/bar.wsdl path, I think.
bmargulies
I tried using classpath:example.wsdl as input to -wsdlLocation and than upon running it I get this exception:Can not initialize the default wsdl from classpath:WEXAuth.wsdlException in thread "AWT-EventQueue-0" java.security.AccessControlException: access denied (java.util.PropertyPermission user.dir read)
Casey
Time to post a message on the CXF user mailing list.
bmargulies
@bmargulies I will be doing that now! Thanks for your input.
Casey
A: 

After a few mistakes and experimentation, I have managed to get everything to work properly. First, MAKE SURE that cxf.jar and wsdl4j.jar are actually on your classpath. I thought I had verified this, but because I was instantiating the client from inside a jar via webstart that was in itself packed in a WAR, I messed up the placement of the cxf runtime in my build process. Also, when specifying the wsdl location, I had to use "classpath:my.wsdl". I made it easy on myself and just put the wsdl in the same location as my source.

Hope this helps someone who might do the same thing at somepoint!

Casey