java - axis2 causing javax.xml.stream.XMLStreamException: element text content may not contain START_ELEMENT -


i generated axis2 web service client through eclipse.

i'm having error on execution.

org.apache.axis2.axisfault: javax.xml.stream.xmlstreamexception: element text content may not contain start_element

in wsdl have

<xsd:element name="transactionerror" type="transactionerror"/> <xsd:complextype name="transactionerror"> <xsd:all> <xsd:element name="request_id" type="xsd:string"/> <xsd:element name="trans_id" nillable="true" type="string"/> <xsd:element name="date_time" nillable="true" type="string"/> <xsd:element name="error_code" nillable="true" type="int"/> <xsd:element name="error_text" nillable="true" type="string"/> </xsd:all> </xsd:complextype> 

and on debugging call can see response

<n:transactionerror xmlns:n="http://www.xxxx.com/wsdl/xxxxx.wsdl"> <transactionerror> <request_id>rxxxxxx</request_id> <date_time>2016-02-06 12:02:53</date_time> <error_code>-12</error_code> <error_text>xxxxxxxxxxxxxxxx</error_text> </transactionerror></n:transactionerror> 

on java.lang.string content = reader.getelementtext();

it throwing exception javax.xml.stream.xmlstreamexception: element text content may not contain start_element

on reader these properties :

reader.currentnode = <transactionerror><request_id>rxxxxxx</request_id><date_time>2016-02-06 12:02:53</date_time><error_code>-12</error_code><error_text>xxxxxxxxx</error_text></transactionerror>

reader.namespacecount = -1

any idea can problem ?

you can call xmlstreamreader.getelementtext() method on elements contain text-only content. okay call method <request_id>, <date_time>, <error_code> or <error_text> since children of elements text, cannot use method on <transactionerror> since has other elements children.

the javadoc xmlstreamreader.getelementtext() contains detailed pseudocode shows how method computes string returns , under conditions throw xmlstreamexception. if current element has element children method throw exception.

if axis2 generated code suggest checking whether they've fixed in more recent version , opening bug report against project in apache if it's still issue.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -