You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Jon Mountjoy <te...@jonmountjoy.com> on 2007/09/10 22:45:58 UTC

Elements and parts seem to default to "return" - which upsets WSDL2X as "return" is generally a reserved word

Hi,

I'm new to CXF, so forgive this newb question.  For almost all simple  
web services that I create using Java, such as those described here:
http://cwiki.apache.org/CXF20DOC/a-simple-jax-ws-service.html
I get parts or elements automatically named "return" in the resulting  
auto-generated WSDL (see example below).

As you'll see below, the argument is given a nice name like "arg0",  
but the return is called "return".  Unfortunately, return is a  
reserved keyword in many languages, so this forces many  
WSDL2LanguageX converters to rename.

Can you change the default return name for elements/parts to  
something like "return0" ?  Right now, I can't use CXF web services  
from salesforce.com without hacking all my WSDL files (or, when I  
have access to source, adding an annotation).

LMK if I've got this wrong!

Thanks!
Jon



<xsd:complexType name="getInfo">
<xsd:sequence>
<xsd:element minOccurs="0" name="arg0" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="getInfoResponse" type="getInfoResponse"/>
<xsd:complexType name="getInfoResponse">
<xsd:sequence>
<xsd:element minOccurs="0" name="return" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>


Re: Elements and parts seem to default to "return" - which upsets WSDL2X as "return" is generally a reserved word

Posted by James Mao <ja...@iona.com>.
Hi Jon,

Do you mind send us the complete wsdl, we do have the "return" element 
in our test, so this case should be covered already.
Or you can log an issue in jira and attach your wsdl

BTW, which CXF version are you using?

Thanks,
James

> Hi,
>
> I'm new to CXF, so forgive this newb question.  For almost all simple 
> web services that I create using Java, such as those described here:
> http://cwiki.apache.org/CXF20DOC/a-simple-jax-ws-service.html
> I get parts or elements automatically named "return" in the resulting 
> auto-generated WSDL (see example below).
>
> As you'll see below, the argument is given a nice name like "arg0", 
> but the return is called "return".  Unfortunately, return is a 
> reserved keyword in many languages, so this forces many WSDL2LanguageX 
> converters to rename.
>
> Can you change the default return name for elements/parts to something 
> like "return0" ?  Right now, I can't use CXF web services from 
> salesforce.com without hacking all my WSDL files (or, when I have 
> access to source, adding an annotation).
>
> LMK if I've got this wrong!
>
> Thanks!
> Jon
>
>
>
> <xsd:complexType name="getInfo">
> <xsd:sequence>
> <xsd:element minOccurs="0" name="arg0" type="xsd:string"/>
> </xsd:sequence>
> </xsd:complexType>
> <xsd:element name="getInfoResponse" type="getInfoResponse"/>
> <xsd:complexType name="getInfoResponse">
> <xsd:sequence>
> <xsd:element minOccurs="0" name="return" type="xsd:string"/>
> </xsd:sequence>
> </xsd:complexType>
>

Re: Elements and parts seem to default to "return" - which upsets WSDL2X as "return" is generally a reserved word

Posted by Jon Mountjoy <te...@jonmountjoy.com>.
Hi Jervis/James,

You hit the nail on the head with the Spec section.  I still wish  
they didn't choose a reserved word when they wrote the spec... As you  
say Jervice, the name shouldn't be relevant, but unfortunately using  
"return"  means that anyone writing a WSDL2X will need to take more  
care.

The situation I have is that I have a number of local web services  
(created using CXF + annotated POJO) that I'm feeding to  
Salesforce.com.  Salesforce.com can consume arbitrary SOAP services -  
it takes the WSDL and creates local "Apex" objects which then do all  
the dirty work.  The problem is that is nobody has control over that  
process (it's hosted).   I have to currently edit the WSDL before  
this happens, otherwise the Apex objects are invalid.  (or use  
@WebResult)

I'll be reporting this to them though, and pointing out the spec -  
hopefully they can change their mapper to take more care in assigning  
names :-)

Thanks for the resolution.  I'm having great fun with CXF - it's  
remarkably easy to get a SOAP service up and running now.

Regards,
Jon


On 11 Sep 2007, at 04:51, Liu, Jervis wrote:

