cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dag Framstad (JIRA)" <j...@apache.org>
Subject [jira] Created: (CXF-1793) WSDL2Java reports Non unique body parts if the first 14 characters of message parts are identical
Date Thu, 11 Sep 2008 13:05:45 GMT
WSDL2Java reports Non unique body parts if the first 14 characters of message parts are identical
-------------------------------------------------------------------------------------------------

                 Key: CXF-1793
                 URL: https://issues.apache.org/jira/browse/CXF-1793
             Project: CXF
          Issue Type: Bug
          Components: Tooling
    Affects Versions: 2.1.2
         Environment: Windows XP,  Java 1.5
            Reporter: Dag Framstad


In my WSDL I have 2 services that have similar names.
If the first 14 characters in the message part name are identical WSDL2Java reports (from
ant):

generate:
     [java] Loading FrontEnd jaxws ...
     [java] Loading DataBinding jaxb ...
     [java] wsdl2java -b c:\ADN\adnfond/src/main/resources/com/edb/adnfond/transport/ws/calendar.xjb.w2j
-impl -verbose -validate -c
atalog c:\ADN\adnfond/src/main/resources/com/edb/adnfond/transport/ws/misc -d c:\ADN\adnfond/src/main/generated
c:\ADN\adnfond/src/m
ain/resources/com/edb/adnfond/transport/ws/misc/Misc_v10.wsdl
     [java] wsdl2java - Apache CXF 2.1.2
     [java] 
     [java] 
     [java] WSDLToJava Error: Non unique body parts, operation [ getSalesOfficeId ] and  operation
[ getSalesPersonId ] have the sam
e body block {http://edb.com/ws/WSCommon_v21}AutHeader
     [java] 
     [java] 
     [java] 
     [java] org.apache.cxf.tools.common.ToolException: Non unique body parts, operation [
getSalesOfficeId ] and  operation [ getSal
esPersonId ] have the same body block {http://edb.com/ws/WSCommon_v21}AutHeader
     [java] 
     [java] 
     [java]     at org.apache.cxf.tools.validator.internal.WSDL11Validator.isValid(WSDL11Validator.java:128)
     [java]     at org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.JAXWSDefinitionBuilder.validate(JAXWSDefinitionBuilder.java:200
)
     [java]     at org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.JAXWSDefinitionBuilder.validate(JAXWSDefinitionBuilder.java:62)
     [java]     at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:132)
     [java]     at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:232)
     [java]     at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:83)
     [java]     at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:103)
     [java]     at org.apache.cxf.tools.wsdlto.WSDLToJava.main(WSDLToJava.java:173)

Example WSDL:
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions 
	targetNamespace="http://www.edb.com/adnfond/transport/ws/misc/"
	xmlns:misc="http://www.edb.com/adnfond/transport/ws/misc/misc_v10"
	xmlns:m="http://www.edb.com/adnfond/transport/ws/misc/"
	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
	xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
	xmlns:edb="http://edb.com/ws/WSCommon_v21">
	<wsdl:documentation/>
	<wsdl:types>
		<schema xmlns="http://www.w3.org/2001/XMLSchema">
			<xsd:import namespace="http://edb.com/ws/WSCommon_v21" schemaLocation="../WSCommon_v21.xsd"/>
			<xsd:import namespace="http://www.edb.com/adnfond/transport/ws/misc/misc_v10" schemaLocation="Misc_v10.xsd"/>
		</schema>
	</wsdl:types>
	
	<wsdl:message name="getSalesOfficeIdReq">
		<wsdl:part name="salesOfficeIdHeader" element="edb:AutHeader"/>
		<wsdl:part name="xsalesOfficeIdBodyReq" element="misc:getSalesOfficeIdRequest"/>
	</wsdl:message>
	
	<wsdl:message name="getSalesOfficeIdResp">
		<wsdl:part name="salesOfficeIdBodyResp" element="misc:getSalesOfficeIdResponse" />
	</wsdl:message>

	<wsdl:message name="getSalesOfficeId2Req">
		<wsdl:part name="salesOfficeId2Header" element="edb:AutHeader"/>
		<wsdl:part name="xsalesOfficeId2BodyReq" element="misc:getSalesOfficeId2Request"/>
	</wsdl:message>
	
	<wsdl:message name="getSalesOfficeId2Resp">
		<wsdl:part name="salesOfficeId2BodyResp" element="misc:getSalesOfficeId2Response"/>
	</wsdl:message>

		<!-- 
		wsdl2java fails when part names are xsalesOfficeIdBodyReq and xsalesOfficeId2BodyReq
		but works fine when part names are  salesOfficeIdBodyReq and salesOfficeId2BodyReq 
               -->


	<wsdl:portType name="MiscPort">
		<wsdl:operation name="getSalesOfficeId">
			<wsdl:input message="m:getSalesOfficeIdReq"/>
			<wsdl:output message="m:getSalesOfficeIdResp"/>
		</wsdl:operation>	
		<wsdl:operation name="getSalesOfficeId2">
			<wsdl:input message="m:getSalesOfficeId2Req"/>
			<wsdl:output message="m:getSalesOfficeId2Resp"/>
		</wsdl:operation>
	</wsdl:portType>
	
	
	
	<wsdl:binding name="MiscSoapBinding" type="m:MiscPort">
		<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
		<wsdl:operation name="getSalesOfficeId">
			<soap:operation soapAction="getSalesOfficeId" style="document"/>
			<wsdl:input>
				<soap:header message="m:getSalesOfficeIdReq" part="salesOfficeIdHeader" use="literal"/>
				<soap:body parts="xsalesOfficeIdBodyReq" use="literal"/>
			</wsdl:input>
			<wsdl:output>
				<soap:body use="literal"/>
			</wsdl:output>
		</wsdl:operation>
		<wsdl:operation name="getSalesOfficeId2">
			<soap:operation soapAction="getSalesOfficeId2" style="document"/>
			<wsdl:input>
				<soap:header message="m:getSalesOfficeId2Req" part="salesOfficeId2Header" use="literal"/>
				<soap:body parts="xsalesOfficeId2BodyReq" use="literal"/>
			</wsdl:input>
			<wsdl:output>
				<soap:body use="literal"/>
			</wsdl:output>
		</wsdl:operation>
	</wsdl:binding>
	
	
	<wsdl:service name="MiscService">
		<wsdl:port name="MiscSoapPort" binding="m:MiscSoapBinding">
			<soap:address location="http://localhost:8080/adnfond/services/MiscService"/>
		</wsdl:port>
	</wsdl:service>
