1

I am facing the same issue as mentioned in the link below , but the fix suggested there is not working for me.I am kinda new to webservices so any help is appreciated.

wsimport-two-declarations-cause-a-collision-same-line-given

I am trying to generate Java classes from a wsdl using wsimport.

command used : wsimport -keep -B-XautoNameResolution targetService.wsdl

It is throwing the error :

[ERROR] Two declarations cause a collision in the ObjectFactory class.
  line 2467 of http:///abcxyz.com/ws/custom_fields.php

[ERROR] (Related to above error) This is the other declaration.
  line 2557 of http:///abcxyz.com/ws//custom_fields.php

[ERROR] Two declarations cause a collision in the ObjectFactory class.
  line 2719 of http:///abcxyz.com/ws/custom_fields.php

[ERROR] (Related to above error) This is the other declaration.
  line 2809 of http://abcxyz.com/ws/custom_fields.php

There is another reference which suggested including bindings.xjb with some entries which I am not sure of.

Wsdl file :

<?xml version="1.0" encoding="ISO-8859-1"?>
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://abcxyz/WS" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:syn="http://abcxyz/Types" xmlns:synfields="http://abcxyz/CustomFields" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://abcxyz/WS">
    <types>
        <xsd:schema targetNamespace="http://integrations.synacor.com/PhoenixWS" xmlns:syn="http://abcxyz.com/Types" xmlns:synfields="http://abcxyz.com/CustomFields">
            <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
            <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/"/>
            <xsd:import schemaLocation="http://abcxyz.com/api/ws/types.php" namespace="http://abcxyz.com/Types"/>
            <xsd:import schemaLocation="http://abcxyz.com/api/ws/custom_fields.php" namespace="http://abcxyz.com/CustomFields"/>
            <xsd:complexType name="authUserRequestType">
                <xsd:all>
                    <xsd:element name="domain" type="syn:domain"/>
                    <xsd:element name="email" type="syn:email"/>
                    <xsd:element name="password" type="syn:password"/>
                    <xsd:element name="returnPortalSession" type="tns:sessionType" minOccurs="0"/>
                </xsd:all>
            </xsd:complexType>
            <xsd:complexType name="authUserResponseType">
                <xsd:all>
                    <xsd:element name="passwordStatus" type="tns:passwordStatus"/>
                    <xsd:element name="userStatus" type="syn:status" minOccurs="0"/>
                    <xsd:element name="portalSession" type="syn:portalSession" minOccurs="0"/>
                    <xsd:element name="errorMessage" type="xsd:string" minOccurs="0"/>
                </xsd:all>
            </xsd:complexType>

        </xsd:schema>
    </types>
    <message name="authUserRequest">
        <part name="parameters" type="tns:authUserRequestType"/>
    </message>
    <message name="authUserResponse">
        <part name="return" type="tns:authUserResponseType"/>
    </message>

    <portType name="WSPortType">
        <operation name="authUser">
            <documentation>This method will authenticate the specified user.</documentation>
            <input message="tns:authUserRequest"/>
            <output message="tns:authUserResponse"/>
        </operation>

    </portType>
    <binding name="WSBinding" type="tns:WSPortType">
        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="authUser">
            <soap:operation soapAction="http://abcxyz.com/api/ws/index.php/authUser" style="rpc"/>
            <input>
                <soap:body use="literal" namespace="http://abcxyz.com/WS"/>
            </input>
            <output>
                <soap:body use="literal" namespace="http://abcxyz.com/WS"/>
            </output>
        </operation>

    </binding>
    <service name="abcxyzWS">
        <port name="abcxyzWSPort" binding="tns:abcxyzWSBinding">
            <soap:address location="http://abcxyz.com/api/ws/index.php"/>
        </port>
    </service>
</definitions>

Edit :

the schema file header:

   <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:synfields="http://abcxyz.com/CustomFields" targetNamespace="http://abcxyz.com/CustomFields" elementFormDefault="qualified" attributeFormDefault="qualified">
<xsd:annotation>
<xsd:documentation>
This is schema defining the custom fields  for usage with XML transport.
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType name="age">
<xsd:annotation>

line 2467 in the schema

<xsd:element name="has_SyFy" type="synfields:has_SyFy" minOccurs="0"/>

line 2557 in the schema:

<xsd:element name="address2" type="xsd:boolean" minOccurs="0"/>

line 2719 in the schema:

<xsd:element name="has_Telemundo" type="xsd:boolean" minOccurs="0"/>

line 2809 does not exist in the schema, last line is 2787 , that's weird, I tried to open the schema in altoxa xml spy and textpad both shown last line as 2787

Community
  • 1
  • 1
DntFrgtDSemiCln
  • 1,259
  • 2
  • 16
  • 35
  • According to the error message the problematic declarations are in the imported schema `custom_fields.php` rather than in the main WSDL file. I wouldn't advise posting the full 2000+ lines but could you show the root `` tag from that file and the sections around the line numbers quoted in the error message? – Ian Roberts Aug 20 '14 at 15:50
  • hi Ian, thanks for your comment , I have added the schema details! – DntFrgtDSemiCln Aug 20 '14 at 16:01

0 Answers0