I've writen two clients to access Google and Amazon Web APIs, After recieving 
the Response I get the following Exception.
-------------------------------------------------------------------------------------------------------------------------

         Key: AXIS2-23
         URL: http://issues.apache.org/jira/browse/AXIS2-23
     Project: Axis2
        Type: Bug
  Components: om  
 Environment: Windows XP sp1,
    Reporter: L.P.Gayan Asanka
 Assigned to: Davanum Srinivas 


Hi All,

I have built a programs to access Google Web API and Amazon Web API via AXIS2. 
The operation is ‘doGoogleSearch’ in Google WSDL and ‘search’ in Amazon 
WSDL, I can set the number of search results that should be included in the 
response message. In Google When the number of results is 1 or 2 it is working 
almost properly, But when the number of results are getting higher (that means 
the SOAP msg is big) I am getting an exception. When the results count is 10, 
most probably this exception is thrown. In the case of Amazon, the exception is 
always thrown. This programs worked with M1 successfully.

I guess the problem is with OM and Stax, I hope your aid to solve this problem.

Exception thrown is:-

org.apache.axis.om.OMException: javax.xml.stream.XMLStreamException
        at 
org.apache.axis.soap.impl.llom.builder.StAXSOAPModelBuilder.next(StAXSOAPModelBuilder.java:295)
        at org.apache.axis.om.impl.llom.OMNodeImpl.build(OMNodeImpl.java:272)
        at 
org.apache.axis.om.impl.llom.OMSerializerUtil.serializeNormal(OMSerializerUtil.java:166)
        at 
org.apache.axis.om.impl.llom.OMElementImpl.serialize(OMElementImpl.java:660)
        at 
org.apache.axis.om.impl.llom.OMElementImpl.serializeWithCache(OMElementImpl.java:610)
        at 
org.apache.axis.om.impl.llom.OMTextImpl.serializeWithCache(OMTextImpl.java:91)
        at org.apache.axis.om.impl.llom.OMTextImpl.serialize(OMTextImpl.java:96)
        at 
org.apache.axis.om.impl.llom.OMElementImpl.serialize(OMElementImpl.java:634)
        at 
org.apache.axis.om.impl.llom.OMElementImpl.serialize(OMElementImpl.java:681)
        at 
samples.google.search.ClientCallbackHandler.extractDetails(ClientCallbackHandler.java:96)
        at 
samples.google.search.ClientCallbackHandler.onComplete(ClientCallbackHandler.java:76)
        at 
org.apache.axis.clientapi.InOutMEPClient$1.run(InOutMEPClient.java:218)
        at java.lang.Thread.run(Thread.java:534)
Caused by: javax.xml.stream.XMLStreamException
        at com.bea.xml.stream.MXParser.fillBuf(MXParser.java:3346)
        at com.bea.xml.stream.MXParser.more(MXParser.java:3361)
        at com.bea.xml.stream.MXParser.parseAttribute(MXParser.java:2368)
        at com.bea.xml.stream.MXParser.parseStartTag(MXParser.java:2176)
        at com.bea.xml.stream.MXParser.nextImpl(MXParser.java:1700)
        at com.bea.xml.stream.MXParser.next(MXParser.java:1249)
        at 
org.apache.axis.soap.impl.llom.builder.StAXSOAPModelBuilder.next(StAXSOAPModelBuilder.java:256)
        ... 12 more
SOAP message is:-

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"; 
xmlns:xsd="http://www.w3.org/1999/XMLSchema";>
    <SOAP-ENV:Body>
        <ns1:doGoogleSearchResponse xmlns:ns1="urn:GoogleSearch" 
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";>
            <return xmlns="" xsi:type="ns1:GoogleSearchResult">
                <directoryCategories xsi:type="ns2:Array" 
ns2:arrayType="ns1:DirectoryCategory[0]">
                </directoryCategories>
                <documentFiltering 
xsi:type="xsd:boolean">true</documentFiltering>
                <endIndex xsi:type="xsd:int">9</endIndex>
                <estimateIsExact xsi:type="xsd:boolean">false</estimateIsExact>
                <estimatedTotalResultsCount 
xsi:type="xsd:int">11</estimatedTotalResultsCount>
                <resultElements xsi:type="ns3:Array" 
