[jboss-user] [JBossWS] - Casting to StubExr leads to ClassCastException

gressho do-not-reply at jboss.com
Wed Jul 23 08:42:47 EDT 2008


Hello,

I'm trying to add WS-Security to my web services which are running fine
without. I generated the client code with Netbeans 6.1 and built the
following class to use it. I added all jars from wsrunclient to the classpath
of my project and tried to run it. The result was
anonymous wrote : 
  | java.lang.ClassCastException: $Proxy31 cannot be cast to org.jboss.ws.core.StubExt
  |         at javaapplication1.Main.main(Main.java:33)
  | 

My code:

  | /*
  |  * To change this template, choose Tools | Templates
  |  * and open the template in the editor.
  |  */
  | 
  | package javaapplication1;
  | 
  | import de.wwu.services.mailservice.Charset;
  | import de.wwu.services.mailservice.Recipient;
  | import de.wwu.services.mailservice.RecipientType;
  | import java.io.File;
  | import java.net.URL;
  | import org.jboss.ws.core.StubExt;
  | 
  | /**
  |  *
  |  * @author gressho
  |  */
  | public class Main {
  | 
  |     /**
  |      * @param args the command line arguments
  |      */
  |     public static void main(String[] args) {
  | 
  |         try { // Call Web Service Operation
  |             de.wwu.services.mailservice.NotificationService service = new de.wwu.services.mailservice.NotificationService();
  |             de.wwu.services.mailservice.NotificationEndpoint port = service.getNotificationEndpointPort();
  |             URL securityURL = new File("META-INF/jboss-wsse-client.xml").toURI().toURL();
  |             URL securityConfig= new File("META-INF/standard-jaxws-client-config.xml").toURI().toURL();
  |             ((StubExt)port).setSecurityConfig(securityConfig.toExternalForm());
  |             ((StubExt)port).setConfigName("Standard WSSecurity Client");
  |             // TODO initialize WS operation arguments here
  |             de.wwu.services.mailservice.Message message = new de.wwu.services.mailservice.Message();
  |             message.setCharset(Charset.UTF_8);
  |             Recipient firstRecipient = new Recipient();
  |             firstRecipient.setRecipientType(RecipientType.TO);
  |             firstRecipient.setRecipientAddress("gressho at uni-muenster.de");
  |             message.getRecipients().add(firstRecipient);
  |             message.setSender("gressho at uni-muenster.de");
  |             message.setSubject("Clustertest");
  |             message.setContent("Diese Mail ist ein Test... Also gleich wegschmeißen!");
  |             port.NotifyRecipients(message);
  |         } catch (Exception ex) {
  |             ex.printStackTrace();
  |             // TODO handle custom exceptions here
  |         }
  |         
  |         // TODO code application logic here
  |     }
  | 
  | }
  | 

Every help is appreciated

Werner


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

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




More information about the jboss-user mailing list