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

--------------------------------------------------------------
Hi

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");
            
            System.out.println("WSDL="+wsdlUrl);
            
            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\";>"+
                    
"<Address>http://localhost:8080/Quickstart_bpel_simple_invoke/HelloWorldWS</Address>"+
                    "<ReferenceParameters/>"+
                    "<Metadata>"+
                        "<wsam:ServiceName 
xmlns:wsam=\"http://www.w3.org/2007/05/addressing/metadata\"; "+
                            " xmlns:srv=\"http://simple_invoke/helloworld\"; 
EndpointName=\"HelloWorldPort\">srv:HelloWorldWSService</wsam:ServiceName>"+
                    "</Metadata>"+
                    "</EndpointReference>";
    
            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());
            
            System.out.println("DISPATCHER="+dispatcher);
            
        } catch(Exception e) {
            e.printStackTrace();
        }


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.

Regards
Gary
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/575667#575667]

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

_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to