> One thing to add. If your WSDL is doc-lit wrapped (this type of  
> WSDL is generated by java2wsdl by default unless your java class  
> has annotations to customize this),  a Response Bean is required to  
> be generated by WSDL2JAVA tool. In this case, the WSDL2JAVA tool is  
> also required to resolve any name collisions in response bean. In  
> CXF, when JAXB is the databinding used by WSDL2JAVA, the name  
> mapping is handled by JAXB, detailed can be found in JAXB 2.0 spec  
> Appendix D "BINDING XML NAMES TO JAVA IDENTIFIERS".
>
> Cheers,
> Jervis
>
>> -----Original Message-----
>> From: Liu, Jervis [mailto:jliu@iona.com]
>> Sent: 2007?9?11? 10:47
>> To: cxf-user@incubator.apache.org
>> Subject: RE: Elements and parts seem to default to "return" -
>> which upsets WSDL2X as "return" is generally a reserved word
>>
>>
>> Jon, the mapping name of "return" is per JAX-WS 2.0 spec.
>> Section 3.6.1:
>>
>> "Conformance (Result naming): The javax.jws.WebResult
>> annotation (see 7.10.4) MAY be used to
>> specify the name of the wsdl:part or XML Schema element
>> declaration corresponding to the Java method
>> return type. If both the name and partName elements are used
>> in the javax.jws.WebResult annota-
>> tions then the partName MUST be used for the wsdl:part name
>> attribute and the name elment from the
>> annotation will be ignored. In the absence of customizations,
>> the default name is return."
>>
>> As far as the WSDL2JAVA tool is concerned, the return name is
>> not significant as it is not needed by the language, only the
>> return type is significant. Or you have specific
>> WSDL2Language in your mind?
>>
>> Cheers,
>> Jervis
>>
>>> -----Original Message-----
>>> From: Jon Mountjoy [mailto:tech@jonmountjoy.com]
>>> Sent: 2007?9?11? 4:46
>>> To: cxf-user@incubator.apache.org
>>> Subject: Elements and parts seem to default to "return" -
>>> which upsets WSDL2X as "return" is generally a reserved word
>>>
>>>
>>> Hi,
>>>
>>> I'm new to CXF, so forgive this newb question.  For almost
>>> all simple
>>> web services that I create using Java, such as those described here:
>>> http://cwiki.apache.org/CXF20DOC/a-simple-jax-ws-service.html
>>> I get parts or elements automatically named "return" in the
>>> resulting
>>> auto-generated WSDL (see example below).
>>>
>>> As you'll see below, the argument is given a nice name like
>> "arg0",
>>> but the return is called "return".  Unfortunately, return is a
>>> reserved keyword in many languages, so this forces many
>>> WSDL2LanguageX converters to rename.
>>>
>>> Can you change the default return name for elements/parts to
>>> something like "return0" ?  Right now, I can't use CXF web
>> services
>>> from salesforce.com without hacking all my WSDL files (or, when I
>>> have access to source, adding an annotation).
>>>
>>> LMK if I've got this wrong!
>>>
>>> Thanks!
>>> Jon
>>>
>>>
>>>
>>> <xsd:complexType name="getInfo">
>>> <xsd:sequence>
>>> <xsd:element minOccurs="0" name="arg0" type="xsd:string"/>
>>> </xsd:sequence>
>>> </xsd:complexType>
>>> <xsd:element name="getInfoResponse" type="getInfoResponse"/>
>>> <xsd:complexType name="getInfoResponse">
>>> <xsd:sequence>
>>> <xsd:element minOccurs="0" name="return" type="xsd:string"/>
>>> </xsd:sequence>
>>> </xsd:complexType>
>>>
>>
>> ----------------------------
>> IONA Technologies PLC (registered in Ireland)
>> Registered Number: 171387
>> Registered Address: The IONA Building, Shelbourne Road,
>> Dublin 4, Ireland
>>
>
> ----------------------------
> IONA Technologies PLC (registered in Ireland)
> Registered Number: 171387
> Registered Address: The IONA Building, Shelbourne Road, Dublin 4,  
> Ireland


RE: Elements and parts seem to default to "return" - which upsets WSDL2X as "return" is generally a reserved word

Posted by "Liu, Jervis" <jl...@iona.com>.
One thing to add. If your WSDL is doc-lit wrapped (this type of WSDL is generated by java2wsdl by default unless your java class has annotations to customize this),  a Response Bean is required to be generated by WSDL2JAVA tool. In this case, the WSDL2JAVA tool is also required to resolve any name collisions in response bean. In CXF, when JAXB is the databinding used by WSDL2JAVA, the name mapping is handled by JAXB, detailed can be found in JAXB 2.0 spec Appendix D "BINDING XML NAMES TO JAVA IDENTIFIERS".

Cheers,
Jervis

