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 Christian Mielke <cm...@nc-ag.de> on 2009/09/25 11:53:36 UTC

Additional XML prefixes when client receives SOAP fault

Hello, 
I have a problem with XML prefixes. When the SOAP message leaves the server with a fault the body looks like this: 

<soapenv:Body xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="Id-25568549">
	<soapenv:Fault>
		<soapenv:Code>
			<soapenv:Value>soapenv:Receiver</soapenv:Value>
		</soapenv:Code>
		<soapenv:Reason>
			<soapenv:Text xml:lang="en-US">ENFORCED ERROR THROWN CORRECTLY</soapenv:Text>
		</soapenv:Reason>
		<soapenv:Detail>
			<serviceFault xmlns="http://www.foo.net/test/xsd/sys/common">
				<faultcode>99990010</faultcode>
				<reason>ENFORCED ERROR THROWN CORRECTLY</reason>
				<node/>
				<detail>ENFORCED ERROR THROWN CORRECTLY</detail>
				<ctxId>AC10014E00000123F082FFAD00000001</ctxId>
				<timestamp>2009-09-25T11:23:32.156+02:00</timestamp>
			</serviceFault>
		</soapenv:Detail>
	</soapenv:Fault>
</soapenv:Body>

But the client takes this body out of the stream: 

<soapenv:Body xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="Id-25568549">
	<soapenv:Fault>
		<soapenv:Code>
			<soapenv:Value>soapenv:Receiver</soapenv:Value>
		</soapenv:Code>
		<soapenv:Reason>
			<soapenv:Text xml:lang="en-US">ENFORCED ERROR THROWN CORRECTLY</soapenv:Text>
		</soapenv:Reason>
		<soapenv:Detail>
			<axis2ns1:serviceFault xmlns:axis2ns1="http://www.foo.net/test/xsd/sys/common">
				<axis2ns1:faultcode>99990010</axis2ns1:faultcode>
				<axis2ns1:reason>ENFORCED ERROR THROWN CORRECTLY</axis2ns1:reason>
				<axis2ns1:node/>
				<axis2ns1:detail>ENFORCED ERROR THROWN CORRECTLY</axis2ns1:detail>
				<axis2ns1:ctxId>AC10014E00000123F082FFAD00000001</axis2ns1:ctxId>
				<axis2ns1:timestamp>2009-09-25T11:23:32.156+02:00</axis2ns1:timestamp>
			</axis2ns1:serviceFault>
		</soapenv:Detail>
	</soapenv:Fault>
</soapenv:Body>



You can see that there is no prefix in the serviceFault tag on the server side but the client puts the prefix "axis2ns1" into the body. For me this is a problem because the body is signed on the server side and the client calculates the hash with this prefix. That leads to signature verification failure. Would be great if you can help me. 
Greetings 
Christian 



Re: Additional XML prefixes when client receives SOAP fault

Posted by don t <do...@verizonwireless.com>.
Hi, you can convert the XML document to a new document without the prefixes.
Then execute your hash function on the new document. One way to convert XML
documents is using XSLT. See this link for example:

https://www.stylusstudio.com/xsllist/200812/post70070.html


Chris82KS wrote:
> 
> Hello, 
> I have a problem with XML prefixes. When the SOAP message leaves the
> server with a fault the body looks like this: 
> 
> <soapenv:Body
> xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
> wsu:Id="Id-25568549">
> 	<soapenv:Fault>
> 		<soapenv:Code>
> 			<soapenv:Value>soapenv:Receiver</soapenv:Value>
> 		</soapenv:Code>
> 		<soapenv:Reason>
> 			<soapenv:Text xml:lang="en-US">ENFORCED ERROR THROWN
> CORRECTLY</soapenv:Text>
> 		</soapenv:Reason>
> 		<soapenv:Detail>
> 			<serviceFault xmlns="http://www.foo.net/test/xsd/sys/common">
> 				<faultcode>99990010</faultcode>
> 				<reason>ENFORCED ERROR THROWN CORRECTLY</reason>
> 				<node/>
> 				<detail>ENFORCED ERROR THROWN CORRECTLY</detail>
> 				<ctxId>AC10014E00000123F082FFAD00000001</ctxId>
> 				<timestamp>2009-09-25T11:23:32.156+02:00</timestamp>
> 			</serviceFault>
> 		</soapenv:Detail>
> 	</soapenv:Fault>
> </soapenv:Body>
> 
> But the client takes this body out of the stream: 
> 
> <soapenv:Body xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"
> xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
> wsu:Id="Id-25568549">
> 	<soapenv:Fault>
> 		<soapenv:Code>
> 			<soapenv:Value>soapenv:Receiver</soapenv:Value>
> 		</soapenv:Code>
> 		<soapenv:Reason>
> 			<soapenv:Text xml:lang="en-US">ENFORCED ERROR THROWN
> CORRECTLY</soapenv:Text>
> 		</soapenv:Reason>
> 		<soapenv:Detail>
> 			<axis2ns1:serviceFault
> xmlns:axis2ns1="http://www.foo.net/test/xsd/sys/common">
> 				<axis2ns1:faultcode>99990010</axis2ns1:faultcode>
> 				<axis2ns1:reason>ENFORCED ERROR THROWN CORRECTLY</axis2ns1:reason>
> 				<axis2ns1:node/>
> 				<axis2ns1:detail>ENFORCED ERROR THROWN CORRECTLY</axis2ns1:detail>
> 				<axis2ns1:ctxId>AC10014E00000123F082FFAD00000001</axis2ns1:ctxId>
> 				<axis2ns1:timestamp>2009-09-25T11:23:32.156+02:00</axis2ns1:timestamp>
> 			</axis2ns1:serviceFault>
> 		</soapenv:Detail>
> 	</soapenv:Fault>
> </soapenv:Body>
> 
> 
> 
> You can see that there is no prefix in the serviceFault tag on the server
> side but the client puts the prefix "axis2ns1" into the body. For me this
> is a problem because the body is signed on the server side and the client
> calculates the hash with this prefix. That leads to signature verification
> failure. Would be great if you can help me. 
> Greetings 
> Christian 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Additional-XML-prefixes-when-client-receives-SOAP-fault-tp25609385p25706726.html
Sent from the Axis - User mailing list archive at Nabble.com.


