You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by cj91 <Jo...@argushealth.com> on 2009/08/26 21:00:14 UTC

Controlling namespace prefixes in SoapFaults

Perhaps, i'm too picky, but I'd like to be able to control the prefix names
of exceptions that are thrown in my service. I know... REALLY picky! Let me
show you my current output after I throw soapfault:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:client</faultcode>
         <faultstring>blah blah blah try again</faultstring>
         <detail>
            <ns1:MyExceptionClass xmlns:ns1="http://my.custom.namespace"/>
         </detail>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>


I'd like for this to appear maybe like:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:client</faultcode>
         <faultstring>blah blah blah try again</faultstring>
         <detail>
            <custom:MyExceptionClass
xmlns:custom="http://my.custom.namespace"/>
         </detail>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>


this is the code to generate the above fault:

		return postDatedAdapter.getEligibility(request, credentials);
		} catch (MyExceptionClass e){
			throw new SoapFault(e.getMessage(), e, new
QName("http://schemas.xmlsoap.org/soap/envelope/", "client"));
		}

I have a namespace mapper in my spring configuration, which works during
normal operation, but not on the exceptions:

	<util:map id="nameSpaceMap">
	    <entry key="http://my.custom.namespace" value="custom" />
	</util:map>



Not a panic situation if it can't be done... Just nit picking. Thanks!
-- 
View this message in context: http://www.nabble.com/Controlling-namespace-prefixes-in-SoapFaults-tp25153601p25153601.html
Sent from the cxf-user mailing list archive at Nabble.com.


RE: Controlling namespace prefixes in SoapFaults

Posted by "Fisher, Jonathan" <Jo...@argushealth.com>.
Thanks Daniel! I'll see about that patch

-----Original Message-----
From: Daniel Kulp [mailto:dkulp@apache.org] 
Sent: Wednesday, August 26, 2009 3:08 PM
To: users@cxf.apache.org
Cc: Fisher, Jonathan
Subject: Re: Controlling namespace prefixes in SoapFaults


(sorry, hit send accidentally)

Right now, the answer is that there isn't a way to control it.  

If you want to log an issue in JIRA, that would be fine.   Even better,
if you 
would like to submit a patch, the place to look at is line 245 of 
JAXBEncoderDecoder.   Basically, that method would have to have an extra

parameter added of a namespace map which the jaxb.io.DataWriterImpl
could grab 
from the JAXBDataBinding.   A pretty simple set of changes actually if
you'd 
like to pursue it.

Dan


On Wed August 26 2009 3:00:14 pm cj91 wrote:
> Perhaps, i'm too picky, but I'd like to be able to control the prefix
names
> of exceptions that are thrown in my service. I know... REALLY picky!
Let me
> show you my current output after I throw soapfault:
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>    <soap:Body>
>       <soap:Fault>
>          <faultcode>soap:client</faultcode>
>          <faultstring>blah blah blah try again</faultstring>
>          <detail>
>             <ns1:MyExceptionClass
xmlns:ns1="http://my.custom.namespace"/>
>          </detail>
>       </soap:Fault>
>    </soap:Body>
> </soap:Envelope>
>
>
> I'd like for this to appear maybe like:
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>    <soap:Body>
>       <soap:Fault>
>          <faultcode>soap:client</faultcode>
>          <faultstring>blah blah blah try again</faultstring>
>          <detail>
>             <custom:MyExceptionClass
> xmlns:custom="http://my.custom.namespace"/>
>          </detail>
>       </soap:Fault>
>    </soap:Body>
> </soap:Envelope>
>
>
> this is the code to generate the above fault:
>
> 		return postDatedAdapter.getEligibility(request,
credentials);
> 		} catch (MyExceptionClass e){
> 			throw new SoapFault(e.getMessage(), e, new
> QName("http://schemas.xmlsoap.org/soap/envelope/", "client"));
> 		}
>
> I have a namespace mapper in my spring configuration, which works
during
> normal operation, but not on the exceptions:
>
> 	<util:map id="nameSpaceMap">
> 	    <entry key="http://my.custom.namespace" value="custom" />
> 	</util:map>
>
>
>
> Not a panic situation if it can't be done... Just nit picking. Thanks!

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

