Hi Sean, my JAX-WS handler tutorial (http://www.jroller.com/gmazza/entry/jaxws_handler_tutorial) throws a few exceptions, it might have code useful for you.

Regards,
Glen

On 08/13/2012 04:49 PM, seanhouse79 wrote:
Hi,

I am trying to create a SOAPHandler or LogicalHandler to simulate a soap
fault response. My response fault response is like this:

<env:Envelope
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/";><env:Header/><env:Body><env:Fault><faultcode>env:Server</faultcode><faultstring>An
unexpected/unhandled exception
occurred</faultstring><detail><ns2:GeneralException
xmlns:ns2="http://my.webservice/";><message>An unexpected/unhandled exception
occurred</message></ns2:GeneralException></detail></env:Fault></env:Body></env:Envelope>

I tried to create a payload from JAXBContext out of the soap body and set
that payload to the LogicalMessageContext but it doesn't work. The error is
saying that "The prefix "env" for element "env:Fault" is not bound".

Here is what I did:
// the responseMessage is   <env:Fault> ...</env:Fault>
ByteArrayInputStream bais = new
ByteArrayInputStream(responseMessage.getBytes());
Object obj = jaxbContext.createUnmarshaller().unmarshal(bais);
logicalMessageContext.getMessage().setPayload(obj, jaxbContext);

Can you help me figure it out?

Thanks,

Sean Nguyen




--
View this message in context: 
http://cxf.547215.n5.nabble.com/How-to-simulate-a-soap-fault-response-with-LogicalHandler-or-SOAPHandler-tp5712444.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to