You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Cathal Callaghan (JIRA)" <ji...@apache.org> on 2008/10/16 17:19:44 UTC

[jira] Updated: (AXIS2-4089) ContentType of JMS response ignored

     [ https://issues.apache.org/jira/browse/AXIS2-4089?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Cathal Callaghan updated AXIS2-4089:
------------------------------------

    Attachment: JMSSender.java

> ContentType of JMS response ignored
> -----------------------------------
>
>                 Key: AXIS2-4089
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4089
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: kernel, transports
>    Affects Versions: 1.4
>         Environment: OS: Windows XP Pro 2002 Service Pack 2 
>            Reporter: Cathal Callaghan
>         Attachments: JMSSender.java
>
>
> The ContentType of a JMS response message is ignored by the client.
> This causes major hassle when the response message contains a MIME attachment i.e MTOM
> When the a JMS client receieves the response from the server it does not look at its contentType. This means that the SOAPMessageFormatter assumes that its a standard SOAP response. If a MIME attachment is present in the response and consequently its contentType should be "multipart/related", the parser throws the below exception.
> I have attached a fix for this issue. The class affected is Please note that this fix is cumulative with the fix submitted as part of (https://issues.apache.org/jira/browse/AXIS2-4025). Unfortunately network restrictions forbid me from issueing a patch.
> For convienience i have detailed the lines changed below:
> Thanks,
> Cathal
> <<begin lines changed>>
> <imports>
> import org.apache.axis2.builder.BuilderUtil;
> import org.apache.axis2.wsdl.WSDLConstants;
> <imports>
> Message reply = consumer.receive(timeout);
> if (reply != null) {
> 	msgContext.setProperty(MessageContext.TRANSPORT_IN, JMSUtils.getInputStream(reply));
> 	
> 	/* 
> 	 * The contentType of the server response is never taken into account
> 	 * This fix retrieves the contentTpye and sets it on the appropriate messageContext
> 	 * This is especially required for receiving MIME attachments correctly
> 	 */
> 	String contentType = JMSUtils.getProperty(reply, JMSConstants.CONTENT_TYPE);
> 	String charSetEnc = BuilderUtil.getCharSetEncoding(contentType);
> 	
> 	MessageContext inMessageContext = msgContext.getOperationContext().getMessageContext(
> 			WSDLConstants.MESSAGE_LABEL_IN_VALUE);
> 	
> 	if (inMessageContext != null) {
> 		inMessageContext.setProperty(Constants.Configuration.CONTENT_TYPE, contentType);
> 		inMessageContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEnc);
> 	}
> } 
> <<end lines changed>>
> <<begin exception thrown>>
> org.apache.axis2.AxisFault: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '-' (code 45) in prolog; expected '<'
>  at [row,col {unknown-source}]: [1,1]
> 	at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
> 	at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:90)
> 	at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:353)
> 	at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:416)
> 	at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
> 	at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
> 	at com.fineos.frontoffice.documentproduction.operationtypes.DocProdServicesStub.uploadFile(DocProdServicesStub.java:863)
> 	at com.fineos.productservices.test.frontoffice.docprodservices.DocProdServicesTest.testUploadFile(DocProdServicesTest.java:280)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at com.fineos.ta.test.driver.TaTestResult$1.protect(TaTestResult.java:230)
> 	at com.fineos.ta.test.driver.TaTestResult.runProtected(TaTestResult.java:242)
> 	at com.fineos.ta.test.driver.TaTestResult.run(TaTestResult.java:233)
> 	at com.fineos.ta.test.driver.TaTestCase.run(TaTestCase.java:127)
> 	at com.fineos.ta.test.driver.console.Driver.doRun(Driver.java:137)
> 	at com.fineos.ta.test.driver.console.Driver.start(Driver.java:105)
> 	at com.fineos.ta.test.driver.AbstractDriver.initTA(AbstractDriver.java:376)
> 	at com.fineos.ta.test.driver.console.Driver.<init>(Driver.java:69)
> 	at com.fineos.ta.test.driver.console.Driver.main(Driver.java:73)
> Caused by: org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '-' (code 45) in prolog; expected '<'
>  at [row,col {unknown-source}]: [1,1]
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
> 	at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:156)
> 	at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:105)
> 	at org.apache.axis2.builder.BuilderUtil.getSOAPBuilder(BuilderUtil.java:677)
> 	at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:182)
> 	at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:112)
> 	at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:88)
> 	... 25 more
> Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '-' (code 45) in prolog; expected '<'
>  at [row,col {unknown-source}]: [1,1]
> 	at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:623)
> 	at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
> 	at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:506)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:161)
> 	... 31 more
> <<end exception thrown>>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org