Issue in File to SOAP as Attachment
Hi,
I have scenario from File to SOAP.
I ma to send two files one file as content of SOAP request and other one as file attachment. The problem is i cannot send message both file content and file attachment.
Because when i select the "keep attachment" in the SOAP adapter both content and attachment become attachment, but if i didn't tick, only content is display by the recipient without the attachment.
How can i configure SOAP adapter so the recipient can receive both content file and attachment file.
Solution will be rewarded
Thanks
Jaideep Baid
hi gaurav,
actually my SOAP payload will be a file only but I wnat to send till a perticular node as a SOAP payload and rest part as an attachment.
like
message----Root node
field 1
field 2
field 3
subfield 1
subfield 2
subfield 3
subfield 4
SO i want till field2 it should go as payload and from field 3 i should go as attachment.
OR i can make two files of different name.
file1's content
field 1
field 2
file2's content
field 3
subfield 1
subfield 2
subfield 3
subfield 4
Now in this case file 1 should go as SOAP payload and File2 as attachment.
So that In XI i can see two different file one named as mainDocument and other one name as Attachment.
Plzz suggest any solution
Thanks
Jaideep jain
Similar Messages
-
Soap with attachment To File scenario
Hi All,
In my scenario I need to read data on webservice with file in attachments. Webservice in will have two values- data in payload and file in attachments. And on the target side two files one XML with data and one attachment must be created on the file directory.
Can any one help me how this task can be implemented in XI
Thanks in advance.
Regards,
VikramHi,
some links about this topic:
SOAP to file scenario
Send a file usring SOAP adapter
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d23cbe11-0d01-0010-5287-873a22024f79
Hope it helps.
Regards
Patrick -
How to attach files in soap response?
IS there any way to attach a file in soap response? how to do that??:|
Probably MTOM is what you need:
http://edocs.bea.com/wls/docs100/webserv/jws.html#mtom
But this is apparently not doable with ALSB (it would be supported just with regular web services):
http://forums.bea.com/thread.jspa?threadID=300002302
Note the file naming would need to be done by the SOAP client:
http://www.jroller.com/gmazza/date/20071102 (Look at Steps #6 and #11 and Note # 7)
HTH,
Glen -
Hi everyone,
I am having difficulty in attaching files to SOAP messages. Anyone who has a knowledge
about how to programatically attach files to SOAP. Thank you..
Have a good work.Thank you for your interest. I think that I wrote the code which adds attachment to SOAP messages.
However, I think that I need a web service which accepts an attachment. Do u know any web service
which accepts an attachment? -
Error while opening a pdf file sent as an attachment in mail
Dear All,
We have converted a alv grid into pdf and sent a mail with the attached pdf file. When the attachment is opened in the received mail we get an error " File does not begin with %pdf-". I am pasting the code.
Select single
from
TSP01
where
RQIDENT = wa_listident.
if sy-subrc <> 0.
exit.
endif.
client = tsp01-rqclient.
name = tsp01-rqo1name.
*BREAK-POINT.
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
AUTHORITY = 'SP01'
CLIENT = client
NAME = name
PART = 1
IMPORTING
CHARCO =
CREATER =
CREDATE =
DELDATE =
MAX_CREDATE =
MAX_DELDATE =
NON_UNIQ =
NOOF_PARTS =
RECTYP =
SIZE =
STOTYP =
TYPE = type
OBJTYPE = objtype
EXCEPTIONS
FB_ERROR = 1
FB_RSTS_OTHER = 2
NO_OBJECT = 3
NO_PERMISSION = 4.
if objtype(3) = 'OTF'.
is_otf = 'X'.
else.
is_otf = space.
endif.
*BREAK-POINT.
CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
EXPORTING
rqident = wa_listident
desired_type = desired_type
IMPORTING
real_type = real_type
TABLES
buffer = l_objcont
EXCEPTIONS
no_such_job = 14
type_no_match = 94
job_contains_no_data = 54
no_permission = 21
can_not_access = 21
read_error = 54.
IF sy-subrc EQ 0.
attach_type = real_type.
ENDIF.
if is_otf = 'X'.
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = wa_listident
NO_DIALOG = c_no
DST_DEVICE =
PDF_DESTINATION =
IMPORTING
PDF_BYTECOUNT = gd_bytecount
PDF_SPOOLID = pdfspoolid
OTF_PAGECOUNT =
BTC_JOBNAME = jobname
BTC_JOBCOUNT = jobcount
TABLES
PDF = it_pdf_output
EXCEPTIONS
ERR_NO_OTF_SPOOLJOB = 1
ERR_NO_SPOOLJOB = 2
ERR_NO_PERMISSION = 3
ERR_CONV_NOT_POSSIBLE = 4
ERR_BAD_DSTDEVICE = 5
USER_CANCELLED = 6
ERR_SPOOLERROR = 7
ERR_TEMSEERROR = 8
ERR_BTCJOB_OPEN_FAILED = 9
ERR_BTCJOB_SUBMIT_FAILED = 10
ERR_BTCJOB_CLOSE_FAILED = 11
CHECK sy-subrc = 0.
ENDIF.
Transfer the 132-long strings to 255-long strings
LOOP AT it_pdf_output.
TRANSLATE it_pdf_output USING ' ~'.
CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
it_mess_att = gd_buffer.
APPEND it_mess_att.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
Please guide me to resolve this issue.
Thanks & Regards,
AnandHi,
is the next part of the code correct.
What i mean is packing of the attachment, finding out the size of pdf file and doc type as PDF.
You can also try below link..
Link: [http://wiki.sdn.sap.com/wiki/display/Snippets/SENDALVGRIDASPDFATTACHMENTTOSAPINBOXUSINGCLASSES]
Hope this helps.
Regards,
-Sandeep -
Hi,
I am trying out a scenario from file<>BPM<>SOAP.
In the Call Adapter step I am getting the following error message:
<!-- Call Adapter
-->
- <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
<SAP:Category>XIAdapter</SAP:Category>
<SAP:Code area="BPE_ADAPTER">MESSAGE_NOT_USED</SAP:Code>
<SAP:P1 />
<SAP:P2 />
<SAP:P3 />
<SAP:P4 />
<SAP:AdditionalText />
<SAP:ApplicationFaultMessage namespace="" />
<SAP:Stack>Message is not used by any processes</SAP:Stack>
<SAP:Retry>M</SAP:Retry>
</SAP:Error>
The Message is successfully reaching BPM but then the error occurs.
Please help me in this regards.
Thanks,
Abhishek.Hi,
check these
1. Go to Transaction: SXI_CACHE and check the return code for your intergration process, it must be 0.
Might solve your issue
2. In MONI click on PE (you will find this when you scroll towards right). Now navigate like this Goto ---> Graphical workflow log. Check in which step there is a error (it will be in red colour lines).
3.Can u check whether the interface used in Sender agreement is the same as the interface used in Receiver Determination, whose receiver is BPM?
4.Check the receiver determination for file to BPM. The file message that enters the BPM i think is not able to find the receiver.
Try one more things. In your BPM, try a f7 and see if there is any syntax errors.
Hope this will help you.
Regards
Aashish Sinha
PS : reward points if helpful -
Dear Friends,
I am working on File to Soap scenario,In this scenario File is picking succssfully and posting to target side I got the error in RWB like
Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: SOAP: response message contains an error XIAdapter/PARSING/ADAPTER.SOAP_EXCEPTION - soap fault: Server was unable to read request. ---> There is an error in XML document (1, 2205). ---> Input string was not in a correct format.
How to correct the input string , Please suggest how to resolve this issue.
Thanks & Regards,
Shalini Shah.This error occurs when:
1) Incorrect data structure is send to the SOAP application ..... compare the payload that you are sending to the SOAP application with the WSDL structure that you have imported in IR .... both should match exactly....also confirm that the WSDL you are using the latest one.
2) Target URL/ Action is not properly configured in the receiver SOAP channel
3) Is your target system up and running?
Regards,
Abhishek. -
Hi Experts,
I have created File to Soap syn Scenario.
I am getting following error in RWB (CC monitoring)::
SOAPFault received from Integration Server. ErrorCode/Category: XIProtocol/WRONG_VALUE; Params: SOAP:Envelope(1)SOAP:Header(1)sap:DynamicConfiguration(3)sap:Record(1), xi_input120100406-133524-40720100406-133535-09520100406-133535-32920100406-133535-57920100406-133535-82920100406-133536-07920100406-133536-32920100406-133536-56420100406-133536-78220100406-133537-032.xml, ST: ST_XMS_MSGHDR30_DYNAMIC; AdditionalText: An error occurred when deserializing in the simple transformation program ST_XMS_MSGHDR30_DYNAMIC; ApplicationFaultMessage: null; ErrorStack: XML tag SOAP:Envelope(1)SOAP:Header(1)sap:DynamicConfiguration(3)sap:Record(1) (or one of the attributes) has incorrect value xi_input120100406-133524-40720100406-133535-09520100406-133535-32920100406-133535-57920100406-133535-82920100406-133536-07920100406-133536-32920100406-133536-56420100406-133536-78220100406-133537-032.xml An error occurred when deserializing in the simple transformation program ST_XMS_MSGHDR30_DYNAMIC Data loss occurred when converting xi_input120100406-133524-40720100406-133535-09520100406-133535-32920100406-133535-57920100406-133535-82920100406-133536-07920100406-133536-32920100406-133536-56420100406-133536-78220100406-133537-032.xml
Please suggest
T& R
SushamaHi Babu,
I am sorry if I was not clear in explaning.
Okay. I meant with the DC parameters the dynamic configuration parameters (or officially called the adapter specific message attributes or ASMA) that the file adapter added in the XI message. I assume Sushama activated this feature to transport the file adapter specific information (e.g., the file name, etc). These parameters are included in the DynamicConfiguration SOAP header. Sushama should check those entries in RWB at the adapter engine.
Some of those parameter values appeared to be too long and resulted in the quoted error:
>sap:DynamicConfiguration(3)sap:Record(1) (or one of the attributes) has incorrect value
Once which parameters are too long, Sushama can decide on how to resolve this issue using one of the options that I suggested in my previous reply.
I hope you got the idea this time.
Best regards, Yza -
Send and Receive an xml file over SOAP adapter
hi,
I want to send an xml file as an attachment over SOAP adapter and Response also should be file.
Can anybody tell the exact solution.
Useful responses will be appreciated
Thanks
Jaideep JainHi Jaideep,
Yes you can send the any file throgh SOAP adapter by selecting the Keep Attachments option.
For your requirement you can go throgh the following link
Re: Attachments in SOAP adapter
http://www.w3.org/TR/SOAP-attachments
http://www.theserverside.com/tt/articles/article.tss?l=SendingAttachmentsWithSOAP
Regards
Sridhar Goli -
SOAP Message Attachment MIME Problem
Hi there,
I'm having problem trying to send a binary file with SOAP.
I can send an XML Doc (MIME type text/xml) but when I try to put the ByteArrayInputStream that holds the binary file and the content to application/octec-stream
I got this exception:
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type application/octet-stream
at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:851)
at javax.activation.DataHandler.writeTo(DataHandler.java:305)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1089)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:635)
at javax.mail.internet.MimeMultipart.writeTo(MimeMultipart.java:233)
at com.sun.xml.messaging.soap.MessageImpl.saveChanges(MessageImpl.java:371)
Anyone had this problem ?
Any work around ?
Or this is a problem because the JAXM is not fineshed yet ?
Thanks,
MarcioHey guys... I pray you are all still listening.
I have been on the most mind numbing cookie trail ever (I'm blatantly lying - I'm a Java programmer!) following these blasted exception trails to an 'Unknown Source'
After initially reading this thread I quickly knocked up ObjectDataSource as follows:
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.Serializable;
import javax.activation.DataSource;
public class ObjectDataSource
implements DataSource
public static final long serialVersionUID;
public static final String CONTENT_TYPE;
static {
serialVersionUID = 42L;
CONTENT_TYPE = "application/x-java-serialized-object";
} // end static initializer
private byte[] objectBytes;
private String contentId;
public ObjectDataSource(Serializable object, String contentId)
throws IOException
if (contentId == null || contentId.equals(""))
this.contentId = object.getClass().getName();
else
this.contentId = contentId;
ByteArrayOutputStream baoStream = new ByteArrayOutputStream();
ObjectOutputStream ooStream = new ObjectOutputStream(baoStream);
ooStream.writeObject(object);
ooStream.flush();
ooStream.close();
objectBytes = baoStream.toByteArray();
} // end primary constructor
public InputStream getInputStream()
throws java.io.IOException
ByteArrayInputStream baiStream = new ByteArrayInputStream(objectBytes);
return new ObjectInputStream(baiStream);
} // end getInputStream
public OutputStream getOutputStream()
throws java.io.IOException
throw new IOException("Cannot write to this stream");
} // end getOutputStream
public String getContentType()
return CONTENT_TYPE;
} // end getContentType
public String getName()
return contentId;
} // end getName
} // end ObjectDataSource classand use it as follows:
AttachmentPart attachment = soapResponse.createAttachmentPart();
ObjectDataSource ods = new ObjectDataSource(requestedObject, null);
attachment.setDataHandler(new DataHandler(ods));
attachment.setContentId(ods.getName());
soapResponse.addAttachmentPart(attachment);
soapResponse.saveChanges();... this is within my 'SOAPServlet extends JAXMServlet' servlet, which happens to work fine when testing the servlet outside a web-container. But testing with Tomcat 5.5.x It doesn't work... infact, it damn well dissappears. I try readObject after retrieving and casting the InputStream to an ObjectInputStream from the AttachmentPart, but I get a:
Exception in thread "main" java.lang.ClassCastException: java.io.ByteArrayInputStream which is totally bizzare!
So I do a bit of investigation to discover ....
application/x-java-serialized-object
java.lang.String
javax.mail.internet.MimePartDataSource
java.io.ByteArrayInputStream
0 // this would be the available bytes in the ByteArrayInputStreamNow the first two lines confirm my ObjectDataSource is there somewhere or that that data was sent over the wire (ha, i'm on the same damn machine), but where the hell did MimePartDataSource come from?
I have previously encountered the various exceptions including java.io.EOFException when trying to read from the byte stream and java.io.StreamCorruptedException when wrapping that byte stream with an object stream.
These setbacks have royally ****ed my project; cahnces are slim that it will get finished. I'm ready to give up.
Any help will be appreciated?
Warm regards,
Darren B -
Hello,
I need to develop a WebDynpro application with NetWeaver 2.0 for SAP EP6 that call a remote web service in order to send an attached file with SWA (Soap With Attachment) methodology. The kind of file to attach is XML.
Can someone give me refers or indications to implement it?
Thanks and best regards,
Matteo.
Edited by: Matteo De Santis on Oct 21, 2008 11:45 AMFollowing link might help you :
http://help.sap.com/erp2005_ehp_03/helpdata/EN/5e/ea656273b74cf386a1f29fc55721fd/frameset.htm
Thanks. -
Send SOAP DIME Attachment (please comment on my sample code)
Hi All,
I had hard time trying to find a send SOAP DIME attachment
code for the web service. And here it is, I wrote one,
but I use to easy way to deploy the service.
I just simply change the extension .java to .jws,
so, can you all tell me whether it will be a problem or not ?
And please review my code below, I debugged and no error,
but I am not sure if it is working right.
Basiclly 2 operations:
public String generateID(int artID)
public File detachFile(String filename)
Please comment on this code, I am trying to make it
more robust, so, that I can redo it and post it to share with
everybody.
thanks,
Derek
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Iterator;
import java.io.*;
import java.security.*;
import java.security.NoSuchAlgorithmException;
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import javax.xml.soap.AttachmentPart;
import org.apache.axis.AxisFault;
import org.apache.axis.Message;
import org.apache.axis.MessageContext;
import org.apache.axis.attachments.Attachments;
import org.apache.axis.attachments.AttachmentsImpl;
import org.apache.log4j.Logger;
public class AttachmentYPMG
private static final Logger _logger = Logger.getLogger(AttachmentYPMG.class);
public AttachmentYPMG()
public String generateID(int artID)
String artid = Integer.toString(artID);
String md5_hash_string = plainStringToMD5(artid);
return md5_hash_string;
private String plainStringToMD5(String input) {
// Some stuff we will use later
MessageDigest md = null;
byte[] byteHash = null;
StringBuffer resultString = new StringBuffer();
// Bad things can happen here
try {
// Choose between MD5 and SHA1
md = MessageDigest.getInstance("MD5");
} catch(NoSuchAlgorithmException e) {
System.out.println("NoSuchAlgorithmException caught!");
System.exit( -1);
// Reset is always good
md.reset();
// We really need some conversion here
md.update(input.getBytes());
// There goes the hash
byteHash = md.digest();
// Now here comes the best part
for(int i = 0; i < byteHash.length; i++) {
resultString.append(Integer.toHexString(0xFF & byteHash));
// That's it!
return(resultString.toString());
public File detachFile(String filename)
InputStream is = null;
FileOutputStream os = null;
File file = null;
int totalAttachments ;
try
//Get all the attachments
AttachmentPart[] attachments = getMessageAttachments();
* getMessageAttachments() as provided by Steve Loughran in his mail
* to axis-user group
* http://www.mail-archive.com/[email protected]/msg08732.html
//Put the logic in a loop for totalAttachments for multiple
// attachments.
totalAttachments = attachments.length;
_logger.debug("saveFile(String filename = " + filename + ") - " +
"Total Attachments Received Are: "+ totalAttachments);
//Extract the first attachment. (Since in this case we have only one attachment sent)
DataHandler dh = attachments[0].getDataHandler();
//Extract the file name of the first attachment.
String name = filename;
_logger.debug("saveFile(String filename = " + filename + ") - File received on server is: " + name);
//Get the streams to file and from attachment, then stream to disk
is = dh.getInputStream();
file = new File(name);
os = new FileOutputStream(file);
this.writeBuffersAndClose(is, os);
} catch (Exception e)
_logger.error("detachFile(String filename = " + filename + ")", e);
//throw new AttachmentException(e);
//if(file!= null)
return file;
//else
//throw new AttachmentException("The attachment was not saved");
* extract attachments from the current request
* @return a list of attachmentparts or an empty array for no attachments
* support in this axis buid/runtime
private AttachmentPart[] getMessageAttachments() throws AxisFault
* Reusing the method implementation for AttachmentPart[]
* getMessageAttachments() as provided by Steve Loughran in his mail to
* axis-user group
* http://www.mail-archive.com/[email protected]/msg08732.html
MessageContext msgContext = MessageContext.getCurrentContext();
Message reqMsg = msgContext.getRequestMessage();
Attachments messageAttachments = reqMsg.getAttachmentsImpl();
if (null == messageAttachments)
System.out.println("no attachment support");
return new AttachmentPart[0];
int attachmentCount = messageAttachments.getAttachmentCount();
AttachmentPart attachments[] = new AttachmentPart[attachmentCount];
Iterator it = messageAttachments.getAttachments().iterator();
int count = 0;
while (it.hasNext())
AttachmentPart part = (AttachmentPart) it.next();
attachments[count++] = part;
return attachments;
* Simple method for writing one stream from another.
* @param is
* @param os
* @throws IOException
private void writeBuffersAndClose(InputStream is, OutputStream os)
throws IOException
int i = 0;
byte [] buffer = new byte[1024];
while (i != -1)
i = is.read(buffer, 0, buffer.length);
if(i > 0)
os.write(buffer, 0, buffer.length);
is.close();
os.close();Hi All,
I had hard time trying to find a send SOAP DIME attachment
code for the web service. And here it is, I wrote one,
but I use to easy way to deploy the service.
I just simply change the extension .java to .jws,
so, can you all tell me whether it will be a problem or not ?
And please review my code below, I debugged and no error,
but I am not sure if it is working right.
Basiclly 2 operations:
public String generateID(int artID)
public File detachFile(String filename)
Please comment on this code, I am trying to make it
more robust, so, that I can redo it and post it to share with
everybody.
thanks,
Derek
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Iterator;
import java.io.*;
import java.security.*;
import java.security.NoSuchAlgorithmException;
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import javax.xml.soap.AttachmentPart;
import org.apache.axis.AxisFault;
import org.apache.axis.Message;
import org.apache.axis.MessageContext;
import org.apache.axis.attachments.Attachments;
import org.apache.axis.attachments.AttachmentsImpl;
import org.apache.log4j.Logger;
public class AttachmentYPMG
private static final Logger _logger = Logger.getLogger(AttachmentYPMG.class);
public AttachmentYPMG()
public String generateID(int artID)
String artid = Integer.toString(artID);
String md5_hash_string = plainStringToMD5(artid);
return md5_hash_string;
private String plainStringToMD5(String input) {
// Some stuff we will use later
MessageDigest md = null;
byte[] byteHash = null;
StringBuffer resultString = new StringBuffer();
// Bad things can happen here
try {
// Choose between MD5 and SHA1
md = MessageDigest.getInstance("MD5");
} catch(NoSuchAlgorithmException e) {
System.out.println("NoSuchAlgorithmException caught!");
System.exit( -1);
// Reset is always good
md.reset();
// We really need some conversion here
md.update(input.getBytes());
// There goes the hash
byteHash = md.digest();
// Now here comes the best part
for(int i = 0; i < byteHash.length; i++) {
resultString.append(Integer.toHexString(0xFF & byteHash));
// That's it!
return(resultString.toString());
public File detachFile(String filename)
InputStream is = null;
FileOutputStream os = null;
File file = null;
int totalAttachments ;
try
//Get all the attachments
AttachmentPart[] attachments = getMessageAttachments();
* getMessageAttachments() as provided by Steve Loughran in his mail
* to axis-user group
* http://www.mail-archive.com/[email protected]/msg08732.html
//Put the logic in a loop for totalAttachments for multiple
// attachments.
totalAttachments = attachments.length;
_logger.debug("saveFile(String filename = " + filename + ") - " +
"Total Attachments Received Are: "+ totalAttachments);
//Extract the first attachment. (Since in this case we have only one attachment sent)
DataHandler dh = attachments[0].getDataHandler();
//Extract the file name of the first attachment.
String name = filename;
_logger.debug("saveFile(String filename = " + filename + ") - File received on server is: " + name);
//Get the streams to file and from attachment, then stream to disk
is = dh.getInputStream();
file = new File(name);
os = new FileOutputStream(file);
this.writeBuffersAndClose(is, os);
} catch (Exception e)
_logger.error("detachFile(String filename = " + filename + ")", e);
//throw new AttachmentException(e);
//if(file!= null)
return file;
//else
//throw new AttachmentException("The attachment was not saved");
* extract attachments from the current request
* @return a list of attachmentparts or an empty array for no attachments
* support in this axis buid/runtime
private AttachmentPart[] getMessageAttachments() throws AxisFault
* Reusing the method implementation for AttachmentPart[]
* getMessageAttachments() as provided by Steve Loughran in his mail to
* axis-user group
* http://www.mail-archive.com/[email protected]/msg08732.html
MessageContext msgContext = MessageContext.getCurrentContext();
Message reqMsg = msgContext.getRequestMessage();
Attachments messageAttachments = reqMsg.getAttachmentsImpl();
if (null == messageAttachments)
System.out.println("no attachment support");
return new AttachmentPart[0];
int attachmentCount = messageAttachments.getAttachmentCount();
AttachmentPart attachments[] = new AttachmentPart[attachmentCount];
Iterator it = messageAttachments.getAttachments().iterator();
int count = 0;
while (it.hasNext())
AttachmentPart part = (AttachmentPart) it.next();
attachments[count++] = part;
return attachments;
* Simple method for writing one stream from another.
* @param is
* @param os
* @throws IOException
private void writeBuffersAndClose(InputStream is, OutputStream os)
throws IOException
int i = 0;
byte [] buffer = new byte[1024];
while (i != -1)
i = is.read(buffer, 0, buffer.length);
if(i > 0)
os.write(buffer, 0, buffer.length);
is.close();
os.close(); -
Dear All,
We are trying a interface in which we wanted to do Post Goods Issue in SAP from a file. We have exposed our Z-RFC which will do PGI as webservice and has imported its WSDL in PI.
Then, we have created a File-PI-SOAP interface. Now, when we are testing the interface we are getting success message in SXMB_MONI but in RWB, message for picking the file is success and when I am opening the message details its showing
" 500 Internal Server Error" ""Application error occurred during the request procession."
Details: "The WebApplicationException log ID is [001A64D0A1FC005F0000004600002E4800CEA8DA2043BF9A]."
Same error is showing for the receiver message but at payload I am able to see the correct values.
Kindly let us know, if any configurations are to be required to remove thsi error.
Regards,
NJHi,
>500 Internal Server Error
does mean the server does not understand the request. I your case: You want to make use of a service which assumedly no exist. May be you have to release or activate it or to do something in SOAMANAGER. Please check your service first with SOAP UI.
Regards,
Udo -
InvalidSecurity Exception in WS and SOAP with Attachment
Hi all, <bR>
<br>
I created a EJB based webservice with the following signature: <br><br>
public String businessMethod2(byte[] arg1) {..}<br>
<br>
<br>
This Method is exposed as webservice, which is configured as SOAP with Attachment. <br>
All security or authentication settings are disabled by intention. <br>
The input param arg1 should be a binary file.
<br><br>
When I call this webservice I always get the following response: <br><bR>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" <br>
xmlns:xs="http://www.w3.org/2001/XMLSchema" <br>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><bR>
<SOAP-ENV:Body><bR>
<SOAP-ENV:Fault><bR>
<faultcode xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><b>wsse:InvalidSecurity</b></faultcode><bR>
<faultstring>000F1F90EDDB006C00000012000014D8000437A5EE6DAE4E : <b>WS Security can only be applied on a SOAP document.</b></faultstring><bR>
<detail><bR>
<ns1:com.sap.security.core.server.ws.service.WSSecurityException xmlns:ns1="http://sap-j2ee-engine/error">000F1F90EDDB006C00000012000014D8000437A5EE6DAE4E : WS Security can only be applied on a SOAP document.</ns1:com.sap.security.core.server.ws.service.WSSecurityException><bR>
</detail><bR>
</SOAP-ENV:Fault><bR>
</SOAP-ENV:Body><bR>
</SOAP-ENV:Envelope><bR>
<br>
<br>
My guess is, that the WAS 7.00 SP11 is magically configured for applying WS-Security to every webservice. <br>
<br>
The Security Profile settings for Inbound / Outbound - Paramters is "None" in Visual Admin Webservice Security. <br>
<br>
How can I get rid of this Exception and make the webservice work?
<br>
<br>
regards <br>
Gabi <br>http://newsgroups.bea.com/cgi-bin/dnewsweb?cmd=article&group=weblogic.developer.interest.webservices&item=4967
grazieee wrote:
>
HI, i have found an example that illustrates the reception and return of SOAP attachments
in web service method. However, the weblogic workshop I am using does not recognise
'DataHandler'. I typed 'public String echoAttachment(DataHandler dh) and it said
'web service does not support such data type'. Is there any resolution to it?
And if convenient, can i have the source code of attaching images to SOAP?
Thanks alot.
Good Day!
grazieee
P/S: I'm using weblogic version 8.1 -
Retriving .doc and .rtf files in soap attachments
Please help me
I'm using JAXM to retrive soap attachments
When i retrive txt files (.txt) it retrivs the content of the document
without any problem but when i try to retrive .doc or rtf
it gives content as
java.io.FileInputStream@587c94
(retrive attached files which are recived from client)
how do i get the content from word or rtf document
this is the way i tried to get the content
while (it.hasNext()) {
AttachmentPart ap = (AttachmentPart)it.next();
contentType = ap.getContentType();
content =(String)ap.getContent();
p.println("content---->"+content);//wrriting to text file
System.out.println("*** attachment content: " + content);
thanks namsHere is the code I used to send and receive a PDF file as a SOAP attachment. Note that if the sender uses a DataHandler for the attachment's content, there's no need to set the MIME type explicitly because the DataHandler does it for you.
* Sender
// create the data source and data handler
DataSource source = new FileDataSource("form.pdf");
DataHandler handler = new DataHandler(source);
// create attachment for message
AttachmentPart attachment = message.createAttachmentPart(handler);
// set content id (optional)
attachment.setContentId("enrollment_form");
// add attachment to message
message.addAttachmentPart(attachment);
// send message
providerConnection.send(message);
* Recipient
public class Receiver extends JAXMServlet implements OnewayListener {
public void onMessage(SOAPMessage message) {
// get attachment
Iterator it = message.getAttachments();
AttachmentPart attachment = (AttachmentPart) it.next();
if (attachment.getContentType().equals("application/pdf")) {
// read contents into byte buffer
ByteArrayInputStream contentStream =
(ByteArrayInputStream)attachment.getContent();
// use standard Java I/O methods to save in file
int bytesToRead = contentStream.available();
byte[] buffer = new byte[bytesToRead];
contentStream.read(buffer);
// write buffer to new file
FileOutputStream file = new FileOutputStream("form.pdf");
file.write(buffer);
file.close();
log("Attachment " + attachment.getContentId() + " with type "
+ attachment.getContentType() + " written to form.pdf");
else {
log("attachment content has MIME type " + attachment.getContentType()
+ ", Java type " + attachment.getContent().getClass());
}
Maybe you are looking for
-
Account Name = "Other..." ??? I've got the Solution
There are two ways you can go about resolving this issue. 1. Follow the steps here: http://docs.info.apple.com/article.html?artnum=306840 or (as was the case with me and the above didn't work, Apple Support was very helpful - so here I am returning t
-
How to send mails to dynamic receivers using XSLT mapping
Hi All, I have a problem with the mail attributes in xslt mapping. I have a condition on a source field, based on which the "TO" attribute should vary. For Example : If ROOT/HEADER/XYZ = 001 then receiver should be some abc email id If ROOT/HEADER/X
-
Internal order-budgeting & settelemnt
Hi friends, What is the internal order-budgeting & settlement?How to the settled and budgeted?Please explain with example in simple way? Regards, Chandra.
-
when i first started using logic it would open up right away it now can take up to two minutes to open. it seems as though the more projects i create, the longer logic takes to start. is this the norm? is there a better way to organize projects to pr
-
HI I am Working In production support Recently I am Facing a Problem in the Process chains Actual Process chain consist of Local Chains(many) Some times one Local chain does not trigger even the previous Local chain gets completed Sucessfu