This seems to work, thanks. On Tue, May 3, 2016 at 10:04 PM Andrei Shakirin <[email protected]> wrote:
> Hi, > > If you don't need to set soap fault details, it should be enough just to > throw WebServiceException. > > If yes: > SoapVersion version = ((SoapMessage) > PhaseInterceptorChain.getCurrentMessage()).getVersion(); > throw SoapFault.createFault(yourFault, version); > > Regards, > Andrei. > > > -----Original Message----- > > From: Idar Borlaug [mailto:[email protected]] > > Sent: Dienstag, 3. Mai 2016 12:49 > > To: [email protected] > > Subject: Throwing soap fault > > > > Hi > > > > I have a client that wants my service to throw a Client /Sender > exception, > > when the error is a problem on the clients side. > > > > I haven't used named exceptions and can't implement that now. > > I tried this code: > > QName faultNameSoap12 = new > > QName(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE, > > "Sender"); > > SOAPFault fault = null; > > try { > > fault = SOAPFactory.newInstance().createFault(e.getMessage(), > > faultNameSoap12); > > } catch (SOAPException e1) { > > } > > throw new SOAPFaultException(fault); > > > > The problem is that some clients use SOAP 1.1 and some use SOAP 1.2, and > i > > can't find a way to read which version this call is and return the > correct soap > > fault. > > > > Am i doing this totaly wrong? Or is there some way to read which version > is in > > use now? > > -- > > Idar Borlaug > -- Idar Borlaug
