Hello,

this is a repost since I did not get any replies from the user list.
I looked at the attachments sample but realised that I cannot pass a 
DataHandler object between the functions because the client will 
eventually be written using MSSOAP and not axis. Then I read part of 
the SAAJ specification.
Now I am quite confused. If I understood the spec correctly, the 
following code should be possible (and sufficient) for using 
attachments. Should this work and the Exception I get is due to axis 
not correctly implementing the spec? Or is it me who is wrong?

Server:
public class MyService {
public String call()
{
        SOAPMessage msg =
                MessageContext.getCurrentContext().getResponseMessage();        
        msg.addAttachmentPart(msg.createAttachmentPart("string1",
                                                 "text/plain"));

        return "string2";
}
}

Client:

...
call.setOperationName("call");
Object[] args = new Object[] {};
String ret = (String) call.invoke(args);
...


I see in tcpmon that there IS attachment content (which seems to be 
correct) but nevertheless there is a SAXParseException thrown on 
client side. Did I make any mistakes?

Software: Axis 1.0, Tomcat 4.1.12, JDK 1.4.1, Linux


Stack trace:
AxisFault
 faultCode: {http://xml.apache.org/axis/}Server.userException
 faultString: org.xml.sax.SAXParseException: Document root missing
 faultActor: null
 faultDetail: 
        stackTrace: org.xml.sax.SAXParseException: Document root 
missing
        at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3182)
        at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3170)
        at 
org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:501)
        at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
        at 
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442)
        at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
        at 
org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:232)
        at 
org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:546)
        at org.apache.axis.Message.getSOAPEnvelope(Message.java:377)
        at org.apache.axis.client.Call.invokeEngine(Call.java:2132)
        at org.apache.axis.client.Call.invoke(Call.java:2102)
        at org.apache.axis.client.Call.invoke(Call.java:1851)
        at org.apache.axis.client.Call.invoke(Call.java:1777)
        at org.apache.axis.client.Call.invoke(Call.java:1315)
        at test.TestClient.main(TestClient.java:123)

Cheers!
-- 
Matthias Brunner <[EMAIL PROTECTED]>
PGP FP 7862 32B3 3B75 292A F76F  5042 8587 21AB 5B89 D501
Check out http://blumenstrasse.vol.at/~mb/gpgkey.asc


Reply via email to