ns3:arrayType="ns1:ResultElement[9]">
                    <item xsi:type="ns1:ResultElement">
                        <URL 
xsi:type="xsd:string">http://www.radinks.net/ftp/faq.php</URL>
                        <cachedSize xsi:type="xsd:string">8k</cachedSize>
                        <directoryCategory xsi:type="ns1:DirectoryCategory">
                            <fullViewableName 
xsi:type="xsd:string"></fullViewableName>
                            <specialEncoding 
xsi:type="xsd:string"></specialEncoding>
                        </directoryCategory>
                        <directoryTitle xsi:type="xsd:string"></directoryTitle>
                        <hostName xsi:type="xsd:string"></hostName>
                        <relatedInformationPresent xsi:type="xsd:boolean">true  
                                     </relatedInformationPresent>
                        <snippet xsi:type="xsd:string">&lt;b&gt;...&lt;/b&gt; 
You need to have the &lt;b&gt;Java&lt;/b&gt; &lt;b&gt;Runtime&lt;/b&gt; 
&lt;b&gt;Enviorenment&lt;/b&gt; installed. the JRE is 
&lt;b&gt;...&lt;/b&gt;&lt;br&gt;  X Window system installed and you will need 
the &lt;b&gt;Java&lt;/b&gt; &lt;b&gt;Runtime&lt;/b&gt; 
&lt;b&gt;Enviorenment&lt;/b&gt; as &lt;b&gt;...&lt;/b&gt;</snippet>
                        <summary xsi:type="xsd:string"></summary>
                        <title xsi:type="xsd:string">What is FTP</title>
                    </item>

                    <item xsi:type="ns1:ResultElement">
                        <URL 
xsi:type="xsd:string">http://forums.devshed.com/archive/t-132738/What-are-these</URL>
                        <cachedSize xsi:type="xsd:string">16k</cachedSize>
                        <directoryCategory xsi:type="ns1:DirectoryCategory">
                            <fullViewableName 
xsi:type="xsd:string"></fullViewableName>
                            <specialEncoding 
xsi:type="xsd:string"></specialEncoding>
                        </directoryCategory>
                        <directoryTitle xsi:type="xsd:string"></directoryTitle>
                        <hostName xsi:type="xsd:string"></hostName>
                        <relatedInformationPresent 
xsi:type="xsd:boolean">true</relatedInformationPresent>
                        <snippet xsi:type="xsd:string">&lt;b&gt;...&lt;/b&gt; 3 
- &lt;b&gt;java&lt;/b&gt; run time &lt;b&gt;enviorenment&lt;/b&gt; 4 - Software 
Development Kit &lt;b&gt;...&lt;/b&gt; The JRE is&lt;br&gt;  the 
&lt;b&gt;Java&lt;/b&gt; &lt;b&gt;Runtime&lt;/b&gt; Environment, and consists of 
the JVM, core &lt;b&gt;Java&lt;/b&gt; libraries, 
&lt;b&gt;...&lt;/b&gt;</snippet>
                        <summary xsi:type="xsd:string"></summary>
                        <title xsi:type="xsd:string">What are these?</title>
                    </item>
                    <item xsi:type="ns1:ResultElement">
                        <URL 
xsi:type="xsd:string">http://forums.devshed.com/t119864/sc080f62a8ebb741eb05e19e780435bf3.html</URL>
                        <cachedSize xsi:type="xsd:string">60k</cachedSize>
                        <directoryCategory xsi:type="ns1:DirectoryCategory">
                            <fullViewableName 
xsi:type="xsd:string"></fullViewableName>
                            <specialEncoding 
xsi:type="xsd:string"></specialEncoding>
                        </directoryCategory>
                        <directoryTitle xsi:type="xsd:string"></directoryTitle>
                        <hostName 
xsi:type="xsd:string">forums.devshed.com</hostName>
                        <relatedInformationPresent 
xsi:type="xsd:boolean">true</relatedInformationPresent>
                        <snippet xsi:type="xsd:string">&lt;b&gt;...&lt;/b&gt; 
