2016-07-19 51 views
0

一直在尋找對谷歌/各種其他網站有一段時間了......AXIS2/C:錯誤的元素類型或空節點(om_element.c)

梗概: 無法序列化/反序列化對象,錯元素類型或空節點(om_element.c)。

生成的代碼

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); 

錯誤(從wlis.log)

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

部分WSDL文件的:

<?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> 

我唯一能看到的就是名字空間 。在這種情況下,它看起來像(在遍歷代碼 和大量調試日誌語句之後),它使用默認的「xsi」 命名空間。嘗試硬編碼「ns1」作爲 LocomotiveInformationTransaction的名稱空間,但未解決問題。

如果您需要其他信息,請讓我知道。

回答

1

錯誤提示parent_element不是AXIOM_ELEMENT或者沒有綁定的元素。

這種情況元件檢查期間爲真:

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

這可能是的情況下,你通過其他節點類型(文本,節點等。)作爲parent_element

檢查parent_element以前axiom_element_add_attribute電話:

  1. 呼叫axiom_node_get_data_element(parent_element, env)檢查,如果數據元素綁定。它一定不是NULL;

  2. 調用axiom_node_get_node_type(parent_element, env)檢查元素的類型。它必須是AXIOM_ELEMENT

+0

感謝您的回覆。 今天我會看看。 – user1798810

0

我相信你的意思是檢查parent(不parent_element),對不對? 這裏沒有東西加起來。

類型DEFaxiom_node_t *parentaxiom_element_t *parent_element

以下呼叫axiom_element_add_attribute (parent_element, env, xsi_type_attri, parent);

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

在該功能內: axiom_element_find_namespace(om_element, env, element_node,...);獲取稱爲

下面是檢查element_node這是一個AXIOM_DATA_SOURCE(不AXIOM_ELEMENT):

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

parentAXIOM_DATA_SOURCE,這會是什麼東西在wsdl文件?但是什麼? wsdl文件與gSOAP一起工作正常。

想法?

相關問題