You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by jason zhang <ja...@gmail.com> on 2008/10/23 08:36:09 UTC

difference in AxisFault handling in server between SOAP 11 and SOAP 12

Hi

I use AXIOM style client code to invoke service. My service is 
implemented using generated stub. It uses policy for security.  To test 
the fault handling, my server code always throws AxisFault.
If the client code has this line: 
"options.setSoapVersionURI(org.apache.axiom.soap.SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);",  
the AxisFault is reported back correctly to client. The response is like 
this
--------------------
HTTP/1.1 500 Internal Server Error
Server: Apache-Coyote/1.1
Content-Type: application/soap+xml; 
action="http://www.w3.org/2005/08/addressing/soap/fault";charset=UTF-8
Transfer-Encoding: chunked
Date: Thu, 23 Oct 2008 04:29:32 GMT
Connection: close

<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope 
xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><soapenv:Fault 
xmlns:axis2ns5="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Code><soapenv:Value>axis2ns5:Server</soapenv:Value></soapenv:Code>
de
<soapenv:Reason><soapenv:Text xml:lang="en-US">error 
...</soapenv:Text></soapenv:Reason>
--------------------------
If the client code does not have that line, the message is sent to 
server using SOAP 11 style,
The response is a HTTP error from tomcat.
---------------------
HTTP/1.1 500 Internal Server Error
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=utf-8
Content-Length: 1000
Date: Thu, 23 Oct 2008 04:30:06 GMT
Connection: close

<html><head><title>Apache Tomcat/6.0.16 - Error 
report</title><style>...</style> </head><body><h1>HTTP Status 500 - 
</h1><HR size="1" noshade="noshade"><p><b>type</b> Status 
report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The 
server encountered an internal error () that prevented it from 
fulfilling this request.</u></p><HR size="1" 
noshade="noshade"><h3>Apache Tomcat/6.0.16</h3></body></html>
----------------------------

I traced the error to 
org.apache.axiom.soap.impl.builder.SOAP11BuilderHelper line 151
 private void processText(XMLStreamReader parser, OMElement value) {
        try {
146            int token = parser.next();
 147           while (token != XMLStreamReader.END_ELEMENT) {
148                if (token == XMLStreamReader.CHARACTERS) {
149                    factory.createOMText(value, parser.getText());
150                } else {
151                    throw new SOAPProcessingException(
                            "Only Characters are allowed here");
                }
                token = parser.next();
            }


        } catch (XMLStreamException e) {
            throw new SOAPProcessingException(e);
        }
    }

When the error occurs, the value is an 
org.apache.axiom.soap.impl.dom.soap11.SOAP11FaultCodeImpl element. token 
is 1(StartElement).

Is this a bug or something wrong in my code?

thanks

-jason


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


Re: difference in AxisFault handling in server between SOAP 11 and SOAP 12

Posted by Nandana Mihindukulasooriya <na...@gmail.com>.
Hi Json,
   Did you try using AXIOM trunk ? There was an issue in AXIOM which created
wrong structure for SOAP 1.1 fault, but it is now fixed in the trunk. Please
have a look at these two issues. [1], [2]

thanks,
nandana

[1] - https://issues.apache.org/jira/browse/WSCOMMONS-343
[2] - http://issues.apache.org/jira/browse/RAMPART-164

On Thu, Oct 23, 2008 at 12:36 PM, jason zhang <ja...@gmail.com>wrote:

> Hi
>
> I use AXIOM style client code to invoke service. My service is implemented
> using generated stub. It uses policy for security.  To test the fault
> handling, my server code always throws AxisFault.
> If the client code has this line:
> "options.setSoapVersionURI(org.apache.axiom.soap.SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);",
>  the AxisFault is reported back correctly to client. The response is like
> this
> --------------------
> HTTP/1.1 500 Internal Server Error
> Server: Apache-Coyote/1.1
> Content-Type: application/soap+xml; action="
> http://www.w3.org/2005/08/addressing/soap/fault";charset=UTF-8
> Transfer-Encoding: chunked
> Date: Thu, 23 Oct 2008 04:29:32 GMT
> Connection: close
>
> <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="
> http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><soapenv:Fault
> xmlns:axis2ns5="http://schemas.xmlsoap.org/soap/envelope/
> "><soapenv:Code><soapenv:Value>axis2ns5:Server</soapenv:Value></soapenv:Code>
> de
> <soapenv:Reason><soapenv:Text xml:lang="en-US">error
> ...</soapenv:Text></soapenv:Reason>
> --------------------------
> If the client code does not have that line, the message is sent to server
> using SOAP 11 style,
> The response is a HTTP error from tomcat.
> ---------------------
> HTTP/1.1 500 Internal Server Error
> Server: Apache-Coyote/1.1
> Content-Type: text/html;charset=utf-8
> Content-Length: 1000
> Date: Thu, 23 Oct 2008 04:30:06 GMT
> Connection: close
>
> <html><head><title>Apache Tomcat/6.0.16 - Error
> report</title><style>...</style> </head><body><h1>HTTP Status 500 - </h1><HR
> size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b>
> <u></u></p><p><b>description</b> <u>The server encountered an internal error
> () that prevented it from fulfilling this request.</u></p><HR size="1"
> noshade="noshade"><h3>Apache Tomcat/6.0.16</h3></body></html>
> ----------------------------
>
> I traced the error to
> org.apache.axiom.soap.impl.builder.SOAP11BuilderHelper line 151
> private void processText(XMLStreamReader parser, OMElement value) {
>       try {
> 146            int token = parser.next();
> 147           while (token != XMLStreamReader.END_ELEMENT) {
> 148                if (token == XMLStreamReader.CHARACTERS) {
> 149                    factory.createOMText(value, parser.getText());
> 150                } else {
> 151                    throw new SOAPProcessingException(
>                           "Only Characters are allowed here");
>               }
>               token = parser.next();
>           }
>
>
>       } catch (XMLStreamException e) {
>           throw new SOAPProcessingException(e);
>       }
>   }
>
> When the error occurs, the value is an
> org.apache.axiom.soap.impl.dom.soap11.SOAP11FaultCodeImpl element. token is
> 1(StartElement).
>
> Is this a bug or something wrong in my code?
>
> thanks
>
> -jason
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Nandana Mihindukulasooriya
WSO2 inc.

http://nandana83.blogspot.com/
http://www.wso2.org