Hi,

If I want to receive arbitrary payload, and do not know ahead of the time if it 
will contain just XML, non-optimized base64 encoded string, or optimized mime 
attachment, is there a predictable to way to handle this.

ex.

(1) <soap:body>
        <output>
            <xml.../> plain xml
        </output>
     </soap:body>

(2) <soap:body>
        <output>
            base64 encoded string...
        </output>
     </soap:body>

(3) <soap:body>
        <output>
           <xop:Include href="cid:..."/>
        </output>
      </soap:body>

      --- MimeBoundary
      attachment

So, if I have the output element above, how can I handle all of the cases:

OMElement outputElement ...
OMNode node = outputElement.getFirstOMChild();
if (node.getType() == OMNode.TEXT_NODE) {
   OMText text = (OMText) node;
   DataHandler dh = text.getDataHandler();
   InputStream stream = dh.getDataSource().getInputStream();
}

This works for case (3) above.  Is there a recommended way to handle all these 
cases or  do you just have to know what is being sent?

Is dh valid for case (2) as well? or is dh=null in this case?  I can test 
text.isOptimized() to see if base64 encoded?  How can I know if its plain xml?
Maybe text.isBinary()...

Thanks for any suggestions.



Tony Dean
SAS Institute Inc.
919.531.6704
[EMAIL PROTECTED]

SAS... The Power to Know
http://www.sas.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to