if the variables are set as USER or SYSTEM &lt;b&gt;enviorenment&lt;/b&gt; 
variables &lt;b&gt;...&lt;/b&gt; Registry key&lt;br&gt; 
&amp;#39;Software\JavaSoft\&lt;b&gt;Java&lt;/b&gt; &lt;b&gt;Runtime&lt;/b&gt; 
Environment\CurrentVersion&amp;#39; has value &amp;#39;1.3&amp;#39;, but 
&lt;b&gt;...&lt;/b&gt;  </snippet>
                        <summary xsi:type="xsd:string"></summary>
                        <title xsi:type="xsd:string">TextPad..</title>
                    </item>
                    <item xsi:type="ns1:ResultElement">
                        <URL 
xsi:type="xsd:string">http://www.vovida.org/pipermail/vocal/2002-November/007361.html</URL>
                        <cachedSize xsi:type="xsd:string">9k</cachedSize>
                        <directoryCategory xsi:type="ns1:DirectoryCategory">
                            <fullViewableName 
xsi:type="xsd:string"></fullViewableName>
                            <specialEncoding 
xsi:type="xsd:string"></specialEncoding>
                        </directoryCategory>
                        <directoryTitle xsi:type="xsd:string"></directoryTitle>
                        <hostName xsi:type="xsd:string"></hostName>
                        <relatedInformationPresent 
xsi:type="xsd:boolean">true</relatedInformationPresent>
                        <snippet xsi:type="xsd:string">&lt;b&gt;...&lt;/b&gt; 
Next message: [Vocal] &lt;b&gt;Java&lt;/b&gt; Provisioning for Vocal 1.4; 
Messages sorted by:&lt;br&gt;  &lt;b&gt;...&lt;/b&gt; the &amp;gt; 
&lt;b&gt;java&lt;/b&gt; run time &lt;b&gt;enviorenment&lt;/b&gt; jre1.3.1_06 
before deploying &amp;gt; vocal). &lt;b&gt;...&lt;/b&gt;</snippet>
                        <summary xsi:type="xsd:string"></summary>
                        <title xsi:type="xsd:string">[Vocal] Problems deploying 
vocal 1.4.0</title>
                    </item>
                    <item xsi:type="ns1:ResultElement">
                        <URL 
xsi:type="xsd:string">http://www.vovida.org/pipermail/vocal/2002-November/007358.html</URL>
                        <cachedSize xsi:type="xsd:string">9k</cachedSize>
                        <directoryCategory xsi:type="ns1:DirectoryCategory">
                            <fullViewableName 
xsi:type="xsd:string"></fullViewableName>
                            <specialEncoding 
xsi:type="xsd:string"></specialEncoding>
                        </directoryCategory>
                        <directoryTitle xsi:type="xsd:string"></directoryTitle>
                        <hostName 
xsi:type="xsd:string">www.vovida.org</hostName>
                        <relatedInformationPresent 
xsi:type="xsd:boolean">true</relatedInformationPresent>
                        <snippet xsi:type="xsd:string">&lt;b&gt;...&lt;/b&gt; 
