[jbossws-dev] [JBoss Web Services Development] - Bad URL for jar resources in WSConsume

chrholm do-not-reply at jboss.com
Tue Sep 15 10:47:28 EDT 2009


Hi

We are using WSConsume to generate stubs for a WSDL document. We put the document in the jar-file along with the generated stubs, and specify the wsdlLocation as "file.wsdl".

The @WebServiceClient file then contains the following part in a static block:


  |  static {
  |         URL url = null;
  |         try {
  |             URL baseUrl;
  |             baseUrl = foo.Bar.class.getResource(".");
  |             url = new URL(baseUrl, "file.wsdl");
  |         } catch (MalformedURLException e) {
  |             logger.warning("Failed to create URL for the wsdl Location: 'file.wsdl', retrying as a local file");
  |             logger.warning(e.getMessage());
  |         }
  |         PXORDER_WSDL_LOCATION = url;
  |     }
  | 

I don't know why it makes use of the baseURL, but this fails when the resource is in a jar file. A simpler approach (that works in a jar file also), is to simply do:


  |  static {
  |         URL url = null;
  |         try {
  |             url = foo.Bar.class.getResource("file.wsdl");
  |         } catch (MalformedURLException e) {
  |             logger.warning("Failed to create URL for the wsdl Location: 'file.wsdl', retrying as a local file");
  |             logger.warning(e.getMessage());
  |         }
  |         PXORDER_WSDL_LOCATION = url;
  |     }
  | 

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4255319#4255319

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4255319


More information about the jbossws-dev mailing list