</wsdl:definitions>


This is how I use wsdl2java:
        <target name="generate" depends="prepare" description="generate Java source files
from schema and wsdl (only run this if you changed shcema or wsdl)">
                <wsdl2java dir="${wsdl.dir}/misc" file="Misc_v10.wsdl" srcdestdir="${generated.dir}"
bindingfile="${wsdl.dir}/calendar.xjb.w2j" />
                <replaceregexp match="wsdlLocation = .* ," replace="" byline="true">
                        <fileset dir="${generated.dir}" includes="**/*.java" />
                </replaceregexp>
                <replaceregexp match=", wsdlLocation = .*\)" replace=")" byline="true">
                        <fileset dir="${generated.dir}" includes="**/*.java" />
                </replaceregexp>
        </target>

        <macrodef name="wsdl2java">
                <attribute name="srcdestdir" default="" />
                <attribute name="destdir" default="" />
                <attribute name="file" />
                <attribute name="servicename.arg" default="" />
                <attribute name="bindingfile" default="" />
                <attribute name="dir" default="" />
                <attribute name="wsdlLocation" default="" />
                <attribute name="package" default="NOT_SPECIFIED" />
                <sequential>
                        <condition property="package.arg.@{file}" value="-p @{package}">
                                <not>
                                        <equals arg1="@{package}" arg2="NOT_SPECIFIED"
/>
                                </not>
                        </condition>
                        <property name="package.arg.@{file}" value="" />
                        <condition property="binding.arg" value='-b "@{bindingfile}"'>
                                <not>
                                        <equals arg1="@{bindingfile}" arg2="" />
                                </not>
                        </condition>
                        <property name="binding.arg" value="" />
                        <condition property="wsdlLocation.arg" value='-wsdlLocation "@{wsdlLocation}"'>
                                <not>
                                        <equals arg1="@{wsdlLocation}" arg2="" />
                                </not>
                        </condition>
                        <property name="wsdlLocation.arg" value="" />
                        <java failonerror="true" classname="org.apache.cxf.tools.wsdlto.WSDLToJava"
fork="yes">
                                <classpath>
                                        <path refid="test.classpath" />
                                </classpath>
                                <sysproperty key="exitOnFinish" value="true" />
                                <arg line="@{servicename.arg}" />
                                <arg line="${package.arg.@{file}}" />
                                <arg line="${binding.arg}" />
                                <arg line="${wsdlLocation.arg}" />
                                <arg value="-impl" />
                                <arg value="-verbose" />
                                <arg value="-validate" />
                                <arg value="-catalog" />
                                <arg value="@{dir}" />
                                <arg value="-d" />
                                <arg value="@{srcdestdir}" />
                                <arg value="@{dir}/@{file}" />
                        </java>
                </sequential>
        </macrodef>

If the specs says that message part names can't be longer than 14 characters then please ignore
this issue.

Version 2.0.4 has this problem too, and other versions too I imagine, but I have only tested
on 2.0.4 and 2.1.2.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message