Issue:
JAVA's wsimport tool yields collision errors when comsuming some PG web services (e.g.: Sandbox transaction management web service)
Cause:
wsdl generate below in ObjectFactory class:
createTransactionResponse(TransactionResponse), for complexType Transaction, element Response (Line 122),
createTransactionResponse(TransactionResponse), for complexType TransactionResponse (Line 172)
These two methods have name conflict.
Solution:
Use JXB file to change the name of complexType “Transaction” to “Trans”. JXB file as below, save it as for example cust.xjb. To import, use command
wsimport -s . -b cust.xjb https://sandbox.paymentsgateway.net/WS/Transaction.wsdl
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jaxb:bindings version="2.0" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<jaxb:bindings schemaLocation="https://sandbox.paymentsgateway.net/WS/Transaction.wsdl#types?schema1" node="/xs:schema">
<jaxb:bindings node="//xs:complexType[@name='Transaction']">
<jaxb:class name="Trans"/>
</jaxb:bindings>
</jaxb:bindings>
</jaxb:bindings>