You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Pratibha Mittal <pm...@confluentsoftware.com> on 2004/01/26 21:23:18 UTC

Can't create SOAPMessage from Input Stream

Hi,
 
I am trying to create SoapMessage object from Input stream
which is a fault response. And Axis is throwing null pointer exception.
This works fine for a regular response message.
Is this a bug? Is there any workaround for this problem? Please
let me know as soon as possible.
 
Here is the code I am trying to execute:
public class SoapFault {
      
    public static void main(String[] args) {
        try {
            FileInputStream is = new FileInputStream(args[0]);
            SOAPMessage jaxSoapMsg = MessageFactory.newInstance().createMessage( new MimeHeaders(), is );              
            SOAPPart sp = jaxSoapMsg.getSOAPPart();
            System.out.println("SOAP part is " + sp); 
            SOAPEnvelope se = sp.getEnvelope();
            System.out.println("SOAP envelope is " + se); 
            SOAPBody sb = se.getBody();                
            System.out.println("SOAP body is " + sb);    
                
        } catch (IOException ex0) {
            ex0.printStackTrace(System.out);
        }
        catch (SOAPException ex0) {
            ex0.printStackTrace(System.out);
        }
        catch (Exception ex0) {
            ex0.printStackTrace(System.out);
        } 
     
    }
           
}
 
As I said, this works fine for reular response but does not work for
fault response like the one below:
 
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body><SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring>http://schemas.xmlsoap.org/soap/envelope/</faultstring>
<faultactor/></SOAP-ENV:Fault>
</SOAP-ENV:Body></SOAP-ENV:Envelope>