You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by chengy <ch...@yahoo.com.cn> on 2010/05/27 11:06:56 UTC

How to avoid the same name of element and type in wsdl:types??

below is generated by CXF:
<wsdl:types>
<xsd:schema attributeFormDefault="unqualified"
elementFormDefault="qualified" targetNamespace="http://server.hw.demo/"
xmlns:tns="http://server.hw.demo/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="sayHi" type="tns:sayHi" /> 
   <xsd:complexType name="sayHi">
	<xsd:sequence>
	    <xsd:element minOccurs="0" name="arg0" type="xsd:string" /> 
	</xsd:sequence>
   </xsd:complexType>
</xsd:schema>
</wsdl:types>

see <xsd:element name="sayHi",<xsd:complexType name="sayHi">,the same name
"sayHi" makes things error!How to avoid this??



-- 
View this message in context: http://old.nabble.com/How-to-avoid-the-same-name-of-element-and-type-in-wsdl%3Atypes---tp28691358p28691358.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: How to avoid the same name of element and type in wsdl:types??

Posted by chengy <ch...@yahoo.com.cn>.
dkulp,Thank you.
Because I find InfoPath(a form product of Microsoft) cann't parse this
construct though it's valid. 



dkulp wrote:
> 
> On Thursday 27 May 2010 5:06:56 am chengy wrote:
>> below is generated by CXF:
>> <wsdl:types>
>> <xsd:schema attributeFormDefault="unqualified"
>> elementFormDefault="qualified" targetNamespace="http://server.hw.demo/"
>> xmlns:tns="http://server.hw.demo/"
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>> <xsd:element name="sayHi" type="tns:sayHi" />
>>    <xsd:complexType name="sayHi">
>> 	<xsd:sequence>
>> 	    <xsd:element minOccurs="0" name="arg0" type="xsd:string" />
>> 	</xsd:sequence>
>>    </xsd:complexType>
>> </xsd:schema>
>> </wsdl:types>
>> 
>> see <xsd:element name="sayHi",<xsd:complexType name="sayHi">,the same
>> name
>> "sayHi" makes things error!How to avoid this??
> 
> Umm...  that's not an error at all.    An element declaration and a type 
> declaration are separate things and can (and often do) have identical
> names.     
> What's the problem with that?
> 
> There are some ways to configure it out by configuring the factory beans:
> 
> JaxWsServerFactoryBean serverFactory = new JaxWsServerFactoryBean();
> // set address, service class etc...
> serverFactory.getServiceFactory().setAnonymousWrapperTypes(true);
> serverFactory.create();
> 
> and such, but in general, it's a completely valid and common construct.  
> 
> 
> -- 
> Daniel Kulp
> dkulp@apache.org
> http://dankulp.com/blog
> 
> 

-- 
View this message in context: http://old.nabble.com/How-to-avoid-the-same-name-of-element-and-type-in-wsdl%3Atypes---tp28691358p28721856.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: How to avoid the same name of element and type in wsdl:types??

Posted by Daniel Kulp <dk...@apache.org>.
On Thursday 27 May 2010 5:06:56 am chengy wrote:
> below is generated by CXF:
> <wsdl:types>
> <xsd:schema attributeFormDefault="unqualified"
> elementFormDefault="qualified" targetNamespace="http://server.hw.demo/"
> xmlns:tns="http://server.hw.demo/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <xsd:element name="sayHi" type="tns:sayHi" />
>    <xsd:complexType name="sayHi">
> 	<xsd:sequence>
> 	    <xsd:element minOccurs="0" name="arg0" type="xsd:string" />
> 	</xsd:sequence>
>    </xsd:complexType>
> </xsd:schema>
> </wsdl:types>
> 
> see <xsd:element name="sayHi",<xsd:complexType name="sayHi">,the same name
> "sayHi" makes things error!How to avoid this??

Umm...  that's not an error at all.    An element declaration and a type 
declaration are separate things and can (and often do) have identical names.     
What's the problem with that?

There are some ways to configure it out by configuring the factory beans:

JaxWsServerFactoryBean serverFactory = new JaxWsServerFactoryBean();
// set address, service class etc...
serverFactory.getServiceFactory().setAnonymousWrapperTypes(true);
serverFactory.create();

and such, but in general, it's a completely valid and common construct.  


-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog