users@jax-rpc.java.net

Re: access attachments from SEI implementation

From: Vivek Pandey <Vivek.Pandey_at_Sun.COM>
Date: Tue, 06 Sep 2005 14:26:34 -0700

JAXRPC RI defines properties that can be used to get/set Collection of
all the attachments with the message on the client or server.

Assuming you're expecting attachments with the received message. Your
SEI implementation is is required to implement ServiceLifecycle
interface to get access to ServletEndpointContext. From
ServletEndpointContext it can access the MessageContext to receive and
send the collection of attachments using

          o com.sun.xml.rpc.server.ServerPropertyConstants.SET_ATTACHMENT_PROPERTY
          o com.sun.xml.rpc.server.ServerPropertyConstants.GET_ATTACHMENT_PROPERTY

Refer: https://jax-rpc.dev.java.net/whitepaper/1.1.2/attachments.html

For the example code and sample see:

https://jax-rpc.dev.java.net/whitepaper/1.1.2/attachments-howto.html

-vivek.


Edoardo Causarano wrote:

> Hello, following WS-I Attachment Profile 1.0 R2940 I declare
> attachment swaRefs in elements contained in the body. The
> wsdl:binding snip is:
>
> <operation name="uploadFileArray">
> <soap:operation style="document"/>
> <input>
> <mime:multipartRelated>
> <mime:part>
> <soap:body parts="requestPart" use="literal"/>
> </mime:part>
> </mime:multipartRelated>
> </input>
> <output>
> <soap:body parts="responsePart" use="literal"/>
> </output>
> </operation>
>
> I run wscompile and get all the nice stubs/skels I want. My SEI
> implementation until now is:
>
> public UploadFileArrayRespT uploadFileArray(SOAPElement requestPart)
> throws RemoteException {
> try {
> // Legal according to WS-I Attachments Profile 1.0 (R2929)
> SOAPBody body = ((SOAPEnvelope) requestPart).getBody();
> Node document = body.getChildNodes().item(0);
> NodeList files = document.getChildNodes();
> for (int i=0; i<files.getLength(); i++) {
> Node file = files.item(i);
> String ref =
> file.getAttributes().getNamedItem("contentID").getNodeValue();
> ...
> }
> } catch (SOAPException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
>
> I want to use the "ref" string to identify the relevant attachment but
> my method only gets the body requestPart (the first and root mime
> attachment). How can I access the integral SOAP Message containing all
> the attachments that was sent by the client?
>
> e
>

-- 
Vivek Pandey
Web Services Standards and Technologies
Sun Microsystems Inc.