Hey,
Im using Axis2 (latest) and all defaults for inputs to Java2WSDL.  I have a 
simple service, and each operation has a "return" element in it.  e.g.

<xs:element name="addMemberSimpleResponse">
  <xs:complexType>
    <xs:sequence>
      <xs:element minOccurs="0" name="return" nillable="true" 
type="ns:WsAddMemberResult"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>

This means the XML that comes back looks like this:

<soapenv:Body>
  <ns:addMemberSimpleResponse xmlns:ns="http://webservices.whatever/xsd";>
    <ns:return type="whatever.webservices.WsAddMemberResult">
      <ns:resultCode xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:nil="true" />

I have someone connecting to the web service using flash or flex, and there is 
an XML -> object converter, which converts the XML into a hierarchy of objects 
and fields.  But since "return" is a keyword, it barfs.  So, I was wondering if 
there is a way (besides hand-editing the WSDL or using XSLT) to customize 
java2wsdl to get that element to be generated as "the_return" or something else 
besides "return".

Thanks!
Chris

Here is the email from the user:

Notice that the element name on line two of the response is named "return" 
(forget about the "ns" namespace for now).  This is perfectly legal XML but 
"return" is a reserved word in most languages and attempts to access the 
element directly cause problems when compiling the code.  e.g.
--- BEGIN EXAMPLE FLASH CODE---
var test : XML = XML("<top><body>hello world</body><return>good 
bye</return></top>"); // casts string to xml 
debugit.text = test.body; 
debugit.text = test.child( "return" );
--- END EXAMPLE FLASH CODE---
All of the above code works fine.  Notice that I access the "body"
element directly but accessed the "return" element using a child method.  The 
compiler complains if I attempt to use the syntax "test.return" or any 
variation of it: "test.return.toString()".
Naming an element "return" is valid; I'm suggesting that it is probably not 
good practice to use common reserve words as element names (or attribute names 
for that matter).
----


      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 

Reply via email to