2 Replies Latest reply: Apr 10, 2014 8:14 AM by 1041666 RSS

    Error proxying resource in WSRP Portlet - invalid soap message.

    1041666

      Hi,

      We are trying to use portlet in WebCenter Portla (11.1.1.7).

      In simple application with jsr-286 Portlet over WSRP, we are faced with the problem to send embedder binary resource(like image) in serveResource method, using OutputStream of ResourceResponse.

      If resource are simple text (javascript file) - all transmitted successfully.


      Example:

      view.jsp

      <img src="<portlet:resourceURL id="image"/>"/>
      

       

      Portlet1.java

          @Override
          public void serveResource(ResourceRequest request, ResourceResponse response)
                                              throws PortletException, IOException {
              String resourceID = request.getResourceID();
              System.out.println("Serving resources, resourceId = " + resourceID);
      
              InputStream is = Portlet1.class.getClassLoader().getResourceAsStream("test.png");
              System.out.println("inputStream = " + is);
              ByteArrayOutputStream buffer = new ByteArrayOutputStream();
              int nRead;
              byte[] data = new byte[16384];
              while ((nRead = is.read(data, 0, data.length)) != -1) {
                              buffer.write(data, 0, nRead);
              }
              OutputStream outStream = response.getPortletOutputStream();
              outStream.write(buffer.toByteArray());      
              outStream.flush();        
              System.out.println("end of serveResource");
          }
      

       

      When open portal page with located portlet, image not loaded. And exception in server log is:

       

      Serving resources, resourceId = image
      inputStream = java.io.BufferedInputStream@3dd981
      end of serveResource
      <PortletResourceServlet> <_process> Error proxying resource.
      oracle.portlet.client.container.PortletRemoteException: oracle.portlet.wsrp.WSRPRemoteException: java.rmi.RemoteException: Error parsing envelope: most likely due to an invalid SOAP message.: Illegal character ((CTRL-CHAR, code 26))
      at [row,col {unknown-source}]: [3,1]; nested exception is:
          javax.xml.soap.SOAPException: Error parsing envelope: most likely due to an invalid SOAP message.: Illegal character ((CTRL-CHAR, code 26))
      at [row,col {unknown-source}]: [3,1]
          at oracle.portlet.client.techimpl.wsrp.WSRPBaseTerminalPipe.processException(WSRPBaseTerminalPipe.java:119)
          at oracle.portlet.client.techimpl.wsrp.WSRPResourceOperationPipe.execute(WSRPResourceOperationPipe.java:309)
          at oracle.portlet.client.techimpl.wsrp.WSRPResourceOperationPipe.pre(WSRPResourceOperationPipe.java:55)
          at oracle.portlet.client.service.pipeline.PipeContext.internalExecute2(PipeContext.java:650)
          at oracle.portlet.client.service.pipeline.PipeContext.access$000(PipeContext.java:48)
          at oracle.portlet.client.service.pipeline.PipeContext$1.run(PipeContext.java:498)
          at java.security.AccessController.doPrivileged(Native Method)
          at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324)
          at oracle.security.jps.internal.jaas.AccActionExecutor.execute(AccActionExecutor.java:74)
          at oracle.security.jps.internal.jaas.AbstractSubjectSecurity$ActionExecutorWrapper.execute(AbstractSubjectSecurity.java:242)
          at oracle.security.jps.internal.jaas.CascadeActionExecutor$SubjectPrivilegedExceptionAction.run(CascadeActionExecutor.java:83)
          at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
          at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
          at weblogic.security.Security.runAs(Security.java:61)
          at oracle.security.jps.wls.jaas.WlsActionExecutor.execute(WlsActionExecutor.java:51)
          at oracle.security.jps.internal.jaas.CascadeActionExecutor.execute(CascadeActionExecutor.java:56)
          at oracle.security.jps.internal.jaas.AbstractSubjectSecurity$ActionExecutorWrapper.execute(AbstractSubjectSecurity.java:242)
          at oracle.security.jps.internal.jaas.AbstractSubjectSecurity.executeAs(AbstractSubjectSecurity.java:196)
          at oracle.portlet.client.service.pipeline.PipeContext.internalExecute(PipeContext.java:502)
          at oracle.portlet.client.service.pipeline.PipeContextRunnable.run(PipeContextRunnable.java:23)
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
          at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
          at java.util.concurrent.FutureTask.run(FutureTask.java:138)
          at oracle.portlet.client.service.pipeline.ModifiedThreadPoolExecutor$Worker.runTask(ModifiedThreadPoolExecutor.java:391)
          at oracle.portlet.client.service.pipeline.ModifiedThreadPoolExecutor$Worker.run(ModifiedThreadPoolExecutor.java:416)
          at java.lang.Thread.run(Thread.java:662)
      Caused by: oracle.portlet.wsrp.WSRPRemoteException: java.rmi.RemoteException: Error parsing envelope: most likely due to an invalid SOAP message.: Illegal character ((CTRL-CHAR, code 26))
      at [row,col {unknown-source}]: [3,1]; nested exception is:
          javax.xml.soap.SOAPException: Error parsing envelope: most likely due to an invalid SOAP message.: Illegal character ((CTRL-CHAR, code 26))
      at [row,col {unknown-source}]: [3,1]
          at oracle.portlet.wsrp.v2.WSRP_v2_Markup_PortTypeJaxbToSoap.getResource(WSRP_v2_Markup_PortTypeJaxbToSoap.java:333)
          at oracle.portlet.wsrp.v2.ServerToWSRPv2.getResource(ServerToWSRPv2.java:6146)
          at oracle.portlet.client.connection.wsrp.ActivityServerWrapper.getResource(ActivityServerWrapper.java:236)
          at oracle.portlet.client.techimpl.wsrp.WSRPResourceOperationPipe.execute(WSRPResourceOperationPipe.java:141)
          ... 24 more
      Caused by: java.rmi.RemoteException: Error parsing envelope: most likely due to an invalid SOAP message.: Illegal character ((CTRL-CHAR, code 26))
      at [row,col {unknown-source}]: [3,1]; nested exception is:
          javax.xml.soap.SOAPException: Error parsing envelope: most likely due to an invalid SOAP message.: Illegal character ((CTRL-CHAR, code 26))
      at [row,col {unknown-source}]: [3,1]
          at oracle.portlet.wsrp.v2.soap.runtime.WSRP_v2_Markup_Binding_SOAP_Stub.getResource(WSRP_v2_Markup_Binding_SOAP_Stub.java:567)
          at oracle.portlet.wsrp.v2.WSRP_v2_Markup_PortTypeJaxbToSoap.getResource(WSRP_v2_Markup_PortTypeJaxbToSoap.java:229)
          ... 27 more
      Caused by: javax.xml.soap.SOAPException: Error parsing envelope: most likely due to an invalid SOAP message.: Illegal character ((CTRL-CHAR, code 26))
      at [row,col {unknown-source}]: [3,1]
          at oracle.j2ee.ws.saaj.soap.AbstractSOAPImplementation.createEnvelope(AbstractSOAPImplementation.java:137)
          at oracle.j2ee.ws.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:95)
          at oracle.j2ee.ws.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:64)
          at oracle.j2ee.ws.saaj.soap.MessageImpl.getSOAPBody(MessageImpl.java:1586)
          at oracle.j2ee.ws.client.StubBase._preHandlingHook(StubBase.java:887)
          at oracle.j2ee.ws.client.StreamingSender._sendImpl(StreamingSender.java:275)
          at oracle.j2ee.ws.client.StreamingSender._send(StreamingSender.java:148)
          at oracle.portlet.wsrp.v2.soap.runtime.WSRP_v2_Markup_Binding_SOAP_Stub.getResource(WSRP_v2_Markup_Binding_SOAP_Stub.java:507)
          ... 28 more
      Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Illegal character ((CTRL-CHAR, code 26))
      at [row,col {unknown-source}]: [3,1]
          at com.ctc.wstx.sr.StreamScanner.throwInvalidSpace(StreamScanner.java:639)
          at com.ctc.wstx.sr.BasicStreamReader.readTextSecondary(BasicStreamReader.java:4624)
          at com.ctc.wstx.sr.BasicStreamReader.finishToken(BasicStreamReader.java:3661)
          at com.ctc.wstx.sr.BasicStreamReader.safeFinishToken(BasicStreamReader.java:3615)
          at com.ctc.wstx.sr.BasicStreamReader.getText(BasicStreamReader.java:845)
          at oracle.j2ee.ws.saaj.util.ResettableXMLStreamReader.getText(ResettableXMLStreamReader.java:153)
          at oracle.j2ee.ws.saaj.soap.StaxHandler.staxParse(StaxHandler.java:124)
          at oracle.j2ee.ws.saaj.soap.StaxHandler.staxParse(StaxHandler.java:66)
          at oracle.j2ee.ws.saaj.soap.AbstractSOAPImplementation.getStaXParsedEnvelope(AbstractSOAPImplementation.java:207)
          at oracle.j2ee.ws.saaj.soap.AbstractSOAPImplementation.createEnvelope(AbstractSOAPImplementation.java:58)
          ... 35 more

       

      What am i doing wrong?