cancel
Showing results for 
Search instead for 
Did you mean: 

Web Service with Attachment

Former Member
0 Kudos

Hi all,

I have to implement a WebService (Providing/Consuming) solution, by which I can send a file as attachment of Web Service Request.

Anyone can help me?

Best Regards,

Raffaele

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi,

Yes the webservice should have capaibility of holding the attachment.It's not exactly payload. You need to understand webservice architecture, then it will be clear.

This link will be helpful

http://www.w3.org/TR/SOAP-attachments

http://www.theserverside.com/tt/articles/article.tss?l=SendingAttachmentsWithSOAP

Thanks,

Vijaya.

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

Refer these blogs It will very useful to u r requirement :

Regards,

Suryanarayana

Former Member
0 Kudos

Thank you very much Rama, but I aven't XI on my system. We consume Web Service by generating Proxy Classes.

Former Member
0 Kudos

Hi all,

I saw how attach a MIME part to a SOAP message. I do this with the follow ABAP Code:

 

DATA: lo_attachments TYPE REF TO if_wsprotocol_attachments,
lo_attachment_internal         TYPE REF TO cl_ai_attachment.
          CREATE OBJECT my_proxyobject.

          lo_attachments ?= my_proxyobject->get_protocol( if_wsprotocol=>attachments ).

          CREATE OBJECT lo_attachment_internal
            EXPORTING
              p_string    = 'Textual Attachment'
*              P_XSTRING
              p_type      = if_ai_attachment=>c_mimetype_text_plain
              p_name      = 'doc_name.txt'
              p_from_type = if_ai_attachment=>c_attach_type_text.

        APPEND lo_attachment_internal TO lt_attachments.

          CALL METHOD lo_attachments->set_attachments
            EXPORTING
              attachments = lt_attachments.

but when I try to send the request to Web Service, an expeption occurred with "Wrong SOAP Version".

Can anyone tell me if I forget anything in the request?

Best Regards,

Raffaele Frattini

Former Member
0 Kudos

Sorry,

but can I have an Abap example?

I explain you the scenario: I will create a Proxy Object autogenerated from a WSDL document. If in the WSDL document isn't indicated an attachment parameter, when I call proxy method to create WS request, how can I attach my file?

Former Member
0 Kudos

Can't anyone help me with a simple ABAP example?

Best Regards,

Raffaele Frattini

Former Member
0 Kudos

OK,

I understand that I can attach a file to my SOAP request in Consuming a WS.(thanks a lot!)

So, the WS publisher has to indicate in the WSDL that a WebMethod can accept an attachment, isn't it?

And if I create a Proxy Object based to the WSDL type I refer, I can see attachment as a normal WebMethod parameter of base64 type. Is it right?

Regards,

Raffaele

Former Member
0 Kudos

Hi,

Not really. Any webservice can accept attachment. You need not explicitly mention that in wsdl, as attachment is not part of envelope. If your webservice is written in such a way that it extracts attachment and do the needful, it will be able to extract the attachment else it wont readt the attachment.

You can try this in XI itself. Create a normal webservice hosted in XI Server, provide the wsdl to the the web service consumer. Invoke the Web Service from WS Client and send attachment. XI will be able to receive the attachment.

Please go through the link below to understand WS architecture with attachment.

http://java.sun.com/developer/EJTechTips/2005/tt0425.html

Thanks

Amit

Reward points if answer is helpful

Former Member
0 Kudos

Check this blog

/people/baris.buyuktanir2/blog/2007/03/06/how-to-create-a-web-service-with-attachments-soap-with-attachments

this will hopefully give you some directions

Sameer