walterDurin / android-ws-client

Automatically exported from code.google.com/p/android-ws-client
0 stars 0 forks source link

Not using XmlElement to build xml request generates a bad request for uppercase attributes #18

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The xml string for the SOAP request is using the field name for building the 
tag name and it is never using the XMLElement or XMLType annotations.

The problem with this is that if the tag is uppercase, its field attribute 
isn't.

For example if I have this little object:

@XMLType(name="MyRequest")
public class MyRequest {

  @XmlElement(name = "Param")
  protected String param;

  @XmlElement(name = "AnotherParam")
  protected String anotherParam;

}

Expected:
<MyRequest><Param>xxx</Param><AnotherParam>yyy</AnotherParam></MyRequest>

Actual:
<MyRequest><param>xxx</param><anotherParam>yyy</anotherParam></MyRequest>

Only the first tag of the request works as expected because it is extracting 
its name from the @WebParam param in the @WebMethod operation.

I am attaching a tentative solution where I am using the name from the 
XMLElement if present, otherwise keep using the field name.

Original issue reported on code.google.com by sebastia...@gmail.com on 11 Nov 2012 at 7:56

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

        else if ( value instanceof Enum )
        {
            sb.append(XMLUtils.getXMLTagWithNameValue ( fieldName, value.toString ( ), tagInitial ));
            isConvertable = true;
        }

Original comment by kamil.ja...@gmail.com on 30 Jan 2013 at 1:43