Hi, I am having a problem with data that is transferred via XML attributes. Namely, when an object is constructed after receiving a message the getter corresponding to an attribute returns null.
I start with a WSDL file and use XMLBeans data binding. The following example is a modification of the 'quickstartxmlbeans' sample supplied with the software. I am using Axis2 1.1.1 and Java 1.6.0. The schema in the wsdl:types section of the WSDL file is: <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://quickstart.samples/xsd"> <xs:element name="attribute"> <xs:complexType> <xs:attribute name="status" type="xs:string" /> <xs:sequence> <xs:element name="value" nillable="true" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="attributeResponse"> <xs:complexType> <xs:attribute name="status" type="xs:string" /> <xs:sequence> <xs:element name="value" nillable="true" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> And the message/port definition is <wsdl:message name="attributeMessage"> <wsdl:part name="part1" element="ns:attribute"/> </wsdl:message> <wsdl:message name="attributeResponseMessage"> <wsdl:part name="part1" element="ns:attributeResponse"/> </wsdl:message> <wsdl:portType name="MyServicePortType"> <wsdl:operation name="attribute"> <wsdl:input message="axis2:attributeMessage"/> <wsdl:output message="axis2:attributeResponseMessage"/> </wsdl:operation> </wsdl:portType> This defines a service whose request and response both contain an attribute 'status' and an element 'value'. The client sets the status attribute to "OK" and the value element to "Testing" in the request. It calls the service and prints the status attribute and value element that come back in the response. public static void attribute(MyServiceStub stub){ try{ AttributeDocument reqDoc = AttributeDocument.Factory.newInstance(); AttributeDocument.Attribute req = reqDoc.addNewAttribute(); req.setStatus("OK"); req.setValue("Testing"); AttributeResponseDocument res = stub.attribute(reqDoc); System.err.println("Status="+res.getAttributeResponse().getStatus()); System.err.println("Value="+res.getAttributeResponse().getValue()); } catch(Exception e){ e.printStackTrace(); System.err.println("\n\n\n"); } } The service just takes the status attrbiute and the value element from the request and echos them back in the response. public AttributeResponseDocument attribute(AttributeDocument param1) { String status = param1.getAttribute().getStatus(); String value = param1.getAttribute().getValue(); System.err.println(); System.err.println("Status="+status); System.err.println("Value="+value); AttributeResponseDocument resDoc = AttributeResponseDocument.Factory.newInstance(); AttributeResponseDocument.AttributeResponse res = resDoc.addNewAttributeResponse(); res.setStatus(status); res.setValue(value); return resDoc; } When I run the client I get the following output: run.client: [java] Status=null [java] Value=Testing The value element is correct, but the status attribute is null. A trace on the server side shows the same problem. That is, after the request is received on the server the status attribute is null. I changed the status attribute to a status element and all was processed fine, so the problem seems to be specific to XML attributes. Is something extra needed when XML attributes are involved? Thanks, Paul Chisholm Technology Support/TAS Airservices Australia www.airservicesaustralia.com ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CAUTION: This e-mail is confidential. If you are not the intended recipient, you must not disclose or use the information contained in it. If you have received this e-mail in error, please tell us immediately by return e-mail and delete the document. Airservices Australia does not represent, warrant or guarantee that the integrity of this communication is free of errors, virus or interference. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
