两个声明在ObjectFactory类中导致冲突

时间:2014-08-20 15:39:47

标签: java web-services soap soap-client wsimport

我面临的问题与下面链接中提到的相同,但修复建议不适用于我。我对webservices有点新意,所以感谢任何帮助。

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

我正在尝试使用wsimport从wsdl生成Java类。

使用的命令: wsimport -keep -B-XautoNameResolution targetService.wsdl

抛出错误:

[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

还有另一个参考建议包括bindings.xjb和一些我不确定的条目。

Wsdl文件:

<?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>

修改:

架构文件头:

   <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>

架构中的第2467行

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

模式中的第2557行:

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

架构中的第2719行:

<xsd:element name="has_Telemundo" type="xsd:boolean" minOccurs="0"/>
架构中不存在2809行,最后一行是2787,这很奇怪,我试图在altoxa xml spy和textpad中打开架构,最后一行显示为2787

0 个答案:

没有答案