(though I have installed the &amp;gt; &amp;gt; &lt;b&gt;java&lt;/b&gt; run time 
&lt;b&gt;enviorenment&lt;/b&gt; jre1.3.1_06 before&lt;br&gt;  deploying 
&lt;b&gt;...&lt;/b&gt; And there is no &amp;gt; &amp;gt; 
&lt;b&gt;Java&lt;/b&gt; &lt;b&gt;Runtime&lt;/b&gt; in configurations. 
&lt;b&gt;...&lt;/b&gt;</snippet>
                        <summary xsi:type="xsd:string"></summary>
                        <title xsi:type="xsd:string">[Vocal] Problems deploying 
vocal 1.4.0</title>
                    </item>
                    <item xsi:type="ns1:ResultElement">
                        <URL 
xsi:type="xsd:string">http://www.javadesktop.org/forums/thread.jspa?threadID=8796&amp;tstart=120</URL>
                        <cachedSize xsi:type="xsd:string">31k</cachedSize>
                        <directoryCategory xsi:type="ns1:DirectoryCategory">
                            <fullViewableName 
xsi:type="xsd:string"></fullViewableName>
                            <specialEncoding 
xsi:type="xsd:string"></specialEncoding>
                        </directoryCategory>
                        <directoryTitle xsi:type="xsd:string"></directoryTitle>
                        <hostName xsi:type="xsd:string"></hostName>
                        <relatedInformationPresent 
xsi:type="xsd:boolean">true</relatedInformationPresent>
                        <snippet xsi:type="xsd:string">&lt;b&gt;...&lt;/b&gt; 
It works, but I got some &lt;b&gt;runtime&lt;/b&gt; errors that I can´t fix. 
&lt;b&gt;...&lt;/b&gt; installation app&lt;br&gt;  to set up all the server and 
client &lt;b&gt;enviorenment&lt;/b&gt; will be very helpful. 
&lt;b&gt;...&lt;/b&gt;</snippet>
                        <summary xsi:type="xsd:string"></summary>
                        <title xsi:type="xsd:string">JavaDesktop Forums</title>
                    </item>
                    <item xsi:type="ns1:ResultElement">
                        <URL 
xsi:type="xsd:string">http://www.desktopian.org/news/onews0200.html</URL>
                        <cachedSize xsi:type="xsd:string">198k</cachedSize>
                        <directoryCategory xsi:type="ns1:DirectoryCategory">
                            <fullViewableName 
xsi:type="xsd:string"></fullViewableName>
                            <specialEncoding 
xsi:type="xsd:string"></specialEncoding>
                        </directoryCategory>
                        <directoryTitle xsi:type="xsd:string"></directoryTitle>
                        <hostName xsi:type="xsd:string"></hostName>
                        <relatedInformationPresent 
xsi:type="xsd:boolean">true</relatedInformationPresent>
                        <snippet xsi:type="xsd:string">&lt;b&gt;...&lt;/b&gt; 
Faster and smaller…516k. no &lt;b&gt;runtime&lt;/b&gt;… b) New mail engine. 
&lt;b&gt;...&lt;/b&gt; C Headers,&lt;br&gt;  includes, &lt;b&gt;JAVA&lt;/b&gt;, 
JavaScript, CSS and PHP/PHP3, x86 Assembly, HP48, CA-Clipper, 
&lt;b&gt;...&lt;/b&gt;</snippet>
                        <summary xsi:type="xsd:string"></summary>
                        <title xsi:type="xsd:string">desktopian.org : Old 
News</title>
                    </item>
                    <item xsi:type="ns1:ResultElement">
                        <URL 
xsi:type="xsd:string">http://www.database-forum.com/forum14.html</URL>
                        <cachedSize xsi:type="xsd:string">62k</cachedSize>
                        <directoryCategory xsi:type="ns1:DirectoryCategory">
                            <fullViewableName 
xsi:type="xsd:string"></fullViewableName>
                            <specialEncoding 
xsi:type="xsd:string"></specialEncoding>
                        </directoryCategory>
                        <directoryTitle xsi:type="xsd:string"></directoryTitle>
                        <hostName xsi:type="xsd:string"></hostName>
                        <relatedInformationPresent 
xsi:type="xsd:boolean">true</relatedInformationPresent>
                        <snippet xsi:type="xsd:string">&lt;b&gt;...&lt;/b&gt; 
No new posts, Static BerkeleyDB with Dynamic &lt;b&gt;Runtime&lt;/b&gt; on 
Win32? &lt;b&gt;...&lt;/b&gt; No new posts,&lt;br&gt;  DB-&amp;gt;associate in 
multithreaded &lt;b&gt;enviorenment&lt;/b&gt; &lt;b&gt;...&lt;/b&gt;</snippet>
                        <summary xsi:type="xsd:string"></summary>
                        <title xsi:type="xsd:string">Berkeley DB</title>
                    </item>
                    <item xsi:type="ns1:ResultElement">
                        <URL 
xsi:type="xsd:string">http://mail-archives.apache.org/mod_mbox/jakarta-tomcat-user/200209.mbox/authors.html</URL>
                        <cachedSize xsi:type="xsd:string">513k</cachedSize>
                        <directoryCategory xsi:type="ns1:DirectoryCategory">
                            <fullViewableName 
xsi:type="xsd:string"></fullViewableName>
                            <specialEncoding 
xsi:type="xsd:string"></specialEncoding>
                        </directoryCategory>
                        <directoryTitle xsi:type="xsd:string"></directoryTitle>
                        <hostName xsi:type="xsd:string"></hostName>
                        <relatedInformationPresent 
