Hi

 

Thanks to previous help on this message list we've managed to create a
jax-ws client against an Oracle Service Bus endpoint which uses
WS-Security/WS-Policy

.

The problem is that everything works fine in pure Java (test) and under
Jetty & Tomcat. However for real use I need to deploy it under JBoss 6
AS.

 

However the CXF version Jboss 6 AS comes with (2.3.1) doesn't work
(fails early with a NPE during policy initialization). So after reading
up on it, I followed the suggested solution which is to install
JBossWS-Native under JBoss 6 and then bundle our own CXF (version 2.5.1)
with the WAR file.

This works nicely for all other service clients, except for the ONLY one
that's done using createdFromAPI=true - the problem occurs because we
need to instantiate it using Service.getPort()(mostly since I don't know
of other ways to create the Jaxws instance from within Spring for this
createdFromAPI case) ... 

 

--->When we do this, JBoss-WS Native then takes over a JAX-WS Provider
and then it wont work :-/

The question is - how do it create my jaxws client so I can call the
secured endpoint (ie. Still use createdFromAPI) and still run the thing
under JBoss 6?

 

Here's how I've done it so far:

 

The definition is done in Spring (after an example I found):

 

<cxf:bus>

        <cxf:features>

            <p:policies />

            <cxf:logging />

        </cxf:features>

    </cxf:bus>

 

<jaxws:client
name="{http://ic.dsb.dk/kundekerne/intern/events/modtagelse/PrivatKundeE
ventModtagerService}PrivatKundeEventModtagerServiceBindingQSPort"

                  createdFromAPI="true">

        <jaxws:properties>

            <entry key="ws-security.callback-handler"

 
value="dk.dsb.ic.kundekerne.security.ClientKeystorePasswordCallback" />

            <entry key="ws-security.encryption.properties"
value="security/clientKeystore.properties" />

            <entry key="ws-security.encryption.username"
value="osb-public" />

            <entry key="ws-security.signature.properties"
value="security/clientKeystore.properties" />

            <entry key="ws-security.signature.username"
value="kundekerne" />

        </jaxws:properties>

        <jaxws:handlers>

            <bean
class="dk.dsb.ic.kundekerne.OutgoingIgpClientIgpHeaderHandler"/>

        </jaxws:handlers>

    </jaxws:client>

 

And from within the Java code I do the following:

String endpoint =
"http://testserver:8200/KundeKerneInternOutbound/PrivatKundeEventModtage
rServicePS";

URL wsdl = new URL(endpoint + "?wsdl");

Service service = Service.create(wsdl, new
QName("http://ic.dsb.dk/kundekerne/intern/events/modtagelse/PrivatKundeE
ventModtagerService",
"PrivatKundeEventModtagerServiceBindingQSService"));

QName portQName = new
QName("http://ic.dsb.dk/kundekerne/intern/events/modtagelse/PrivatKundeE
ventModtagerService", "PrivatKundeEventModtagerServiceBindingQSPort");

 

PrivatKundeEventModtagerServicePortType x509Port =
service.getPort(portQName,
PrivatKundeEventModtagerServicePortType.class);

return x509Port;

 

Thanks in advance

 

/Jeppe

Reply via email to