[JBoss Web Services Users] - How do I catch a user define exception on the client (SOAP/J
by newmanw10
Seems like I am following the spec correctly and JAX-RPC is generating the exception class correctly (I think), but I still cannot get this to work. I am wondering if there is something configuration wise that I need to setup in JBoss to get the correct exception back on the client side.
I have a user defined exception:
| <xsd:element name="TestExceptionElement" type="xsd:string"/>
|
| <message name="TestException">
| <part name="message" type="TestExceptionElement"/>
| </message>;
| .
| .
| <operation name="throwTestException">
| <input message="tns:throwTestException_request"/>
| <output message="tns:throwTestException_response"/>
| <fault name="TestException" message="tns:TestException"/>
| </operation>
|
This generates the following code for the exception:
| public class TestException extends java.lang.Exception {
| private java.lang.String message;
|
| public TestException(java.lang.String message) {
| super(message);
| this.message = message;
| }
|
| public String getMessage() {
| return message;
| }
| }
|
When I throw this exception on the server side things look ok. However on the client side I catch a SOAPFaultException instead of my TestException. Has anyone successfully defined an exception and caught that exception on the client side?
Thanks,
Billy
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4258420#4258420
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4258420
15 years, 3 months
[JBoss Web Services Users] - How do I catch a user define exception on the client (SOAP/J
by newmanw10
Seems like I am following the spec correctly and JAX-RPC is generating the exception class correctly (I think), but I still cannot get this to work. I am wondering if there is something configuration wise that I need to setup in JBoss to get the correct exception back on the client side.
I have a user defined exception:
| <xsd:element name="TestExceptionElement" type="xsd:string"/>;
|
| <message name="TestException">
| <part name="message" type="TestExceptionElement"/>;
| </message>;
| .
| .
| <operation name="throwTestException">
| <input message="tns:throwTestException_request"/>;
| <output message="tns:throwTestException_response"/>
| <fault name="TestException" message="tns:TestException"/>
| </operation>
|
This generates the following code for the exception:
| public class TestException extends java.lang.Exception {
| private java.lang.String message;
|
| public TestException(java.lang.String message) {
| super(message);
| this.message = message;
| }
|
| public String getMessage() {
| return message;
| }
| }
|
When I throw this exception on the server side things look ok. However on the client side I catch a SOAPFaultException instead of my TestException. Has anyone successfully defined an exception and caught that exception on the client side?
Thanks,
Billy
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4258419#4258419
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4258419
15 years, 3 months
[JBoss Web Services Users] - How do I catch a user define exception on the client (SOAP/J
by newmanw10
Seems like I am following the spec correctly and JAX-RPC is generating the exception class correctly (I think), but I still cannot get this to work. I am wondering if there is something configuration wise that I need to setup in JBoss to get the correct exception back on the client side.
I have a user defined exception:
| <xsd:element name="TestExceptionElement" type="xsd:string"/>
|
| <message name="TestException">
| <part name="message" type="TestExceptionElement"/>
| </message>
| .
| .
| <operation name="throwTestException">
| <input message="tns:throwTestException_request"/>
| <output message="tns:throwTestException_response"/>
| <fault name="TestException" message="tns:TestException"t/>
| </operation>
|
This generates the following code for the exception:
| public class TestException extends java.lang.Exception {
| private java.lang.String message;
|
| public TestException(java.lang.String message) {
| super(message);
| this.message = message;
| }
|
| public String getMessage() {
| return message;
| }
| }
|
When I throw this exception on the server side things look ok. However on the client side I catch a SOAPFaultException instead of my TestException. Has anyone successfully defined an exception and caught that exception on the client side?
Thanks,
Billy
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4258418#4258418
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4258418
15 years, 3 months
[JBoss Web Services Users] - Re: OutOfMemory exception when loading xml schemas in WSDL
by wellerk
Still had issues with deploying complex hl7 webservice. Here is a patch to WSDL11Reader (version 3.1.1) that solved my HL7V3 issues:
| --- WSDL11Reader.java 2009-09-25 13:06:36.847867600 -0400
| +++ WSDL11Reader.java.new 2009-10-01 18:46:58.741045900 -0400
| @@ -145,6 +145,8 @@
|
| // Temporary files used by this reader.
| private List<File> tempFiles = new ArrayList<File>();
| + private Map<String, String> publocation = new HashMap<String, String>();
| + private List<String> published = new ArrayList<String>();
|
| // SWA handling
| private Map<QName, List<String>> skippedSWAParts = new HashMap<QName, List<String>>();
| @@ -423,7 +425,6 @@
| String localname = domElementClone.getLocalName();
| try
| {
| - List<URL> published = new LinkedList<URL>();
| if ("import".equals(localname))
| {
| processSchemaImport(destTypes, wsdlLoc, domElementClone, published);
| @@ -436,8 +437,8 @@
| {
| throw new IllegalArgumentException("Unsuported schema element: " + localname);
| }
| - published.clear();
| - published = null;
| +// published.clear();
| +// published = null;
| }
| catch (IOException e)
| {
| @@ -529,7 +530,7 @@
| }
| }
|
| - private void processSchemaImport(WSDLTypes types, URL wsdlLoc, Element importEl, List<URL> published) throws IOException, WSDLException
| + private void processSchemaImport(WSDLTypes types, URL wsdlLoc, Element importEl, List<String> published) throws IOException, WSDLException
| {
| if (wsdlLoc == null)
| throw new IllegalArgumentException("Cannot process import, parent location not set");
| @@ -542,16 +543,25 @@
|
| URL locationURL = getLocationURL(wsdlLoc, location);
| Element rootElement = DOMUtils.parse(new ResourceURL(locationURL).openStream());
| - if (!published.contains(locationURL))
| + if (!published.contains(locationURL.toExternalForm()))
| {
| - published.add(locationURL);
| + published.add(locationURL.toExternalForm());
| URL newloc = processSchemaInclude(types, locationURL, rootElement, published);
| - if (newloc != null)
| + if (newloc != null) {
| importEl.setAttribute("schemaLocation", newloc.toExternalForm());
| + publocation.put(locationURL.toExternalForm(), newloc.toExternalForm());
| + }
| + }
| + else {
| + if (publocation.containsKey(locationURL.toExternalForm())) {
| + if (publocation.get(locationURL.toExternalForm()) != null) {
| + importEl.setAttribute("schemaLocation", (String)publocation.get(locationURL));
| + }
| + }
| }
| }
|
| - private URL processSchemaInclude(WSDLTypes types, URL wsdlLoc, Element schemaEl, List<URL> published) throws IOException, WSDLException
| + private URL processSchemaInclude(WSDLTypes types, URL wsdlLoc, Element schemaEl, List<String> published) throws IOException, WSDLException
| {
| if (wsdlLoc == null)
| throw new IllegalArgumentException("Cannot process iclude, parent location not set");
| @@ -580,12 +590,21 @@
|
| URL locationURL = getLocationURL(wsdlLoc, location);
| Element rootElement = DOMUtils.parse(new ResourceURL(locationURL).openStream());
| - if (!published.contains(locationURL))
| + if (!published.contains(locationURL.toExternalForm()))
| {
| - published.add(locationURL);
| + published.add(locationURL.toExternalForm());
| URL newloc = processSchemaInclude(types, locationURL, rootElement, published);
| - if (newloc != null)
| + if (newloc != null) {
| includeEl.setAttribute("schemaLocation", newloc.toExternalForm());
| + publocation.put(locationURL.toExternalForm(),newloc.toExternalForm());
| + }
| + }
| + else {
| + if (publocation.containsKey(locationURL.toExternalForm())) {
| + if (publocation.get(locationURL.toExternalForm()) != null) {
| + includeEl.setAttribute("schemaLocation", (String)publocation.get(locationURL));
| + }
| + }
| }
| }
|
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4258296#4258296
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4258296
15 years, 3 months