1 Reply Latest reply on Jul 10, 2007 10:40 AM by Thomas Diesler

    .NET client calling Java web-service (SOAPFaultException)

    Dave Wright Newbie

      Hi all

      We are replacing a set of .NET web-services with a set of Java ones (deployed into JBoss 4.0.5). All is fine with building/deploying/calling the web-services from .NET - however, I'm having some trouble with regards exceptions.

      The .NET client code (which we cannot change), has the following code:

      try {
       doWebServiceCall()
      }
      catch(SoapException se)
      {
      MessageBox.Show("Soap Exception Received! " + se.Message);
      outXmlBrowser.Navigate( WriteToTempFile(se.Detail.InnerXml), ref n_pointer, ref n_pointer, ref n_pointer, ref n_pointer);
      }


      The problem is highlighted in bold - I cannot seem to fill the Detail object being returned in the SOAPFaultException I throw in the web-service code. I'm throwing a simple SOAPFaultException as follows:

      try {
       String strXML = MyObject.getXML();
       Detail faultDetail = SOAPFactory.newInstance().createDetail();
       faultDetail.addChildElement("SoapErrorDetail").addChildElement(strXML);
      }
      catch(Exception e) {
       logit(e);
      }
      


      The following snippet shows the JBoss log file after the above code executes:

      2007-07-09 17:46:07,709 DEBUG [javax.xml.rpc.soap.SOAPFaultException] new SOAPFaultException [code={http://schemas.xmlsoap.org/soap/envelope/}Client,string=<?xml version="1.0" encoding="ISO-8859-1"?>
      <SoapErrorDetail xmlns="my.name.space.here" ResultCode="11400" ResultID="InternalError" ResultMessage="Internal error occured "/>
      ,actor=null,detail=null]
      


      As can be seen in bold, the Detail object is null....

      I have a few questions:

      i) How can I create the SOAPFaultException so that the Detail object is not null when it is pushed out of JBoss?
      ii) As seen above, I am pushing an XML string into the Detail object. However, I also have this XML document as an org.w3c.dom.Element object. Therefore, it is possible to push the XML document in this form into the Detail object in order to stop it being null? If so, how do I convert an org.w3c.dom.Element object into javax.xml.soap.SOAPElement object in order to add it to the Detail object set within the SOAPFaultException object.

      Is it possible to return a Detail object from JBoss?

      Thanks in advance for all your help,

      Thanks
      Kind regards
      Dave