xsi:type="xsd:boolean">true</relatedInformationPresent>
                        <snippet xsi:type="xsd:string">&lt;b&gt;...&lt;/b&gt; 
how to prevent JSP getting compiled at &lt;b&gt;runtime&lt;/b&gt; Bayi Peng 
(Thu, 19 Sep 2002&lt;br&gt;  18:06:02 &lt;b&gt;...&lt;/b&gt; referncing 
&lt;b&gt;enviorenment&lt;/b&gt; variable in server.xml Katz, Adi (Wed, 
&lt;b&gt;...&lt;/b&gt;</snippet>
                        <summary xsi:type="xsd:string"></summary>
                        <title 
xsi:type="xsd:string">/mod_mbox/jakarta-tomcat-user/200209.mbox/authors.html</title>
                    </item>
                </resultElements>
                <searchComments xsi:type="xsd:string"></searchComments>
                <searchQuery xsi:type="xsd:string">java runtime 
enviorenment</searchQuery>
                <searchTime xsi:type="xsd:double">0.02838</searchTime>
                <searchTips xsi:type="xsd:string"></searchTips>
                <startIndex xsi:type="xsd:int">1</startIndex>
            </return>
        </ns1:doGoogleSearchResponse>

    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>


this is part of the code in my ClientCallbackHandler that process the SOAP 
envelope:-

private void extractDetails(AsyncResult result) {
        Iterator iterator,iterator2;
        OMNode node;
        OMElement body, operation, elem;
        SOAPEnvelope resEnvelope;

        try {
            XMLStreamWriter writer = 
XMLOutputFactory.newInstance().createXMLStreamWriter(
                    System.out);
            result.getResponseEnvelope().serialize(writer);
            //part.serialize(writer,false);
            writer.flush();

        } catch (XMLStreamException e) {
            System.out.println("Error occured after responce is received");
            e.printStackTrace();
        } catch (FactoryConfigurationError e) {
            System.out.println("Error occured after responce is received");
            e.printStackTrace();
        }
        resEnvelope = result.getResponseEnvelope();
        body = resEnvelope.getBody();
        operation = body.getFirstElement();

        String opLocalName = operation.getLocalName();
        if (opLocalName.equals("Fault")) {
            System.out.println("A Fault message recieved, Check your Licence 
key");
            snippet =
                    snippet +
                    "A Fault message recieved, Check your Licence key. Else you 
have reached the" +
                    " daily limit of 1000 requests";
        } else {
            OMElement part = operation.getFirstElement();

            iterator = part.getChildren();
            while (iterator.hasNext()) {
                node = (OMNode) iterator.next();
                if (node.getType() == OMNode.ELEMENT_NODE) {
                    elem = (OMElement) node;
                    String str = elem.getLocalName();
                    System.out.println(str);
                    if (str.equals("resultElements")) {
                        System.out.println("Got the Result Elements");
                        Iterator iterator0 = elem.getChildren();
                        while (iterator0.hasNext()) {
                            node = (OMNode) iterator0.next();
                            if (node.getType() == OMNode.ELEMENT_NODE) {
                                elem = (OMElement) node;
                                if (elem.getLocalName().equals("item")) {
                                    iterator2 = elem.getChildren();
                                    while (iterator2.hasNext()) {
                                        node = (OMNode) iterator2.next();
                                        if (node.getType() == 
OMNode.ELEMENT_NODE) {
                                            elem = (OMElement) node;
                                            String str3 = elem.getLocalName();
                                            System.out.println(str3);
                                            if 
(elem.getLocalName().equals("snippet")) {
                                                System.out.println("Got the 
snippet");
                                                tempStr = elem.getText();

                                                System.out.println(tempStr);
                                                snippet = snippet + tempStr;
                                            }

                                            if 
(elem.getLocalName().equals("URL")) {
                                                System.out.println("Got the 
URL");
                                                strURL = elem.getText();
                                            }
                                        }
                                    }
                                }
                                snippet = snippet + "<br> URL:-<a href=" + 
strURL + ">" + strURL +
                                        "</a\n\n> <br><br>";
                            }
                        }
                    }
                }
            }
        }
        snippet = snippet + endHTML;
        System.out.println(snippet);
        //text.setText(snippet);

        GUIHandler.showResults(snippet);

    }


Gayan


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to