Hi
I'm writing a messaging service which should receive the SOAP message and several
(XML) attachments.
I'm writing a Provider extending the MsgProvider which unpacks the SOAP message and
sends it to our EJB layer.
The Provider ignores til Service Object given in the processMessage and the EJB call
is hardcoded.
If I use the MessageContext to get the RequestMessage cast it to a
org.apache.axis.Message then a countAttachments returns 0. See the code below.
public void processMessage (org.apache.axis.MessageContext msgContext,
org.apache.axis.message.SOAPEnvelope reqEnv,
org.apache.axis.message.SOAPEnvelope resEnv,
Object obj) throws Exception
{
try
{
org.apache.axis.Message vRequestMessage =
(org.apache.axis.Message) msgContext.getRequestMessage();
mLog.debug("vRequestMessage.countAttachments():
"+vRequestMessage.countAttachments());
....
The client looks like this:
...
URLEndpoint endpoint = null;
endpoint=new URLEndpoint( args[0] );
SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance();
SOAPConnection connection = scf.createConnection();
MessageFactory mf = MessageFactory.newInstance();
SOAPMessage msg = mf.createMessage();
SOAPPart soapPart=msg.getSOAPPart();
SOAPEnvelope envelope = soapPart.getEnvelope();
StreamSource ssrc=new StreamSource( new FileInputStream( args[1] ));
soapPart.setContent( ssrc );
URL url = new URL("file:"+args[2]);
AttachmentPart attachmentPart = msg.createAttachmentPart(new DataHandler(url));
attachmentPart.setContentType("text/xml");
attachmentPart.setContentId("MyContentId");
msg.addAttachmentPart(attachmentPart);
msg.saveChanges();
System.out.println("Sending message to URL: "+ endpoint.getURL());
msg.writeTo(System.out);
SOAPMessage reply = connection.call(msg, endpoint);
....
The debug message right in front of the connection.call print a SOAPMessage with an
attachment.
Is this an Axis bug????
/Christian Bj�rnbak