Hi,

When running some simple SAAJ code to get Axis2 to send SwA type
attachments, it doesn't add the attachments (it sets Content-Type to
application/xop+xml, i.e. appears to be trying to do MTOM, but no
attachments appear)

Running the same code against the old Axis 1.4 release (with activation and
mail jars added) I see the attachments added as expected.

Does anyone know if Axis2 is supposed to support SAAJ? (It says it's
supported in release notes, plus there is a axis2-saaj-1.4.jar embedded)

I know you can use OperationClient/MessageContext to get Axis2 to act as an
SwA client, just wondering why you can't use plain vanilla SAAJ code?


Here's the simple test:

// Create SOAP Envelope
MessageFactory mf = MessageFactory.newInstance();
SOAPMessage msg = mf.createMessage();
SOAPPart soapPart = msg.getSOAPPart();
SOAPEnvelope soapEnvelope = soapPart.getEnvelope();

// Add the SOAP Body contents
SOAPBody soapBody = soapEnvelope.getBody();
soapBody.addBodyElement(soapEnvelope.createName("TestAttach","ns","http://ww
w.test.com <http://www.test.com/> "));

// Add the attachment
AttachmentPart ap1 = msg.createAttachmentPart();
ap1.setContent("test attachment content", "text/plain");
msg.addAttachmentPart(ap1);
msg.saveChanges();

// Send the request
SOAPConnectionFactory connectionFactory =
SOAPConnectionFactory.newInstance();
SOAPConnection soapConnection = connectionFactory.createConnection();
soapConnection.call(msg, new
URL("http://localhost:9090/soap/services/TestService";));


Here's what I see in TCPMon using Axis2 1.4 :

Content-Type: multipart/related;
boundary=MIMEBoundaryurn_uuid_259D1FCB4EE684BC7D1220346422306;
type="application/xop+xml";
start="<0.urn:uuid:[EMAIL PROTECTED]>";
start-info="text/xml"
SOAPAction: "urn:anonOutInOp"
User-Agent: Axis2
Host: 127.0.0.1:9090
Transfer-Encoding: chunked
1f1
--MIMEBoundaryurn_uuid_259D1FCB4EE684BC7D1220346422306
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: <0.urn:uuid:[EMAIL PROTECTED]>
<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";><soapenv:Body><ns:
TestAttach xmlns:ns="http://www.test.com <http://www.test.com/> "
/></soapenv:Body></soapenv:Envelope>
--MIMEBoundaryurn_uuid_259D1FCB4EE684BC7D1220346422306--
0


Here's what I see in TCPMon using Axis 1.4 :

Content-Type: multipart/related; type="text/xml";
start="<2CD8EF9902B82B8AA526D7DFA0197389>";
boundary="----=_Part_0_29293232.1220346695382"
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.4
Host: 127.0.0.1:9090
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: ""
Content-Length: 691

------=_Part_1_32358515.1220346695726
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: binary
Content-Id: <B147070E7E809BB09D055554119F807E>
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";><soapenv:Body><ns:Test
Attach xmlns:ns="http://www.test.com"/></soapenv:Body></soapenv:Envelope>
------=_Part_1_32358515.1220346695726
Content-Type: text/plain
Content-Transfer-Encoding: binary
Content-Id: <60439739BA212B29897A22477FAF761D>
test attachment content
------=_Part_1_32358515.1220346695726--

Cheers,
Karl.


Reply via email to