Send FileDocument contents from a published webservice

2
I have a published WS which returns an object with a list of documents related to it I created an imported WS to call this published WS and get the object with the list of document. I created An XSD file with an element type xsd:base64Binary what are the steps in details to send those documents through the WS and receive them through an imported WS ?
asked
4 answers
4

If you're planning on simply sending binary contents of filedocuments over webservices you don't need an XSD. (Sorry if I was unclear about this in the other topic, it seemed as though you wanted to export/import XML, but you apparently want to use SOAP)

That being said, if you want to expose a webservice that will return filedocument content, you need to check the "Contents" attribute checkbox in the return type of the published webservice. That will automatically insert a base64:binary element in the WSDL, which you can then map in the consuming webservice.

answered
1

Now I want to import the published WS that send an object has a list of document by creating an imported web service that map the returned object with its document list through domain to xml mapping

  • but the following exception will be thrown , while in case of I sent only one document from the published to the imported one it is going well.

com.mendix.core.CoreException: com.mendix.systemwideinterfaces.MendixRuntimeException: kU: java.lang.NullPointerException at iu.b(SourceFile:164) at com.mendix.core.Core.execute(SourceFile:187) at dx.execute(SourceFile:183) at jy.a(SourceFile:300) at jy.a(SourceFile:232) at jy.processRequest(SourceFile:183) at fA.a(SourceFile:75) at com.mendix.core.MxRuntime.processRequest(SourceFile:893) at com.mendix.m2ee.server.handler.RuntimeHandler.handle(RuntimeHandler.java:40) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:113) at org.eclipse.jetty.server.Server.handle(Server.java:334) at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:559) at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:1007) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:747) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:209) at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:406) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:462) at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:436) at java.lang.Thread.run(Thread.java:619) Caused by: com.mendix.systemwideinterfaces.MendixRuntimeException: kU: java.lang.NullPointerException at fh.a(SourceFile:76) at com.mendix.core.Core.importXmlStream(SourceFile:1748) at com.mendix.core.Core.importXmlStream(SourceFile:1733) at bF.a(SourceFile:211) at bF.a(SourceFile:102) at kW.a(SourceFile:66) at eO.executeAction(SourceFile:96) at com.mendix.systemwideinterfaces.core.UserAction.execute(SourceFile:49) at com.mendix.core.actionmanagement.CoreAction.call(SourceFile:473) at iu.b(SourceFile:155) at com.mendix.core.Core.execute(SourceFile:187) at dx.execute(SourceFile:183) at jy.a(SourceFile:300) at jy.a(SourceFile:232) at jy.processRequest(SourceFile:183) at fA.a(SourceFile:75) at com.mendix.core.MxRuntime.processRequest(SourceFile:893) at com.mendix.m2ee.server.handler.RuntimeHandler.handle(RuntimeHandler.java:40) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:113) at org.eclipse.jetty.server.Server.handle(Server.java:334) at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:559) at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:1007) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:747) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:209) at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:406) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:462) at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:436) at java.lang.Thread.run(Thread.java:619) Caused by: kU: java.lang.NullPointerException at jp.a(SourceFile:338) at com.mendix.core.Core.storeFileDocumentContent(SourceFile:1418) at ao.a(SourceFile:73) at ao.a(SourceFile:47) at hI.a(SourceFile:227) at l.endDocument(SourceFile:164) at org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknown Source) at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown Source) at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source) at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source) at org.apache.xerces.impl.XMLEntityScanner.skipSpaces(Unknown Source) at org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) at fh.a(SourceFile:63) at com.mendix.core.Core.importXmlStream(SourceFile:1748) at com.mendix.core.Core.importXmlStream(SourceFile:1733) at bF.a(SourceFile:211) at bF.a(SourceFile:102) at kW.a(SourceFile:66) at eO.executeAction(SourceFile:96) at com.mendix.systemwideinterfaces.core.UserAction.execute(SourceFile:49) at com.mendix.core.actionmanagement.CoreAction.call(SourceFile:473) at iu.b(SourceFile:155) at com.mendix.core.Core.execute(SourceFile:187) at dx.execute(SourceFile:183) at jy.a(SourceFile:300) at jy.a(SourceFile:232) at jy.processRequest(SourceFile:183) at fA.a(SourceFile:75) at com.mendix.core.MxRuntime.processRequest(SourceFile:893) at com.mendix.m2ee.server.handler.RuntimeHandler.handle(RuntimeHandler.java:40) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:113) at org.eclipse.jetty.server.Server.handle(Server.java:334) at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:559) at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:1007) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:747) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:209) at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:406) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:462) at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:436) at java.lang.Thread.run(Thread.java:619) Caused by: java.lang.NullPointerException at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1025) at org.apache.commons.io.IOUtils.copy(IOUtils.java:999) at kh.b(SourceFile:121) at kh.a(SourceFile:95) at jp.a(SourceFile:335) at com.mendix.core.Core.storeFileDocumentContent(SourceFile:1418) at ao.a(SourceFile:73) at ao.a(SourceFile:47) at hI.a(SourceFile:227) at l.endDocument(SourceFile:164) at org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknown Source) at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown Source) at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source) at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source) at org.apache.xerces.impl.XMLEntityScanner.skipSpaces(Unknown Source) at org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) at fh.a(SourceFile:63) at com.mendix.core.Core.importXmlStream(SourceFile:1748) at com.mendix.core.Core.importXmlStream(SourceFile:1733) at bF.a(SourceFile:211) at bF.a(SourceFile:102) at kW.a(SourceFile:66) at eO.executeAction(SourceFile:96) at com.mendix.systemwideinterfaces.core.UserAction.execute(SourceFile:49) at com.mendix.core.actionmanagement.CoreAction.call(SourceFile:473) at iu.b(SourceFile:155) at com.mendix.core.Core.execute(SourceFile:187) at dx.execute(SourceFile:183) at jy.a(SourceFile:300) at jy.a(SourceFile:232) at jy.processRequest(SourceFile:183) at fA.a(SourceFile:75) at com.mendix.core.MxRuntime.processRequest(SourceFile:893) at com.mendix.m2ee.server.handler.RuntimeHandler.handle(RuntimeHandler.java:40) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:113) at org.eclipse.jetty.server.Server.handle(Server.java:334) at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:559) at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:1007) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:747) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:209) at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:406) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:462) at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:436) at java.lang.Thread.run(Thread.java:619)

answered
0

Sorry Achiel,It is still not working . when I call the published WS It show this exception in the console of the published WS

Attribute 'Contents' is not optional but mapped value 'HC.Document.System.FileDocument.Contents' is null

although I am sure that the document has hascontents= true

answered
0

yes Achiel , the problem that I deleted the deployment folder where the files were saved ,

  • while I thought the deployment folder will be reloaded with its all contents include files or images with server restarting but i found out that the modeler will reload every thing except files,images where they are saved in

'\deployment\data\files' . - although the hasContents still=true because modeler depend on the id of the file document rather than contents Blob

attribute which has the same name of the file in the previous path - So,We don't have to touch that data folder otherwise all files and images may be missed. - is That right?

answered