cancel
Showing results for 
Search instead for 
Did you mean: 

Execute Fault Message in Java Proxy

Former Member
0 Kudos

Hello,

I Call my Java Inbound Proxy and catch an exception.

How can i send now a Faul Message back to XI ?


} catch (Exception ex4) {
			ExchangeFaultData_Type faultData = new ExchangeFaultData_Type();
			faultData.setFaultText(ex4.getMessage());
			ErrorReturn_Type errorReturn = new ErrorReturn_Type();
			errorReturn.setStandard(faultData);
		}

What should i do ?

Regards,

Robin

Accepted Solutions (0)

Answers (1)

Answers (1)

sid-desh
Advisor
Advisor
0 Kudos

Hi Robin,

If you have specified the Fault Message in the Inbound Message Interface and have generated the proxy you will find in the *.template file that the Fault Message appears in the throws clause of the method.

So in your code you can just throw the Fault Message object.

Regards

Sidharth

Former Member
0 Kudos

Hi,

i throw it like:

} catch (Exception ex4) {
			ExchangeFaultData_Type faultData = new ExchangeFaultData_Type();
			faultData.setFaultText(ex4.getMessage());
			ErrorReturn_Type errorReturn = new ErrorReturn_Type();
			errorReturn.setStandard(faultData);
		
			throw new ErrorReturn_Message_Exception(); 	
		}

but nothing happend... no message in monitoring.

it can't be so difficult to send a fault message with the exception or is it?

sid-desh
Advisor
Advisor
0 Kudos

Hi Robin,

Did you check in RWB whether any exception was thrown.

Regards

Sidharth

Former Member
0 Kudos

Hi,

No nothing happend. I throw the exception but no message in any monitoring.

Regards,

Robin

Former Member
0 Kudos

Hi Robin:

Without knowing your complete code, I think what your are missing is "gluining" everything together, something like this:

Somewhere in your code, define some variables:

...

ExchangeFaultData_Type faultData = null;

FmJpAviso_Type fmJpAviso_Type = null;

FmJpAviso_Message fmJpAviso_Message = null;

FmJpAviso_Message_Exception fmJpAviso_Message_Exception = null;

...

catch( HibernateException ehibernate )

{

mensajeError = new StringBuffer();

mensajeError.append(DataComercial.PED_XI_BDI_DMS_DC_001).append("\n\n")

.append(ehibernate.toString());

catAPPL.fatalT(logger,mensajeError.toString());

// Default Integration Scenario ExchangeFault Message

faultData = new ExchangeFaultData_Type();

faultData.setFaultText(mensajeError.toString());

// My Fault Message Type for the inbound Message Interface

fmJpAviso_Type = new FmJpAviso_Type();

fmJpAviso_Type.setStandard(faultData);

// My Fault Message

fmJpAviso_Message = new FmJpAviso_Message();

fmJpAviso_Message.setFmJpAviso(fmJpAviso_Type);

// My Fault Message Exception

fmJpAviso_Message_Exception = new FmJpAviso_Message_Exception();

fmJpAviso_Message_Exception.setFmJpAviso_Message(fmJpAviso_Message);

ehibernate = null;

mensajeError = null;

// Inform XI about this situation in the Java Proxy

throw fmJpAviso_Message_Exception;

}

Hope this helps,

Regards, Pedro