> -----Original Message-----
> From: Liu, Jervis [mailto:jliu@iona.com]
> Sent: 2007?9?11? 10:47
> To: cxf-user@incubator.apache.org
> Subject: RE: Elements and parts seem to default to "return" - 
> which upsets WSDL2X as "return" is generally a reserved word
> 
> 
> Jon, the mapping name of "return" is per JAX-WS 2.0 spec. 
> Section 3.6.1: 
> 
> "Conformance (Result naming): The javax.jws.WebResult 
> annotation (see 7.10.4) MAY be used to 
> specify the name of the wsdl:part or XML Schema element 
> declaration corresponding to the Java method 
> return type. If both the name and partName elements are used 
> in the javax.jws.WebResult annota- 
> tions then the partName MUST be used for the wsdl:part name 
> attribute and the name elment from the 
> annotation will be ignored. In the absence of customizations, 
> the default name is return."
> 
> As far as the WSDL2JAVA tool is concerned, the return name is 
> not significant as it is not needed by the language, only the 
> return type is significant. Or you have specific 
> WSDL2Language in your mind?
> 
> Cheers,
> Jervis
> 
> > -----Original Message-----
> > From: Jon Mountjoy [mailto:tech@jonmountjoy.com]
> > Sent: 2007?9?11? 4:46
> > To: cxf-user@incubator.apache.org
> > Subject: Elements and parts seem to default to "return" - 
> > which upsets WSDL2X as "return" is generally a reserved word
> > 
> > 
> > Hi,
> > 
> > I'm new to CXF, so forgive this newb question.  For almost 
> > all simple  
> > web services that I create using Java, such as those described here:
> > http://cwiki.apache.org/CXF20DOC/a-simple-jax-ws-service.html
> > I get parts or elements automatically named "return" in the 
> > resulting  
> > auto-generated WSDL (see example below).
> > 
> > As you'll see below, the argument is given a nice name like 
> "arg0",  
> > but the return is called "return".  Unfortunately, return is a  
> > reserved keyword in many languages, so this forces many  
> > WSDL2LanguageX converters to rename.
> > 
> > Can you change the default return name for elements/parts to  
> > something like "return0" ?  Right now, I can't use CXF web 
> services  
> > from salesforce.com without hacking all my WSDL files (or, when I  
> > have access to source, adding an annotation).
> > 
> > LMK if I've got this wrong!
> > 
> > Thanks!
> > Jon
> > 
> > 
> > 
> > <xsd:complexType name="getInfo">
> > <xsd:sequence>
> > <xsd:element minOccurs="0" name="arg0" type="xsd:string"/>
> > </xsd:sequence>
> > </xsd:complexType>
> > <xsd:element name="getInfoResponse" type="getInfoResponse"/>
> > <xsd:complexType name="getInfoResponse">
> > <xsd:sequence>
> > <xsd:element minOccurs="0" name="return" type="xsd:string"/>
> > </xsd:sequence>
> > </xsd:complexType>
> > 
> 
> ----------------------------
> IONA Technologies PLC (registered in Ireland)
> Registered Number: 171387
> Registered Address: The IONA Building, Shelbourne Road, 
> Dublin 4, Ireland
> 

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

RE: Elements and parts seem to default to "return" - which upsets WSDL2X as "return" is generally a reserved word

Posted by "Liu, Jervis" <jl...@iona.com>.
Jon, the mapping name of "return" is per JAX-WS 2.0 spec. Section 3.6.1: 

"Conformance (Result naming): The javax.jws.WebResult annotation (see 7.10.4) MAY be used to 
specify the name of the wsdl:part or XML Schema element declaration corresponding to the Java method 
return type. If both the name and partName elements are used in the javax.jws.WebResult annota- 
tions then the partName MUST be used for the wsdl:part name attribute and the name elment from the 
annotation will be ignored. In the absence of customizations, the default name is return."

As far as the WSDL2JAVA tool is concerned, the return name is not significant as it is not needed by the language, only the return type is significant. Or you have specific WSDL2Language in your mind?

Cheers,
Jervis

> -----Original Message-----
> From: Jon Mountjoy [mailto:tech@jonmountjoy.com]
> Sent: 2007?9?11? 4:46
> To: cxf-user@incubator.apache.org
> Subject: Elements and parts seem to default to "return" - 
> which upsets WSDL2X as "return" is generally a reserved word
> 
> 
> Hi,
> 
> I'm new to CXF, so forgive this newb question.  For almost 
> all simple  
> web services that I create using Java, such as those described here:
> http://cwiki.apache.org/CXF20DOC/a-simple-jax-ws-service.html
> I get parts or elements automatically named "return" in the 
> resulting  
> auto-generated WSDL (see example below).
> 
> As you'll see below, the argument is given a nice name like "arg0",  
> but the return is called "return".  Unfortunately, return is a  
> reserved keyword in many languages, so this forces many  
> WSDL2LanguageX converters to rename.
> 
> Can you change the default return name for elements/parts to  
> something like "return0" ?  Right now, I can't use CXF web services  
> from salesforce.com without hacking all my WSDL files (or, when I  
> have access to source, adding an annotation).
> 
> LMK if I've got this wrong!
> 
> Thanks!
> Jon
> 
> 
> 
> <xsd:complexType name="getInfo">
> <xsd:sequence>
> <xsd:element minOccurs="0" name="arg0" type="xsd:string"/>
> </xsd:sequence>
> </xsd:complexType>
> <xsd:element name="getInfoResponse" type="getInfoResponse"/>
> <xsd:complexType name="getInfoResponse">
> <xsd:sequence>
> <xsd:element minOccurs="0" name="return" type="xsd:string"/>
> </xsd:sequence>
> </xsd:complexType>
> 

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland