[jboss-user] [JBoss Web Services] - createDispatch with WS-Address

Gary Brown do-not-reply at jboss.com
Mon Dec 13 08:57:46 EST 2010

Gary Brown [http://community.jboss.org/people/objectiser] created the discussion

"createDispatch with WS-Address"

To view the discussion, visit: http://community.jboss.org/message/575667#575667


I'm trying to create a Dispatch instance using WS-Addressing endpoint reference.

When I try this from code deployed within the server, both using cxf and native, it results in an exception like:

12:14:48,551 ERROR [STDERR] javax.xml.ws.WebServiceException: Port HelloWorldPort not found.
12:14:48,552 ERROR [STDERR]     at org.apache.cxf.jaxws.ServiceImpl.getJaxwsEndpoint(ServiceImpl.java:258)
12:14:48,552 ERROR [STDERR]     at org.apache.cxf.jaxws.ServiceImpl.createDispatch(ServiceImpl.java:616)
12:14:48,552 ERROR [STDERR]     at org.apache.cxf.jaxws.ServiceImpl.createDispatch(ServiceImpl.java:641)
12:14:48,552 ERROR [STDERR]     at javax.xml.ws.Service.createDispatch(Service.java:444)

However when I run the same code in a client app, it works fine - the Dispatch instance is returned.

The code fragment I use is:

     try {
            URL wsdlUrl=WSClient.class.getClassLoader().getResource("HelloWorldWS.wsdl");
            QName serviceName=QName.valueOf("{http://simple_invoke/helloworld}HelloWorldWSService");
            Service service = Service.create(wsdlUrl, serviceName);
            String text="<EndpointReference xmlns=\"http://www.w3.org/2005/08/addressing\">"+
                        "<wsam:ServiceName xmlns:wsam=\"http://www.w3.org/2007/05/addressing/metadata\" "+
                            " xmlns:srv=\"http://simple_invoke/helloworld\" EndpointName=\"HelloWorldPort\">srv:HelloWorldWSService</wsam:ServiceName>"+
            javax.xml.ws.EndpointReference epr=
                javax.xml.ws.wsaddressing.W3CEndpointReference.readFrom(new StreamSource(
                        new java.io.ByteArrayInputStream(text.getBytes())));
            Dispatch dispatcher = service.createDispatch(epr, SOAPMessage.class,
                        Service.Mode.MESSAGE, new javax.xml.ws.soap.AddressingFeature());
        } catch(Exception e) {

Not sure if the problem is due to the way that the port (or endpoint name) in EPR is being handled. In WS-Addressing meta spec, endpoint name is an NCName attribute on the ServiceName element. However the ServiceMetaData in jbossws-native I believe is expecting it to be a QName with namespace of the service name. This is possibly why it is not locating the port?

I am trying to override the web service address (URL) in the WSDL, and it appears the Service/Dispatch approach only allows WS-Addressing to be used for this. If there is another means of overriding the URL, then I would also be interested in trying that.


Reply to this message by going to Community

Start a new discussion in JBoss Web Services at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20101213/91ea6412/attachment-0001.html 

More information about the jboss-user mailing list