When i removed the WSSecurityhandler from services.xml, and tried invoking
the webservice through soapui client, it works fine and agives me the .pdf
file. Certainly there is a problem on the client side. Either i'm not making
the client properly or there are some jar files missing.
Please suggest.
Vineet wrote:
>
> Hi,
> I've seen almost all the related issues but didnt work for me. I need to
> send a .PDF file from service to the client but not able to do so.
>
> I've used the latest version of woodstox and asl too.
>
> Following are the files:
> 1) Interface Service class:
> @WebResult(name="getDocumentWithAttachment")
> public DataHandler getDocumentWithAttachment(
> @WebParam(name = "documentNumber") Long documentNumber,
> @WebParam(name = "documentType") String documentType) throws
> ServiceException;
> }
>
> 2) Impl Class:
> public DataHandler getDocumentWithAttachment(Long documentNumber, String
> documentType) throws ServiceException {
> try{
> CustomerActionBO customerActionBO = new
> CustomerActionBO(getDirectDebitCSRController(),
> getApp4SupSessionBean(),
> getAppServSessionBean(),
> getDao());
>
> File stmtFile = new
> File("/ccviews/dev/snap/507_dev/vobs/HelloWorld.pdf");
> //stmtFile =
> customerActionBO.getDocumentUrlForAttach(documentNumber,
> documentType);
> if(stmtFile != null){
> FileDataSource ds = new FileDataSource(stmtFile);
>
> DataHandler stmtResult = new DataHandler(ds);
> return stmtResult;
> }else{
> return null;
> }
> }catch(Exception ex){
> throw new ServiceException(ex);
> }
> }
>
> 3) services.xml:
> <service>
> <name>ActionService</name>
> <namespace>http://peace8.peace.com/</namespace>
>
> <serviceClass>com.peace.energy.external.webservices.ActionService</serviceClass>
>
> <implementationClass>com.peace.energy.external.webservices.ActionServiceImpl</implementationClass>
> <properties>
> <property key="mtom-enabled">true</property>
> </properties>
> <inHandlers>
> <handler handlerClass="org.codehaus.xfire.util.dom.DOMInHandler" />
> <handler
> handlerClass="com.peace.energy.webservices.WSSecurityInHandler" />
> </inHandlers>
> <serviceFactory>jsr181</serviceFactory>
> <invoker>#EJBMgrInvoker</invoker>
> </service>
>
> ERROR:
>
> org.codehaus.xfire.XFireRuntimeException: Could not invoke service..
> Nested exception is org.codehaus.xfire.fault.XFireFault: Fault:
> java.lang.NullPointerException
> org.codehaus.xfire.fault.XFireFault: Fault: java.lang.NullPointerException
> at org.codehaus.xfire.fault.XFireFault.createFault(XFireFault.java:89)
> at org.codehaus.xfire.client.Client.onReceive(Client.java:410)
> at
> org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:139)
> at
> org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
> at
> org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
> at
> org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
> at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:79)
> at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:114)
> at org.codehaus.xfire.client.Client.invoke(Client.java:336)
> at
> org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
> at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
> at $Proxy8.getDocumentWithAttachment(Unknown Source)
> at
> com.peace.energy.external.webservices.ActionGetDocumentServiceTest.testGetDocumentWithAttachment(ActionGetDocumentServiceTest.java:80)
> 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:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> 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:118)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at
> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
> at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: java.lang.NullPointerException
> at
> org.codehaus.xfire.attachments.AttachmentUtil.getAttachment(AttachmentUtil.java:33)
> at
> org.codehaus.xfire.aegis.type.mtom.AbstractXOPType.readInclude(AbstractXOPType.java:58)
> at
> org.codehaus.xfire.aegis.type.mtom.AbstractXOPType.readObject(AbstractXOPType.java:45)
> at
> org.codehaus.xfire.aegis.AegisBindingProvider.readParameter(AegisBindingProvider.java:169)
> at
> org.codehaus.xfire.service.binding.AbstractBinding.read(AbstractBinding.java:206)
> at
> org.codehaus.xfire.service.binding.WrappedBinding.readMessage(WrappedBinding.java:51)
> at
> org.codehaus.xfire.soap.handler.SoapBodyHandler.invoke(SoapBodyHandler.java:42)
> at
> org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
> at org.codehaus.xfire.client.Client.onReceive(Client.java:406)
> ... 29 more
>
> Please lemme know about the problem as I've already invested more than 35
> hrs on to it.
>
--
View this message in context:
http://www.nabble.com/Not-able-to-send-attachments-from-service-to-client-tf4022216.html#a11425501
Sent from the XFire - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email