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 Matthias Brunner <mb...@blumenstrasse.vol.at> on 2002/10/16 16:45:09 UTC

Attachments

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 <mb...@blumenstrasse.vol.at>
PGP FP 7862 32B3 3B75 292A F76F  5042 8587 21AB 5B89 D501
Check out http://blumenstrasse.vol.at/~mb/gpgkey.asc



Re: Created attachments unreadable

Posted by Matthias Brunner <mb...@blumenstrasse.vol.at>.
When doing the same with DIME as the return type I get the following 
message. (Again, serializiation works, only deserialization does 
not.)

------------------
INFO: Mapping Exception to AxisFault
AxisFault
 faultCode: {http://xml.apache.org/axis/}Server.userException
 faultString: org.xml.sax.SAXParseException: Character conversion 
error: "Malformed UTF-8 char -- is an XML encoding declaration 
missing?" (Line number probably to low)
 faultActor: null
 faultDetail: 
        stackTrace: org.xml.sax.SAXParseException: Character 
conversion error: &quot;Malformed UTF-8 char -- is an XML encoding 
declaration missing?&quot; (Line number probably to low)
        at 
org.apache.crimson.parser.InputEntity.fatal(InputEntity.java:1100)
        at 
org.apache.crimson.parser.InputEntity.fillbuf(InputEntity.java:1072)
        at 
org.apache.crimson.parser.InputEntity.isXmlDeclOrTextDeclPrefix(InputEntity.java:914)
        at 
org.apache.crimson.parser.Parser2.maybeXmlDecl(Parser2.java:1009)
        at 
org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:486)
        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)

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