You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by christopher justin <ch...@hotmail.com> on 2004/02/19 01:26:57 UTC

SOAP client cannot read Element return type

a web service of mine is returing import org.w3c.dom.Element as the type.  
This is one way to return literal XML with Apache SOAP says IBM 
(http://www-106.ibm.com/developerworks/webservices/library/ws-soapmap1/ ).  
The SOAP message looks fine when viewing with SOAPMonitor, but I have yet to 
be able to write a client that can read the Element.  I get statement when 
trying to dump the Element to the screen.  Here is snippet of my client 
code:

            Service service = new Service();
            Call call = (Call)service.createCall();
            call.setTargetEndpointAddress( endPoint );
            call.setOperationName( "getNiches" );
            call.setReturnClass(org.w3c.dom.Element.class);
            call.setReturnType(new 
javax.xml.namespace.QName("http://xml.apache.org/xml-
            soap", "Element"));
             call.setEncodingStyle( Constants.NS_URI_XML );
             Element xml = (Element) call.invoke(new java.lang.Object[] {});
             System.out.println( xml );

IBM states that setting the encoding style to Constants.NS_URI_XML will 
force the encoding to be of literal XML.  Here is my SOAP Message:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
  <ns1:getNichesResponse 
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"    
xmlns:ns1="http://TLI">
   <ns1:getNichesReturn xsi:type="ns2:Element" 
xmlns:ns2="http://xml.apache.org/xml-soap">
    <email-list>
      <emails><email age="24" first=" meg" 
sex="F">meg@heremailaddress.com</email>
     </email-list>
</ns1:getNichesReturn>
  </ns1:getNichesResponse>
</soapenv:Body>
</soapenv:Envelope>


Here is the result of my println:

[email-list: null]


Can some get me in the right direction for how to recieve the Element object 
with a Axis Client ?  What am I doing wrong in the above.    Any help would 
be greatly appreciated.

P.S -  I tried the WSDL2Java code as well, I still get the null result even 
though the raw SOAP message clearly shows the XML as the return type.

_________________________________________________________________
Watch high-quality video with fast playback at MSN Video. Free! 
http://click.atdmt.com/AVE/go/onm00200365ave/direct/01/