Re: Additional XML prefixes when client receives SOAP fault

Posted by Amila Suriarachchi <am...@gmail.com>.
On Fri, Sep 25, 2009 at 3:23 PM, Christian Mielke <cm...@nc-ag.de> wrote:

> Hello,
> I have a problem with XML prefixes. When the SOAP message leaves the server
> with a fault the body looks like this:
>
> <soapenv:Body xmlns:wsu="
> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
> wsu:Id="Id-25568549">
>        <soapenv:Fault>
>                <soapenv:Code>
>                        <soapenv:Value>soapenv:Receiver</soapenv:Value>
>                </soapenv:Code>
>                <soapenv:Reason>
>                        <soapenv:Text xml:lang="en-US">ENFORCED ERROR THROWN
> CORRECTLY</soapenv:Text>
>                </soapenv:Reason>
>                <soapenv:Detail>
>                        <serviceFault xmlns="
> http://www.foo.net/test/xsd/sys/common">
>                                <faultcode>99990010</faultcode>
>                                <reason>ENFORCED ERROR THROWN
> CORRECTLY</reason>
>                                <node/>
>                                <detail>ENFORCED ERROR THROWN
> CORRECTLY</detail>
>
>  <ctxId>AC10014E00000123F082FFAD00000001</ctxId>
>
>  <timestamp>2009-09-25T11:23:32.156+02:00</timestamp>
>                        </serviceFault>
>                </soapenv:Detail>
>        </soapenv:Fault>
> </soapenv:Body>
>
> But the client takes this body out of the stream:
>
> <soapenv:Body xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"
> xmlns:wsu="
> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
> wsu:Id="Id-25568549">
>        <soapenv:Fault>
>                <soapenv:Code>
>                        <soapenv:Value>soapenv:Receiver</soapenv:Value>
>                </soapenv:Code>
>                <soapenv:Reason>
>                        <soapenv:Text xml:lang="en-US">ENFORCED ERROR THROWN
> CORRECTLY</soapenv:Text>
>                </soapenv:Reason>
>                <soapenv:Detail>
>                        <axis2ns1:serviceFault xmlns:axis2ns1="
> http://www.foo.net/test/xsd/sys/common">
>
>  <axis2ns1:faultcode>99990010</axis2ns1:faultcode>
>                                <axis2ns1:reason>ENFORCED ERROR THROWN
> CORRECTLY</axis2ns1:reason>
>                                <axis2ns1:node/>
>                                <axis2ns1:detail>ENFORCED ERROR THROWN
> CORRECTLY</axis2ns1:detail>
>
>  <axis2ns1:ctxId>AC10014E00000123F082FFAD00000001</axis2ns1:ctxId>
>
>  <axis2ns1:timestamp>2009-09-25T11:23:32.156+02:00</axis2ns1:timestamp>
>                        </axis2ns1:serviceFault>
>                </soapenv:Detail>
>        </soapenv:Fault>
> </soapenv:Body>
>
>
>
> You can see that there is no prefix in the serviceFault tag on the server
> side but the client puts the prefix "axis2ns1" into the body. For me this is
> a problem because the body is signed on the server side and the client
> calculates the hash with this prefix. That leads to signature verification
> failure. Would be great if you can help me.
>

do you sign the soap message using Rampart (ws-security implementation for
Axis2) or with your code?

thanks,
Amila.

> Greetings
> Christian
>
>
>


-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/