简体   繁体   中英

JAX-WS and JAX-RPC Client Fault Handling

I have a WSDL that was originally designed for JAX-RPC use. When I generate the client classes in JAX-RPC the exception it throws are correct and as per specifications. But when I use the same wsdl and generate the JAX-WS classes the exception class are very different. Now at this time when I call the service from JAX-WS I am not able to catch the correct exceptions.

Has some one faced a similar issue? JAX-WS Class

public PaymentReference create(
    @WebParam(name = "cardCreateInfo", targetNamespace = "http://schema.XXX.com/2009/11/member/paymentInformation")
    CardCreateInfo cardCreateInfo)
    throws IfFaultMsg, IfSvcFaultMsg, InvalidCardHolderNameFaultMsg, InvalidExpirationDayFaultMsg, InvalidExpirationMonthFaultMsg, InvalidExpirationYearFaultMsg, InvalidPrimaryAccountNumberFaultMsg, InvalidTargetNameSpaceFaultMsg, PaymentInformationFaultMsg, PotentialDuplicateFoundFaultMsg, UnauthorizedApplicationFaultMsg
;

JAX-RPC Class

public com.XXX.YYY.ZZZ.spiborIntegration.models.paymentInformation.PaymentReference create(com.XXX.YYY.ZZZ.spiborIntegration.models.paymentInformation.CardCreateInfo cardCreateInfo) throws java.rmi.RemoteException, com.XXX.YYY.ZZZ.spiborIntegration.models.paymentInformation.InvalidCardHolderNameException, com.XXX.YYY.ZZZ.spiborIntegration.models.exception.IFException, com.XXX.YYY.ZZZ.spiborIntegration.models.paymentInformation.UnauthorizedApplicationException, com.XXX.YYY.ZZZ.spiborIntegration.models.paymentInformation.InvalidPrimaryAccountNumberException, com.XXX.YYY.ZZZ.spiborIntegration.models.paymentInformation.InvalidExpirationMonthException, com.XXX.YYY.ZZZ.spiborIntegration.models.paymentInformation.InvalidExpirationDayException, com.XXX.YYY.ZZZ.spiborIntegration.models.paymentInformation.PaymentInformationException, com.XXX.YYY.ZZZ.spiborIntegration.models.paymentInformation.PotentialDuplicateFoundException, com.XXX.YYY.ZZZ.spiborIntegration.models.paymentInformation.InvalidExpirationYearException, com.XXX.YYY.ZZZ.spiborIntegration.models.paymentInformation.InvalidTargetNameSpaceException, com.XXX.YYY.ZZZ.spiborIntegration.models.exception.IFSvcException;

Is there a way to make sure the JAX-WS follows the pattern from JAX-RPC? Or if there is a way to catch the exception thrown as per JAX-RPC in the JAX-WS client classes.

You can use an external binding file as described in WSDL Customization to customise the mapping of WSDL faults to exception names.

This is described explicitly in The Exception Class .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM