[prev in list] [next in list] [prev in thread] [next in thread]
List: axis-dev
Subject: [jira] [Commented] (AXIS-1008) Processing SOAPFault when MessageContext is not set.
From: "Hudson (Commented) (JIRA)" <axis-dev () ws ! apache ! org>
Date: 2012-01-28 23:22:10
Message-ID: 298709649.4948.1327792930034.JavaMail.tomcat () hel ! zones ! apache ! org
[Download RAW message or body]
[ https://issues.apache.org/jira/browse/AXIS-1008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13195641#comment-13195641 \
]
Hudson commented on AXIS-1008:
------------------------------
Integrated in axis-trunk #70 (See [https://builds.apache.org/job/axis-trunk/70/])
Externalized the test data for AXIS-1008.
veithen :
Files :
* /axis/axis1/java/trunk/axis/src/test/java/test/message/TestSOAPFault.java
* /axis/axis1/java/trunk/axis/src/test/resources/test/message
* /axis/axis1/java/trunk/axis/src/test/resources/test/message/AXIS-1008.xml
> Processing SOAPFault when MessageContext is not set.
> ----------------------------------------------------
>
> Key: AXIS-1008
> URL: https://issues.apache.org/jira/browse/AXIS-1008
> Project: Axis
> Issue Type: Bug
> Components: Serialization/Deserialization
> Environment: Operating System: Linux
> Platform: All
> Reporter: Steve Johnson
> Attachments: SOAPFaultTest.java, axisSOAPFault.patch
>
>
> -----------------------------------------------------------
> Description
> -----------------------------------------------------------
> I am using the axis libraries to send/receive SOAP Messages to our backend
> platform via JMS/HTTP. Our "web services" are not deployed in Axis, we are only
> using the library to serialize/deserialize the actual messages...that seems to
> be the crux of the problem.
> I've run into an issue when a reponse message contains a SOAPFault. The problem
> is that when attempting to deserialize the message a few of the ...Builder
> implementations are attempting to access the MessageContext to access the
> SOAPConstants.
> This occurs in BodyBuilder and SOAPFault builder...I've worked around the issue
> by doing the following:
> SOAPConstants soapConstants = context.getMessageContext() == null ?
> SOAPConstants.SOAP11_CONSTANTS :
> context.getMessageContext().getSOAPConstants();
> then changing all references to the msgContext.getSOAPConstants() to use the
> local soapConstants instead.
> This works fine, here, however ther is one additional issue...again relating to
> the MessageContext being null in our usage.
> In apache/axis/encoding/DeserializationContextImpl.java
> the getTypeMapping accesses the messageContext to grab the encoding type, which
> of course it cannot do. I worked around this with something like this
> if( msgContext == null ) {
> TypeMappingRegistryImpl tmr = new TypeMappingRegistryImpl();
> return ( tmr.getOrMakeTypeMapping( Use.LITERAL.getEncoding() ) );
> which is fairly useless, in general, however it works for us since all encoding
> is LITERAL in our application. There is curElement in this context, however it
> appears as if its encoding isn't set.
> -----------------------------------------------------------
> REPRODUCING
> -----------------------------------------------------------
> Here's some sample code that will reproduce the problem.
> import java.io.*;
> import javax.xml.soap.*;
> /**
> * @author sjohnson
> */
> public class SOAPFaultTest {
> public static final String soapFault = "<?xml version=\"1.0\"
> encoding=\"UTF-8\"?>" +
> "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"
> xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
> xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" +
> "<soapenv:Body>" +
> "<soapenv:Fault>" +
> "<faultcode>soapenv:13001</faultcode>" +
> "<faultstring>java.lang.Exception: File already exists</faultstring>" +
>
> "<faultactor>urn:RiskMetricsDirect:1.0:object-service-service:CreateObject</faultactor>"
> +
> "<detail/>" +
> "</soapenv:Fault>" +
> "</soapenv:Body>" +
> "</soapenv:Envelope>";
>
> /**
> * Should see
> * Caused by: java.lang.NullPointerException
> * at org.apache.axis.message.BodyBuilder.onStartChild(BodyBuilder.java:196)
> * at
> org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:949)
>
> * @param args
> */
> public static void main(String[] args)
> {
> try {
> ByteArrayInputStream bis = new ByteArrayInputStream( soapFault.getBytes() );
> MessageFactory msgFactory = MessageFactory.newInstance();
> SOAPMessage msg = msgFactory.createMessage ( null, bis );
>
> //now attempt to access the fault
> if( msg.getSOAPPart().getEnvelope().getBody().hasFault() ) {
> SOAPFault fault =
> msg.getSOAPPart().getEnvelope().getBody().getFault();
> System.out.println( "Fault: " + fault.getFaultString() );
> }
> } catch (SOAPException e) {
> e.printStackTrace();
> } catch (IOException e) {
> e.printStackTrace();
> }
> }
> }
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: \
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more \
information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic