- This topic has 4 replies, 2 voices, and was last updated 17 years, 11 months ago by Brian Fernandes.
-
AuthorPosts
-
carl-elMemberHi all.
I am currently (re)developing a webservice that does searches and inserts into a rather complex crm-system.
I am using the bottom-up approach (good thing i dont have a dirty imagination, or that sentence would sound wierd..^^), starting with pojos and an implementation class and from there generating the service.
-all this is working well, and predictably.now, i would like to return faults to the clients, since hardcoded status and messagefields in my returntypes is cumbersome both for me and my counterpart programming the client.
so, having declared my own fault-type to handle general errors i am looking for a way to send these to the client.
-atm when i throw my faults, my service does not return the fault-type, but only my standard data-type.-i have looked into the info at codehaus, but to no avail, having followed as mouch as i can of their examples (from what i understand, writing my own error-handler should not be necesary) , i still do not get Faults returned. -obvioulsly i am doing something wrong.
so my question to you is this:
-is there a code-example somewhwere of a service generated bottom-up, and uses Faults sucessfully? , or do you have some general tips of things people tend to miss, common errors if you will?
regards,
\carl
carl-elMemberoh, forgot to mention this:
of course i wrap my exceptions in an xfireexeption before i throw them
Brian FernandesModeratorCarl,
Can you try creating your extension class by subclassing org.codehaus.xfire.fault.FaultInfoException or org.codehause.xfire.fault.XFireFault and throwing that instead?
I think that should do the trick. Do let us know how it goes.
carl-elMemberHi brian and thank you for you reply.
my exception extends xfirefault, i have declared that my implementation class throws xfirefault and i still get the same result, ie no error returned, just a stacktrace.
Brian FernandesModeratorCarl,
1) Did you try the FaultInfoException?
2) The expected response when you throw an exception would be a <fault> section in the returned SOAP message, which your client should be programmed to handle (the conversion between the <fault> element and the exception on the client side is carried out by XFire). The web service implementation might print out the stack trace, depending on how it has been implemented. Is this your understanding as well – are we on the same page?
3) Can you try invoking the service from the WS Explorer and check if a <fault> element is being returned but perhaps incorrectly translated by XFire? (The WS Explorer can show you the source of the XML message returned)
4) Can you post the WSDL file generated by XFire for your service? You should find it at http://<server>:<port>/app/services and then click the WSDL link next to your service.
-
AuthorPosts