axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stadelmann Josef" <josef.stadelm...@axa-winterthur.ch>
Subject AW: How to send attachments via local transport?
Date Wed, 13 Jun 2012 08:01:14 GMT
Hi Yashwanth

 

I give your e-mail as I do not understand what you're asking.

 

While using Local Transport we are finding that
attachments are being passed on to the receiving web service.

However if we use regular HTTP invocation then the
attachments are             passed on to the receiving web service.

 

So what is the difference between your two approaches? Can you clarify
this a bit.

 

 

 

Second to know:

Attachments - I think/guess - you refer to SwA SOAP with Attachments.

 

 

Third issue: AFAIK Axis2 has a good architecture and SwA is at a total
different level then TRANSPORTS.

It would be a very bad architecture if we cannot change the transport
from HTTP to LOCAL and at the same time affect the transmission of SwA
Attachments.

http://svn.apache.org/repos/asf/axis/axis2/java/rampart/branches/1_1/mod
ules/integration/test-resources/SwA-fileCache-enabled-axis2.xml

In the link above several Transport Ins  and several Transport Outs are
configured. hence after they are configured they can be used, regardless
of what you intend to transmit over a given transport.

 

 

An example of a SOAP/XML fragment which shows identical cid's is below:

After my application retrieves the cid:xxxx value, the substring "cid:"
is stripped of and the remaining part is used as an argument to a
DataHandler: (see below)

<soapenv:Body xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">

<getDataResponse xmlns="http://spezpla.axawl.ch">

<getDataResult xmlns:b="SPS-Payload"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance">

<b:Name>SPS-Payload</b:Name>

<b:wscol xmlns:c="COL">

<c:Name>wscol</c:Name>

<c:Item xmlns:d="http://schemas.datacontract.org/2004/07/WCFSpSe"
xmlns:e="WS">

<d:TWS>

<e:Name>wsout</e:Name>

<e:Item xmlns:f="feld">

<d:TELEM>

<f:Fldnam>FILENAME</f:Fldnam>

<f:Fldval>/C:/Users/C770817/Desktop/Error.bmp</f:Fldval>

</d:TELEM>

<d:TELEM>

<f:Fldnam>dataCID</f:Fldnam>

<f:Fldval>cid:37b519818bb07b8084651f0e3d6a1b263dc9a3fc7c6589c2@apache.or
g</f:Fldval>

</d:TELEM>

<d:TELEM>

<swa:Fldnam
xmlns:swa="http://service.samples/xsd">dataCIDswa</swa:Fldnam>

<swa:Fldval
xmlns:swa="http://service.samples/xsd">cid:37b519818bb07b8084651f0e3d6a1
b263dc9a3fc7c6589c2@apache.org</swa:Fldval>

</d:TELEM>

</e:Item>

</d:TWS>

</c:Item>

</b:wscol>

</getDataResult>

</getDataResponse>

</soapenv:Body>

 

 

For that . . .

I suggest you to read:

http://axis.apache.org/axis2/java/core/docs/mtom-guide.html#a31

 

The following code fragment is found there: Here you can see how the cid
== contented is used in a data handler to download/upload the
attachment.

If this piece of code is used at the service side, then we can talk
about a "UPLOAD", if this code is used on the client side we talk about
a "DOWNLOAD"

The thing is that passing a cid: in a soap/xml is the key to retrieve
the attachment using a data handler. 

 

public class SwA {

    public SwA() {

    }

    

    public void uploadAttachment(OMElement omEle) throws AxisFault {

        OMElement child = (OMElement) omEle.getFirstOMChild();

        OMAttribute attr = child.getAttribute(new QName("href"));

        

        //Content ID processing

        String contentID = attr.getAttributeValue();

        contentID = contentID.trim();

        if (contentID.substring(0, 3).equalsIgnoreCase("cid")) {

            contentID = contentID.substring(4);

        }

        

        MessageContext msgCtx =
MessageContext.getCurrentMessageContext();

        Attachments attachment = msgCtx.getAttachmentMap();

        DataHandler dataHandler = attachment.getDataHandler(contentID);

        ...........

    }

}

 

Hope this helps a bit

 

Josef

 

 

 

Von: Yashwanth Rajaram -X (yrajaram - ZENSAR TECHNOLOGIES INC at Cisco)
[mailto:yrajaram@cisco.com] 
Gesendet: Dienstag, 12. Juni 2012 19:59
An: java-dev@axis.apache.org; java-user@axis.apache.org
Betreff: RE: How to send attachments via local transport?

 

Hi All:

 

Wondering if there are any good tutorials/examples on how to send
attachments via local transport? Or can anyone confirm if this indeed is
doable - my gut says that it should be doable?

 

Sincerely, Yashwanth

Technical Architect, EBIS

 

From: Yashwanth Rajaram -X (yrajaram - ZENSAR TECHNOLOGIES INC at Cisco)
[mailto:yrajaram@cisco.com] 
Sent: Friday, June 08, 2012 12:21 AM
To: java-dev@axis.apache.org; java-user@axis.apache.org
Subject: How to send attachments via local transport?

 

Hi All:

 

While using Local Transport we are finding that attachments are being
passed on to the receiving web service. However if we use regular HTTP
invocation then the attachments are passed on to the receiving web
service. 

Wondering if anyone has successfully send attachments via local
transport - if so can you pls share a sample?

 

Sincerely,

Yashwanth

Technical Architect, EBIS

 


Mime
View raw message