[jboss-user] [JBoss Web Services] - Re: JBoss WS temp file problem

spyhunter99 do-not-reply at jboss.com
Mon Feb 13 12:19:38 EST 2012


spyhunter99 [https://community.jboss.org/people/spyhunter99] created the discussion

"Re: JBoss WS temp file problem"

To view the discussion, visit: https://community.jboss.org/message/716260#716260

--------------------------------------------------------------
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 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
[https://community.jboss.org/message/716260#716260]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120213/f369d0ff/attachment.html 


More information about the jboss-user mailing list