Re: SOAPFaultException, maybe a bug in the framework?

2008-02-06 Thread Davide Gesino

I have added the bug in the JIRA. From here I cannot access the subversion
repository due to firewall problems... I can try it at home to change toe
code! 

Thanks 

Davide
-- 
View this message in context: 
http://www.nabble.com/SOAPFaultException%2C-weird-error-in-JAX-WS-Handlers-tp15269025p15306318.html
Sent from the cxf-user mailing list archive at Nabble.com.



Re: SOAPFaultException, maybe a bug in the framework?

2008-02-05 Thread Daniel Kulp

This is definitely a bug.I just traced through it and the 
HandlerChainInvoker doesn't convert the SOAPFaultException to our 
internal SoapFault.   Thus, the rest of the runtime just thinks it's a 
generic exception thing.   

Most likely, in the catch (ProtocolException) thing in 
HandlerChainInvoker, what we need to do is convert it before rethrowing 
it if on the server (not on the client or we'd just have to convert it 
back) if it's a SOAPFaultException.The code to do the convert is in 
the JAXWSMethodInvoker.Just need to copy it.  

Can you log a bug in jira with all this so it's tracked?   
https://issues.apache.org/jira/browse/CXF
I may be able to get to it later this week.   That said, feel free to 
copy the code from the method invoker, test it, and send a patch if it 
works.   :-)

Dan


On Monday 04 February 2008, Davide Gesino wrote:
 I am trying to throw a SOAPFaultException from an handler. Anyway I
 have some weird error in what I get back.
 I have tried the same code on java 6 without CXF and the handler chain
 works differently (with java 1.6 works fine)

 This is the handleMessage on my custom SOAPHandler (the way I fill the
 SOAPFault is taken from the SUN tutorial):

 1) WITH JAVA 6:

 public boolean handleMessage(SOAPMessageContext ctx) {
   Boolean outboundProperty = (Boolean) ctx
   .get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);

   if (!outboundProperty) {
   SOAPMessage msg = ctx.getMessage();
   SOAPBody body;
   try {
   body = msg.getSOAPBody();

   SOAPFault fault = body.addFault();
   QName faultName = new 
 QName(SOAPConstants.URI_NS_SOAP_ENVELOPE,
   Server);
   fault.setFaultCode(faultName);
   fault.setFaultActor(http://gizmos.com/orders;);
   fault.setFaultString(Server not responding);

   Detail detail = fault.addDetail();

   QName entryName = new 
 QName(http://gizmos.com/orders/;,
   order, PO);
   DetailEntry entry = 
 detail.addDetailEntry(entryName);
   entry.addTextNode(Quantity element does not 
 have a value);

   QName entryName2 = new 
 QName(http://gizmos.com/orders/;,
   order, PO);
   DetailEntry entry2 = 
 detail.addDetailEntry(entryName2);
   entry2.addTextNode(Incomplete address: no zip 
 code);

   throw new SOAPFaultException(fault);

   } catch (SOAPException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
   }
   }

   return true;
   }


 and here is the log of the message sent back to the client. The
 SOAPFault is populated correctly.

 soapenv:Fault
   faultcodesoapenv:Server/faultcode
   faultstringServer not responding/faultstring
   faultactorhttp://gizmos.com/orders/faultactor
   detail
 PO:order xmlns:PO=http://gizmos.com/orders/;Quantity
 element does not have a value/PO:order
 PO:order xmlns:PO=http://gizmos.com/orders/;Incomplete
 address: no zip code/PO:order
   /detail
   /soapenv:Fault

  2) WITH CXF + Java 5:

 I have the same handler doing the same work. debugging the SOAPFault
 seems to be populated correctly:
 Anyway logging the answer here is what I get.


  soap:Fault
   faultcodesoap:Server/faultcode
   faultstringServer not responding/faultstring
 /soap:Fault

 The actor and expecially the details are missing.
 I have tried debugging the
 org.apache.cxf.jaxws.handler.HandlerChainInvoker, but I was not abel
 to figure out if there is some error somewhere. Do you think it is a
 bug or an hidden error of mine?

 Thanks a lot.

 Davide



-- 
J. Daniel Kulp
Principal Engineer, IONA
[EMAIL PROTECTED]
http://www.dankulp.com/blog


SOAPFaultException, maybe a bug in the framework?

2008-02-04 Thread Davide Gesino

I am trying to throw a SOAPFaultException from an handler. Anyway I have some
weird error in what I get back.
I have tried the same code on java 6 without CXF and the handler chain works
differently (with java 1.6 works fine)

This is the handleMessage on my custom SOAPHandler (the way I fill the
SOAPFault is taken from the SUN tutorial):

1) WITH JAVA 6:

public boolean handleMessage(SOAPMessageContext ctx) {
Boolean outboundProperty = (Boolean) ctx
.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);

if (!outboundProperty) {
SOAPMessage msg = ctx.getMessage();
SOAPBody body;
try {
body = msg.getSOAPBody();

SOAPFault fault = body.addFault();
QName faultName = new 
QName(SOAPConstants.URI_NS_SOAP_ENVELOPE,
Server);
fault.setFaultCode(faultName);
fault.setFaultActor(http://gizmos.com/orders;);
fault.setFaultString(Server not responding);

Detail detail = fault.addDetail();

QName entryName = new 
QName(http://gizmos.com/orders/;,
order, PO);
DetailEntry entry = 
detail.addDetailEntry(entryName);
entry.addTextNode(Quantity element does not 
have a value);

QName entryName2 = new 
QName(http://gizmos.com/orders/;,
order, PO);
DetailEntry entry2 = 
detail.addDetailEntry(entryName2);
entry2.addTextNode(Incomplete address: no zip 
code);

throw new SOAPFaultException(fault);

} catch (SOAPException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

return true;
}


and here is the log of the message sent back to the client. The SOAPFault is
populated correctly.

soapenv:Fault
  faultcodesoapenv:Server/faultcode
  faultstringServer not responding/faultstring
  faultactorhttp://gizmos.com/orders/faultactor
  detail
PO:order xmlns:PO=http://gizmos.com/orders/;Quantity element does
not have a value/PO:order
PO:order xmlns:PO=http://gizmos.com/orders/;Incomplete address:
no zip code/PO:order
  /detail
  /soapenv:Fault

 2) WITH CXF + Java 5:

I have the same handler doing the same work. debugging the SOAPFault seems
to be populated correctly:
Anyway logging the answer here is what I get.


 soap:Fault
  faultcodesoap:Server/faultcode
  faultstringServer not responding/faultstring
/soap:Fault

The actor and expecially the details are missing. 
I have tried debugging the org.apache.cxf.jaxws.handler.HandlerChainInvoker,
but I was not abel to figure out if there is some error somewhere.
Do you think it is a bug or an hidden error of mine?

Thanks a lot.

Davide

-- 
View this message in context: 
http://www.nabble.com/SOAPFaultException%2C-maybe-a-bug-in-the-framework--tp15269025p15269025.html
Sent from the cxf-user mailing list archive at Nabble.com.