All,
I am trying to write a very simple JAX-WS test client for my service
that reads a whole SOAP request (the whole Envelope) from a file and
sends it to my secure endpoint via HTTPS.
I am using the following code fragment:
logger.debug("endpointAddress is " + endpointAddress);
logger.debug("local Wsdl is " + localWsdl);
URL url = new URL(localWsdl);
QName serviceName = new
QName("
http://docs.oasis-open.org/wsn/bw-2", "NotificationConsumerService");
QName portName = new
QName("
http://docs.oasis-open.org/wsn/bw-2",
"NotificationConsumerSoapPort");
Service service = Service.create(url, serviceName);
Source source = new
StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream("Notify_1.xml"));
Dispatch<Source> dispatch = service.createDispatch(portName,
Source.class, Service.Mode.MESSAGE, new AddressingFeature());
dispatch.getRequestContext().put(Dispatch.ENDPOINT_ADDRESS_PROPERTY,
endpointAddress);
dispatch.invokeOneWay(source);
But when trying to do so, I get the following exception stack trace:
java.lang.ClassCastException: com.sun.xml.ws.message.stream.StreamHeader11
at
com.sun.xml.ws.security.opt.impl.JAXBFilterProcessingContext.setJAXWSMessage(JAXBFilterProcessingContext.java:138)
at
com.sun.xml.wss.jaxws.impl.SecurityPipeBase.secureOutboundMessage(SecurityPipeBase.java:348)
at
com.sun.xml.wss.jaxws.impl.SecurityClientPipe.process(SecurityClientPipe.java:159)
at
com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:79)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:559)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:518)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:503)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:400)
at com.sun.xml.ws.client.Stub.process(Stub.java:235)
at
com.sun.xml.ws.client.dispatch.DispatchImpl.invokeOneWay(DispatchImpl.java:202)
at
com.sun.germany.vine2.wsn.consumer.test.NotificationConsumerDispatcherTest.testHttpsSendNotification(NotificationConsumerDispatcherTest.java:52)
at
com.sun.germany.vine2.wsn.consumer.test.NotificationConsumerDispatcherTest.testHttpsSendNotification(NotificationConsumerDispatcherTest.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:213)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:138)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:125)
at org.apache.maven.surefire.Surefire.run(Surefire.java:132)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:290)
at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:818)
I am using JAX-WS as included with WSIT build 15.
Am I doing something wrong? Is this a known issue?
Any help with getting this (supposedly simple, but appearances seem to
be deceiving...) scenario to work is greatly appreciated...
Thanks & best regards,
Andreas
--
Andreas Loew
Java Architect
Sun Microsystems (Germany)