0

Have been searching on google/various other sites for some time now...

Synopsis: Unable to serialize/deserialize object, wrong element type or null node (om_element.c).

Generated code:

xsi_type_attri = axiom_attribute_create (env, "type", "LocomotiveInformationTransaction", xsi_ns);
//The following line results in ERROR:
axiom_element_add_attribute (parent_element, env, xsi_type_attri, parent);

The error (from wlis.log)

[error] om_element.c(283) Wrong element type or null node

Part of the wsdl file:

<?xml version="1.0" encoding="UTF-8"?>
<!-Created by TIBCO WSDL->
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns0="http://www.nscorp.com" xmlns:tns="http://www.nscorp.com" xmlns:ns1="java:com.nscorp.wlis.locoinfo" name="Untitled" targetNamespace="http://www.nscorp.com">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.nscorp.com" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:import namespace="java:com.nscorp.wlis.locoinfo"/>
<xs:element name="UpdateLocoStatus" nillable="true" type="ns1:LocomotiveInformationTransaction"/>
<xs:element name="UpdateLocoStatusResponse" nillable="true" type="ns1:LocomotiveResponse"/>
<xs:element name="isAliveResponse" nillable="true" type="xs:string"/>
</xs:schema>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:stns="java:com.nscorp.wlis.locoinfo" xmlns="java:com.nscorp.wlis.locoinfo" targetNamespace="java:com.nscorp.wlis.locoinfo" elementFormDefault="qualified" attributeFormDefault="qualified">
<xsd:complexType name="ArrayOfCondition">
<xsd:sequence>
<xsd:element name="Condition" nillable="true" type="stns:Condition" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>

The only thing I could see that stood out was the namespace it was using. In this case, it looked like (after stepping through the code and lots of debugging log statements) it was using the default "xsi" namespace. Tried hard coding "ns1" as the namespace for LocomotiveInformationTransaction but that did not resolve the issue.

Please let me know if you need additional info.

user1798810
  • 61
  • 13

2 Answers2

1

The error says that parent_element you given is not AXIOM_ELEMENT or has no bound element to it.

This condition is true during element checking:

if (!axiom_node_get_data_element(element_node, env) ||
    axiom_node_get_node_type(element_node, env) != AXIOM_ELEMENT)

This could be in case you pass other node type (text, node etc..) as parent_element.

Check your parent_element before axiom_element_add_attribute call:

  1. call axiom_node_get_data_element(parent_element, env) to check if data element is bound. It must be not NULL;

  2. call to axiom_node_get_node_type(parent_element, env) check element's type. It must be AXIOM_ELEMENT.

loentar
  • 5,111
  • 1
  • 24
  • 25
0

I believe you mean check parent (not parent_element), right? Something doesn't add up here.

type def: axiom_node_t *parent and axiom_element_t *parent_element

the following call: axiom_element_add_attribute (parent_element, env, xsi_type_attri, parent);

which is axiom_element_add_attribute( axiom_element_t * om_element, const axutil_env_t * env, axiom_attribute_t * attribute, axiom_node_t * element_node){...}

within that function: axiom_element_find_namespace(om_element, env, element_node,...); gets called.

the following is checking the element_node which is an AXIOM_DATA_SOURCE (not AXIOM_ELEMENT):

if(!axiom_node_get_data_element(element_node, env) || axiom_node_get_node_type(element_node, env) != AXIOM_ELEMENT)

parent is an AXIOM_DATA_SOURCE, could this be something in the wsdl file? But what? The same wsdl file was working fine with gSOAP.

thoughts?

user1798810
  • 61
  • 13