JBoss Community

Re: JBoss WS temp file problem

created by spyhunter99 in JBoss Web Services - View the full discussion

Here's what I do. This example comes from a WSN publisher I'm working on.

 

For the record, I prefer the Microsoft approach for building web services/clients. Read the wsdl at development time only. Most java stacks read the wsdl at runtime which makes things challenging at times.

 

Long story short, put a copy of the wsdl and xsd files into the jar file that creates the proxy (not necessarily the jar containing the interface classes) in /META-INF

 

Modify the generated WebServiceClient class to have a static field representing the QName that defines the service (from the wsdl). More than likely, the Qname is already in the class, it's just not a public field.

Example:

public static QName qname = new QName("http://docs.oasis-open.org/wsn/brw-2", "NotificationService");

 

 

Modify the code that creates the client proxy object to load the wsdl from META-INF. Both are required if you need this code to work from with Sun's JDK and OpenJDK

 

              URL wsdl = Thread.currentThread().getContextClassLoader().getResource("META-INF/brw-2impl.wsdl");

            if (wsdl == null) {

                wsdl = Thread.currentThread().getContextClassLoader().getResource("/META-INF/brw-2impl.wsdl");

            }

            if (wsdl == null) {

                ok = false;

                log.log(Level.FATAL, "Unable to obtain a URL for the local wsdl, publication is not possible");

            }

            org.oasis_open.docs.wsn.brw_2.NotificationService ns = new NotificationService(wsdl, NotificationService.qname);

            NotificationBroker notificationPort = ns.getNotificationPort();

 

 

Insert the correct endpoint url here

           

            BindingProvider bp = (BindingProvider) notificationPort;

            Map<String, Object> context = bp.getRequestContext();

            context.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, brokerurl);

 

 

hope this helps

Reply to this message by going to Community

Start a new discussion in JBoss Web Services at Community