You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Lasker, Kory" <kl...@qwest.com> on 2002/05/16 19:51:07 UTC

Underscores

  I have an Axis WS method that returns a complex type as a JavaBean.  It
uses beta2.

  My bean looks like this:

  public class Address {
    private String _FOO;
    private String _D_TSENT;

    public String getFOO() { return _FOO; }
    public String getD_TSENT() { return _D_TSENT; }
  }

  The WSDL appears like so:

  <complexType name="Address">
    <sequence>
      <element name="FOO"/>
      <element name="D_TSENT"/>
    </sequence>
  </complexType>
  <element name="Address" type="tns:Address">

  However, when I generate client stubs using Java2Wsdl and execute this:

  MyServiceProxy binding = new
MyServiceProxyServiceLocator().getMyService();
  Address addr = binding.getAddress(key);

  ...and see the XML come across as:
  <Address>
    <FOO>Bar</FOO>
    <D_TSENT>20020515</D_TSENT>
  </Address>

  ...I get the following error:

	org.xml.sax.SAXException: Invalid element in myclient.Address -
d_TSENT
	at
org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.
java:208)
	at org.apache.axis.encoding.DeserializationContextImpl.startElemen
(DeserializationContextImpl.java:831)
	at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:199)
	at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:
589)
	at
org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.
java:208)
	at
org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java
:370)
	at org.apache.axis.encoding.DeserializationContextImpl.startElement
(DeserializationContextImpl.java:831)
	at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:199)
	at
org.apache.axis.encoding.DeserializationContextImpl.startElement(Deserializa
tionContextImpl.java:844)
	at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:199)
	at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:
589)
	at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:
589)
	at
org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java
:370)
	at
org.apache.axis.message.RPCElement.deserialize(RPCElement.java:224)
	at org.apache.axis.message.RPCElement.getParams(RPCElement.java:248)
	at org.apache.axis.client.Call.invoke(Call.java:1701)
      ...

  It appears that the BeanDeserializer is somehow interpreting the character
before the underscore as lower case, causing problems when it tries to
deserialize the XML that's always uppercase for that field.  Is this a bug
in Axis?

  Thanks,

  Kory Lasker

Re: Underscores

Posted by Carl Trusiak <ca...@yahoo.com>.
I've run into a similar problem with interoperability
with XML-Bus,  The generated by the Axis service is:
- <types>
- <schema
targetNamespace="http://trusiaks.servletshop.net"
xmlns="http://www.w3.org/2001/XMLSchema">
- <complexType name="Shovel">
- <sequence>
  <element name="Dirt" nillable="true"
type="xsd:string" /> 
  <element name="DogBone" nillable="true"
type="tns1:Bone" /> 
  </sequence>
  </complexType>
- <complexType name="Bone">
- <sequence>
  <element name="Url" nillable="true"
type="xsd:string" /> 
  </sequence>
  </complexType>
  <element name="Shovel" nillable="true"
type="tns1:Shovel" /> 
  <element name="Bone" nillable="true"
type="tns1:Bone" /> 
  </schema>
  </types>

The soap message returned by Axis has the elements
with lower case.  When I try and access the service
with an XML-Bus client, it fails because it expects
the elements to follow the sam case as the wsdl.

If I deploy the Service on XML-Bus Server, the Soap
message returned the elements follow the case of the
WSDL and a client created with wsdl2java fails because
it expects the elements case would hve been modified.

Is it correct for Axis to mody the case of the
elements listed in the WSDL in any way?

--- "Lasker, Kory" <kl...@qwest.com> wrote:
> 
>   I have an Axis WS method that returns a complex
> type as a JavaBean.  It
> uses beta2.
> 
>   My bean looks like this:
> 
>   public class Address {
>     private String _FOO;
>     private String _D_TSENT;
> 
>     public String getFOO() { return _FOO; }
>     public String getD_TSENT() { return _D_TSENT; }
>   }
> 
>   The WSDL appears like so:
> 
>   <complexType name="Address">
>     <sequence>
>       <element name="FOO"/>
>       <element name="D_TSENT"/>
>     </sequence>
>   </complexType>
>   <element name="Address" type="tns:Address">
> 
>   However, when I generate client stubs using
> Java2Wsdl and execute this:
> 
>   MyServiceProxy binding = new
> MyServiceProxyServiceLocator().getMyService();
>   Address addr = binding.getAddress(key);
> 
>   ...and see the XML come across as:
>   <Address>
>     <FOO>Bar</FOO>
>     <D_TSENT>20020515</D_TSENT>
>   </Address>
> 
>   ...I get the following error:
> 
> 	org.xml.sax.SAXException: Invalid element in
> myclient.Address -
> d_TSENT
> 	at
>
org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.
> java:208)
> 	at
>
org.apache.axis.encoding.DeserializationContextImpl.startElemen
> (DeserializationContextImpl.java:831)
> 	at
>
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:199)
> 	at
>
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:
> 589)
> 	at
>
org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.
> java:208)
> 	at
>
org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java
> :370)
> 	at
>
org.apache.axis.encoding.DeserializationContextImpl.startElement
> (DeserializationContextImpl.java:831)
> 	at
>
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:199)
> 	at
>
org.apache.axis.encoding.DeserializationContextImpl.startElement(Deserializa
> tionContextImpl.java:844)
> 	at
>
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:199)
> 	at
>
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:
> 589)
> 	at
>
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:
> 589)
> 	at
>
org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java
> :370)
> 	at
>
org.apache.axis.message.RPCElement.deserialize(RPCElement.java:224)
> 	at
>
org.apache.axis.message.RPCElement.getParams(RPCElement.java:248)
> 	at
> org.apache.axis.client.Call.invoke(Call.java:1701)
>       ...
> 
>   It appears that the BeanDeserializer is somehow
> interpreting the character
> before the underscore as lower case, causing
> problems when it tries to
> deserialize the XML that's always uppercase for that
> field.  Is this a bug
> in Axis?
> 
>   Thanks,
> 
>   Kory Lasker


__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com