<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    createDispatch with WS-Address
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/objectiser">Gary Brown</a> in <i>JBoss Web Services</i> - <a href="http://community.jboss.org/message/575667#575667">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hi</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I'm trying to create a Dispatch instance using WS-Addressing endpoint reference.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>When I try this from code deployed within the server, both using cxf and native, it results in an exception like:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code">12:14:48,551 ERROR [STDERR] javax.xml.ws.WebServiceException: Port HelloWorldPort not found.
12:14:48,552 ERROR [STDERR]&#160;&#160;&#160;&#160; at org.apache.cxf.jaxws.ServiceImpl.getJaxwsEndpoint(ServiceImpl.java:258)
12:14:48,552 ERROR [STDERR]&#160;&#160;&#160;&#160; at org.apache.cxf.jaxws.ServiceImpl.createDispatch(ServiceImpl.java:616)
12:14:48,552 ERROR [STDERR]&#160;&#160;&#160;&#160; at org.apache.cxf.jaxws.ServiceImpl.createDispatch(ServiceImpl.java:641)
12:14:48,552 ERROR [STDERR]&#160;&#160;&#160;&#160; at javax.xml.ws.Service.createDispatch(Service.java:444)
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>However when I run the same code in a client app, it works fine - the Dispatch instance is returned.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The code fragment I use is:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code jive-java">&#160;&#160;&#160;&#160; <font color="navy"><b>try</b></font> <font color="navy">{</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; URL wsdlUrl=WSClient.class.getClassLoader().getResource(<font color="red">"HelloWorldWS.wsdl"</font>);
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println(<font color="red">"WSDL="</font>+wsdlUrl);
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; QName serviceName=QName.valueOf(<font color="red">"{http://simple_invoke/helloworld}HelloWorldWSService"</font>);
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Service service = Service.create(wsdlUrl, serviceName);
&#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; String text=<font color="red">"&lt;EndpointReference xmlns=\"http://www.w3.org/2005/08/addressing\"&gt;"</font>+
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="red">"&lt;Address&gt;http://localhost:8080/Quickstart_bpel_simple_invoke/HelloWorldWS&lt;/Address&gt;"</font>+
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="red">"&lt;ReferenceParameters/&gt;"</font>+
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="red">"&lt;Metadata&gt;"</font>+
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="red">"&lt;wsam:ServiceName xmlns:wsam=\"http://www.w3.org/2007/05/addressing/metadata\" "</font>+
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="red">" xmlns:srv=\"http://simple_invoke/helloworld\" EndpointName=\"HelloWorldPort\"&gt;srv:HelloWorldWSService&lt;/wsam:ServiceName&gt;"</font>+
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="red">"&lt;/Metadata&gt;"</font>+
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="red">"&lt;/EndpointReference&gt;"</font>;
&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; javax.xml.ws.EndpointReference epr=
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; javax.xml.ws.wsaddressing.W3CEndpointReference.readFrom(<font color="navy"><b>new</b></font> StreamSource(
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy"><b>new</b></font> java.io.ByteArrayInputStream(text.getBytes())));
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Dispatch dispatcher = service.createDispatch(epr, SOAPMessage.class,
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Service.Mode.MESSAGE, <font color="navy"><b>new</b></font> javax.xml.ws.soap.AddressingFeature());
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println(<font color="red">"DISPATCHER="</font>+dispatcher);
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">}</font> <font color="navy"><b>catch</b></font>(Exception e) <font color="navy">{</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; e.printStackTrace();
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">}</font>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>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?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>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.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Regards</p><p>Gary</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/575667#575667">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Web Services at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>