The moose likes Web Services and the fly likes SOAP Pojo Web Service JaxB Issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "SOAP Pojo Web Service JaxB Issue" Watch "SOAP Pojo Web Service JaxB Issue" New topic

SOAP Pojo Web Service JaxB Issue

Shrey Sinha

Joined: Jan 15, 2013
Posts: 1
Hi, this is my first inquiry so please pardon any non-conformity to the forum rules. I will try to adhere to any corrections given as feedback in future posts. First I would like to present my situation. I am developing SOAP web services as pojos. We currently use an RSA fix to version our stub packages created by jaxws, where the versioning resides in the xs:schema, version attribute. Moreover, more members of my team are beginning to develop pojo services, thus I would like to create a common utility jar which would contain all the stubs.

The issue I am encountering is that when I have two separate web services that use different versions of a schema, the compiler complains about two classes having the same XML type:

"Two classes have the same XML type name "{http://xxx.com/schemas/cim/zzz/contract}ContractType" (http://xxx.com/schemas/cim/zzz/contract%7DContractType). Use @XmlType.name and @XmlType.namespace to assign different names to them.
this problem is related to the following location:
at com.xxx.schemas.cim.zzz.contract_6.ContractType
at protected java.util.List com.xxx.services.yyy.productadministration.regulationsrequestsresponses_1.ContractRequestType.contract
at com.xxx.services.yyy.productadministration.regulationsrequestsresponses_1.ContractRequestType
at @javax.xml.bind.annotation.XmlSeeAlso(value=[class com.xxx.services.yyy.productadministration.regulationsrequestsresponses_1.ContractRequestType])
at com.xxx.services.yyy.relationshipmanagement.producerrelationshiprequestsresponses_1.AssignProducerByClientIDRequestType
this problem is related to the following location:
at com.xxx.schemas.cim.zzz.contract_5.ContractType
at protected com.xxx.schemas.cim.zzz.contract_5.ContractType com.xxx.services.yyy.relationshipmanagement.clientrequestsresponses_11.ClientRoleType.contract
at com.xxx.services.yyy.relationshipmanagement.clientrequestsresponses_11.ClientRoleType
at protected java.util.List com.xxx.services.yyy.relationshipmanagement.clientrequestsresponses_11.ClientRolesType.clientRole
at com.xxx.services.yyy.relationshipmanagement.clientrequestsresponses_11.ClientRolesType
at protected java.util.List com.xxx.services.yyy.relationshipmanagement.clientrequestsresponses_11.ClientRelationshipResponseType.clientContractRelationship
at com.xxx.services.yyy.relationshipmanagement.clientrequestsresponses_11.ClientRelationshipResponseType
at @javax.xml.bind.annotation.XmlSeeAlso(value=[class com.xxx.services.yyy.relationshipmanagement.producerrelationshiprequestsresponses_1.AssignProducerByClientIDResponseType, class com.xxx.services.yyy.relationshipmanagement.producerrelationshiprequestsresponses_1.AssignProducerByClientProfileResponseType, class com.xxx.services.yyy.relationshipmanagement.clientrequestsresponses_11.ClientRelationshipResponseType, class com.xxx.services.yyy.relationshipmanagement.clientrequestsresponses_11.ClientUnclaimedMailIndicatorResponseType, class com.xxx.services.yyy.relationshipmanagement.clientrequestsresponses_11.ClientUnclaimedMailResponseType, class com.xxx.schemas.framework.searchbaseresponse_2.SearchBaseResponseType, class com.xxx.services.yyy.relationshipmanagement.clientrequestsresponses_11.StatusResponseType])
at com.xxx.services.yyy.relationshipmanagement.producerrelationshiprequestsresponses_1.AssignProducerByClientIDResponseType
The element name {http://xxx.com/schemas/cim/zzz/contract}Contract (http://xxx.com/schemas/cim/zzz/contract%7DContract) has more than one mapping.
this problem is related to the following location:
at public javax.xml.bind.JAXBElement com.xxx.schemas.cim.zzz.contract_6.ObjectFactory.createContract(com.xxx.schemas.cim.zzz.contract_6.ContractType)
at com.xxx.schemas.cim.zzz.contract_6.ObjectFactory
this problem is related to the following location:
at public javax.xml.bind.JAXBElement com.xxx.schemas.cim.zzz.contract_5.ObjectFactory.createContract(com.xxx.schemas.cim.zzz.contract_5.ContractType)
at com.xxx.schemas.cim.zzz.contract_5.ObjectFactory"

This problem persists as a stand alone Dynamic Web Project. Furthermore the versioning is not carried into the annotation namespace created by jaxb. Hence the compiler is confused on what class/object to instantiate. So my question is what are some solutions to deal with this issue?

Some solutions I have tried is to remove the @XmlSeeAlso from the Port Type implementation, however that does not resolve anything. Also, I have tried to append the version in the annotation namespace, however that requires manually changing the code not only in the Type class, but the ObjectFactory class as well as the package-info class. When managing hundreds of schemas this is not a plausible solution. Any help is much appreciated.

It is sorta covered in the JavaRanch Style Guide.
subject: SOAP Pojo Web Service JaxB Issue
Similar Threads
Passing Set<java.lang.Object> and List<java.lang.Object> in Axis 2.0
Top-Down approach: WSDL, JAX-WS and JAXB
Jboss 4.2 + Web Services
More fun with JAXB, trying to implement Oasis WSN top down - errors genned
JAXB annotation error