PRIVILEGED AND CONFIDENTIAL
This email transmission contains privileged and confidential information intended only for the use of the individual or entity named above.  If the reader of the email is not the intended recipient or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that any use, dissemination or copying of this email transmission is strictly prohibited by the sender.  If you have received this transmission in error, please delete the email and immediately notify the sender via the email return address or mailto:postmaster@argushealth.com.  Thank you.





Re: Controlling namespace prefixes in SoapFaults

Posted by Daniel Kulp <dk...@apache.org>.
(sorry, hit send accidentally)

Right now, the answer is that there isn't a way to control it.  

If you want to log an issue in JIRA, that would be fine.   Even better, if you 
would like to submit a patch, the place to look at is line 245 of 
JAXBEncoderDecoder.   Basically, that method would have to have an extra 
parameter added of a namespace map which the jaxb.io.DataWriterImpl could grab 
from the JAXBDataBinding.   A pretty simple set of changes actually if you'd 
like to pursue it.

Dan


On Wed August 26 2009 3:00:14 pm cj91 wrote:
> Perhaps, i'm too picky, but I'd like to be able to control the prefix names
> of exceptions that are thrown in my service. I know... REALLY picky! Let me
> show you my current output after I throw soapfault:
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>    <soap:Body>
>       <soap:Fault>
>          <faultcode>soap:client</faultcode>
>          <faultstring>blah blah blah try again</faultstring>
>          <detail>
>             <ns1:MyExceptionClass xmlns:ns1="http://my.custom.namespace"/>
>          </detail>
>       </soap:Fault>
>    </soap:Body>
> </soap:Envelope>
>
>
> I'd like for this to appear maybe like:
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>    <soap:Body>
>       <soap:Fault>
>          <faultcode>soap:client</faultcode>
>          <faultstring>blah blah blah try again</faultstring>
>          <detail>
>             <custom:MyExceptionClass
> xmlns:custom="http://my.custom.namespace"/>
>          </detail>
>       </soap:Fault>
>    </soap:Body>
> </soap:Envelope>
>
>
> this is the code to generate the above fault:
>
> 		return postDatedAdapter.getEligibility(request, credentials);
> 		} catch (MyExceptionClass e){
> 			throw new SoapFault(e.getMessage(), e, new
> QName("http://schemas.xmlsoap.org/soap/envelope/", "client"));
> 		}
>
> I have a namespace mapper in my spring configuration, which works during
> normal operation, but not on the exceptions:
>
> 	<util:map id="nameSpaceMap">
> 	    <entry key="http://my.custom.namespace" value="custom" />
> 	</util:map>
>
>
>
> Not a panic situation if it can't be done... Just nit picking. Thanks!

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: Controlling namespace prefixes in SoapFaults

Posted by Daniel Kulp <dk...@apache.org>.
On Wed August 26 2009 3:00:14 pm cj91 wrote:
> Perhaps, i'm too picky, but I'd like to be able to control the prefix names
> of exceptions that are thrown in my service. I know... REALLY picky! Let me
> show you my current output after I throw soapfault:
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>    <soap:Body>
>       <soap:Fault>
>          <faultcode>soap:client</faultcode>
>          <faultstring>blah blah blah try again</faultstring>
>          <detail>
>             <ns1:MyExceptionClass xmlns:ns1="http://my.custom.namespace"/>
>          </detail>
>       </soap:Fault>
>    </soap:Body>
> </soap:Envelope>
>
>
> I'd like for this to appear maybe like:
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>    <soap:Body>
>       <soap:Fault>
>          <faultcode>soap:client</faultcode>
>          <faultstring>blah blah blah try again</faultstring>
>          <detail>
>             <custom:MyExceptionClass
> xmlns:custom="http://my.custom.namespace"/>
>          </detail>
>       </soap:Fault>
>    </soap:Body>
> </soap:Envelope>
>
>
> this is the code to generate the above fault:
>
> 		return postDatedAdapter.getEligibility(request, credentials);
> 		} catch (MyExceptionClass e){
> 			throw new SoapFault(e.getMessage(), e, new
> QName("http://schemas.xmlsoap.org/soap/envelope/", "client"));
> 		}
>
> I have a namespace mapper in my spring configuration, which works during
> normal operation, but not on the exceptions:
>
> 	<util:map id="nameSpaceMap">
> 	    <entry key="http://my.custom.namespace" value="custom" />
> 	</util:map>
>
>
>
> Not a panic situation if it can't be done... Just nit picking. Thanks!

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog