SOAP Attachments
Hi,
I need to call a web service with an image attachment (as
defined in the WS-I attachment profile) in the SOAP response. Is
this possible with Flex 2 / Actionscript 3? Are there any examples
for this?
Thanks in advance,
Pete Smith
Wellington, NZ
Hi,
I need to call a web service with an image attachment (as
defined in the WS-I attachment profile) in the SOAP response. Is
this possible with Flex 2 / Actionscript 3? Are there any examples
for this?
Thanks in advance,
Pete Smith
Wellington, NZ
Similar Messages
-
How to deal with SOAP attachments?
Is there any information available on how to work with SOAP attachments? I am looking
for a feature similar to what is available in other products where you can take a
byte[] and map to image/jpg, application/octet-stream, etc... and have the tool create
the appropriate message formats. How would I do this using WL Workshop? I could
not find anything in the docs... is this supported?
Thanks,
BobEasiest thing is to encode the contents of the binary object in the XML
message as you suggest.
I'd like to hear more about what you are trying to do as well -- we're
planning on adding support for attachments in the next release, and I'd like
to make sure we do it in a way that meets your needs.
-C
"Bob Hayden" <[email protected]> wrote in message
news:[email protected]...
>
I am evaluating the capability of returning and consuming image/fileattachments through
a web service. This is one of our high priority integration requirementsand must
be available somehow through the framework we choose. Other productshave ways
to do this through an IDE... if WorkShop is not going to directly supportthis then
does anyone have any suggestions or examples on how this can be done in away that
is still intuitive for a WorkShop user (in other words without rolling upyour sleeves
and digging into JAX-RPC)? I suppose one could base64 it and add it tothe WorkShop-generated
message as a String using the return XML map, but I would prefer toinvestigate a
more standards-based approach.
Is it just me or does the lack of support for SOAP attachments seem to bea serious
missing piece from WL Workshop?
-Bob
"Raj Alagumalai" <[email protected]> wrote:
Bob,
WebLogic Workshop does not currently support SOAP attachments. However,
please note
that if you are developing your Web services using the APIs and services
provided
by J2EE and WebLogic Server directly, WebLogic Server does support SOAP
attachments.
Please refer to the following document for more Workshop FAQ's
http://dev2dev.bea.com/resourcelibrary/faqdetail.jsp?productType=weblogic+w
orkshop&highlight=faq
>>
Thanks
Raj Alagumalai
WebLogic Workshop Support
"Bob Hayden" <[email protected]> wrote:
Is there any information available on how to work with SOAP attachments?
I am looking
for a feature similar to what is available in other products where youcan
take a
byte[] and map to image/jpg, application/octet-stream, etc... and havethe
tool create
the appropriate message formats. How would I do this using WL Workshop?
I could
not find anything in the docs... is this supported?
Thanks,
Bob -
How to pass SOAP Attachments with JAX-RPC Web Service
I'm confused...
This sample shows how to send/receive SOAP attachments by using the JAX-RPC Handler mechanism. Can somebody confirm if this is the preferred way to do this. I've seen an example wich does something like:
public interface AttachmentService extends Remote {
public String storeDocumentService(javax.activation.DataHandler dh, String filename) throws RemoteException;
}and then uses JAX-RPC utilities to create wsdl, stubs and stuff. Does this have the same result, as what the OTN example shows (from an architecture perspective?
Thx,
Jan.Well, how an attachment is processed depends on your application logic...if your application logic requires to processing attachments and verify it before processing the SOAP message, handlers could be better option.
If you need to process the attachment while processing the SOAP message, you can do it in the service implementation class.
In both the cases you need to get access to SOAPMessage object and from there get the attachments with getAttachments method. -
Mapping DataHandler for SOAP attachments
Hi all.
I'm working on a web service that uses SOAP attachments in WebLogic Workshop 8.1,
but I'm having a bit of trouble testing. When I try to access the web service
using the auto-generated client jar provided by workshop, I get the following
error:
java.rmi.RemoteException: web service invoke failed; nested exception is:
javax.xml.soap.SOAPException: failed to serialize xml:weblogic.xml.sche
ma.binding.SerializationException: mapping lookup failure. class=class javax.act
ivation.DataHandler class context=TypedClassContext{schemaType=['http://www.w3.o
rg/2001/XMLSchema']:base64Binary}
I was under the impression that the DataHandler mapping was handled by BEA. Must
I manually map the type in order to use SOAP attachments, or am I missing another
vital step?
I've attached the WSDL file for this service. Thanks.
-Brian
[WS_Import.wsdl]Hi Brian,
I just created a .jws, client jar and standalone JAX-RPC static stub client, using
the WSDL you attached. Everything seems to work in WLS 8.1 SP2. Is this the version
you're using? I have attached a zip containing the static JAX-RPC static stub
client, and the .jws. To test it in the WLW IDE, you'll need to create the following
directories, in the WebLogic Server domain directory you use for WLW:
DCTMWebServices/attachments
The client just sends the certificate.war file, in the DataHandler dhContent argument.
This file is located in the domain directory, you use for WLW. The .jws saves
the attachment into the DCTMWebServices/attachments directory.
Here's the command line I use to run the standalone client:
c:\bea\home1\jdk141_05\jre\bin\java -classpath classes;lib\WS_Import.jar;C:\bea\home1\weblogic\platform81sp2\server\lib\webserviceclient+ssl.jar
-Dweblogic.webservice.verbose=true -Dweblogic.webservice.binding.verbose=true
DTCMWebServices.consumers.standalone.stub.WLWClient 2>stderr.out>stdout.out
Regards,
Mike Wooten
"Brian McLoughlin" <[email protected]> wrote:
>
>
>
Hi all.
I'm working on a web service that uses SOAP attachments in WebLogic Workshop
8.1,
but I'm having a bit of trouble testing. When I try to access the web
service
using the auto-generated client jar provided by workshop, I get the following
error:
java.rmi.RemoteException: web service invoke failed; nested exception
is:
javax.xml.soap.SOAPException: failed to serialize xml:weblogic.xml.sche
ma.binding.SerializationException: mapping lookup failure. class=class
javax.act
ivation.DataHandler class context=TypedClassContext{schemaType=['http://www.w3.o
rg/2001/XMLSchema']:base64Binary}
I was under the impression that the DataHandler mapping was handled by
BEA. Must
I manually map the type in order to use SOAP attachments, or am I missing
another
vital step?
I've attached the WSDL file for this service. Thanks.
-Brian[brian2.zip] -
I have to implement a File Transfer Service from one application to the other application. Initially I thought to do it with socket programming. In that case I have to take care of all the details. Then I decided to use SOAP-attachments to transfer the files. I want to send the files as the attachments to a SOAP message, so that I need not do the low level stuff. But, I am not sure which is the best solution. The files which I send are very big like 10MB or 20MB. Is it good to send them as an attachments to SOAPMessage(Using JAXM) or to go for socket programming. Does JAXM support transfer of big files? Or, if you know any other better solution for transfer of files from application to application please suggest me.
Seenu.Hi, did you ever get a response to your question or figure it out on your own? I'm about to decide the same thing and was trying to find information on large attachments to SOAP messages and whether it's a good idea or not. Specifically, I'm wondering if these large files are read completely into memory at any point or if the API is smart enough to cache...
-
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());
} -
i have writen a code to send soap attachments from client to server
In the code below i 'm sending txt file and xml file from client to server
when i see the value of msg.countAttachments();it 's value is 2 that mean two attachments are reciving with ut no problem
now i want to save both attachments in servermachine c:/ directory how do i di that
i tried to access the attachment like this
java.util.Iterator it = msg.getAttachments();
while (it.hasNext()) {
AttachmentPart attachment = (AttachmentPart)it.next();
Object content = attachment.getContent();
for more clear below -client code attaching part
FileDataSource fds = new FileDataSource(m_attachment);
DataHandler dh = new DataHandler(fds);
AttachmentPart ap1 = msg.createAttachmentPart(dh);
msg.addAttachmentPart(ap1);
AttachmentPart ap2 = msg.createAttachmentPart("Another Part","text/plain; charset=ISO-8859-1");
msg.addAttachmentPart(ap2);
msg.saveChanges();
//create the endpoint and send the message
URL endpoint = new URL("http://localhost:8080/jaxm-coffee-supplier/getPriceList");
SOAPMessage response = con.call(msg, endpoint);
ThanksHello!
I'm sure you already solved the problem you had and I hope you can help me out with my little problem. I want to create a file upload with a web service. I copied the code from sun's tutorial (and now from your post), but I constantly get the NullPointerException on the call:
AttachmentPart attachment = msg.createAttachmentPart()
(or AttachmentPart attachment = msg.createAttachmentPart(dataHandler);)
Can you please tell me what's wrong with my code?
Thnx in advanced, D
(BTW here is my code:)
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPConnection;
import javax.xml.soap.SOAPConnectionFactory;
import javax.xml.soap.SOAPMessage;
public class client01 {
public static void main(String args[]) throws Exception, MalformedURLException {
MessageFactory factory = MessageFactory.newInstance();
Message msg = factory.createMessage();
ConnectionFactory soapConnectionFactory = ConnectionFactory.newInstance();
Connection con = soapConnectionFactory.createConnection();
FileDataSource fds = new
FileDataSource("C:"+File.separator+"image"+File.separator+"test01.jpg");
DataHandler dh = new DataHandler(fds);
AttachmentPart attachment = msg.createAttachmentPart(dh);
(Here I get the Fatal server Error => NullPointerException)
attachment.setContentId("attached_image");
msg.addAttachmentPart(attachment);
msg.saveChanges();
URL endpoint = new
URL("http://localhost:9090/RKO/services/zmogljivost?method=stevilo&str=test");
SOAPMessage response = con.call(msg, endpoint);
con.close(); -
DIME format for handling SOAP attachments
Hi all,
There is a proposal (I think by Microsoft) called the Direct Internet Message Encapsulation (DIME) format to handle SOAP attachments. This is a binary format which defines how to construct a single message with multiple payloads and it is suppose to be more efficient that MIME especially for large attachments.
Does anybody know the status of this proposal?
Thanks,
KenHi, I'm also looking for a DIME java implementation,
let me know if you find something
maybe we will develop it ourselves -
Does anyone know of documentation that states what the maximum suggested SOAPBody size is before one should begin using a SOAP Attachment?
thanks!Check this site:
http://www.w3.org/TR/SOAP-attachments.html#MultipartRelated
I am not sure if this is what you are referring to. I guess you may want to click the RFC specification links too. -
2 questions really:
1) Is there a way to define soap attachments in a WSDL? How? Can I just use wsdlc then?
2) Is there a way to access SOAP attachments if the WSDL doesn't describe them? Would I do this via a SOAP handler? Or is there another way?Hi,
can you check the wsdlLocation attribute of the @WebService annotation in your ejb endpoint impl, its name should be same with the wsdl in the EJB-JAR.
alternatively, you can modify the wsdl name in jar:/META-INF/wsdls/XXX.wsdl to allow it same with the attribute.
HTH,
Kevin -
SOAP Attachments - Streaming interoperability
Hi
I am really interested with Streaming attachments in OC4J.
But I assume it is not interoperable.
When I try to use Streaming for my Web Service, i get an error message that my JAX-RPC handler cannot unmarhall the WS operation (I know weird error).
So it seems that if I want to use Streaming - I have to forget about JAX-RPC handlers (for example logging handler)
Additionally when you open WSDL (of WS + Streaming) file you will see that there is a xml part which is not a WS-I standard:
<sa:stream-attachments xmlns:sa="http://oracle.com/schemas/webservices/streaming-attachments" name="attachments"/>
- and using wsi-test-tools you will get a failure message that it is not
a part of standard namespace: http://schemas.xmlsoap.org/wsdl/soap/
So i guess that client of a Web Service with Streaming must be a JAVA client - and additionally with a usage of oracle WS jar libraries.
So there is a question now, how to enable in OC4J sending big attachments with Interoperability.
I think using AXIS2 module is not an answer, as it also uses JAX-RPC approach based on DOM xml parsers, which means loading whole attachments into memory (no matter if its MTOM, SwA or Base64Encoding).
My question is: IS THERE ANY WAY TO SEND LARGE ATTACHMENTS IN OC4J WITH FULL INTEROPERABILITY (maybe some chunk options)?
Thanks a lot for any answer
JerzyHi, did you ever get a response to your question or figure it out on your own? I'm about to decide the same thing and was trying to find information on large attachments to SOAP messages and whether it's a good idea or not. Specifically, I'm wondering if these large files are read completely into memory at any point or if the API is smart enough to cache...
-
Rename SOAP attachments on Receiver side
Hello Experts
I have a synchronous scenario where File <-> PI <--> SOAP, where I try to retrieve attachments from target system and create a file.
However the name in the attachments received from target system are not being retained. I used the code snippet from blog: Retaining SOAP Adapter Attachment Names in my response mapping (Sys2 -> Sys1) and it doesn't seem to help. Any pointers?
Thanks
JayaHi Jaya - Never tried with sync scenarios but
I hope you handled the content type as explained in the blog..
1) Code for textual attachments e.g., XML, flat etc.. with required encoding e.g., UTF-8
contentType = contentType + ";charset = \"UTF-8\";"+ "name=\"" + attachmentID + "\"";
2) Code for binary attachments e.g., pdf's, images etc..:
contentType = contentType + ";"+ "name=\"" + attachmentID + "\"";
and "Read Attachments" is checked the operation mapping... -
Trivial problem with SOAP attachments
Hi,
I'm writing a very simple standalone JAXM client which will send a SOAP message with attachments to a listening servlet. I can get the code to work for a SOAP message without attachments with no problems, but when I try to create an AttachmentPart object, there is a problem when running the code (there is an exception when I try to create an AttachmentPart object) even though the code compiles ok.
It must be something really obvious, and I've tried copying examples from the JWSDP tutorial but to no avail! Any ideas welcome!
import javax.xml.soap.*;
import java.util.*;
import java.net.URL;
public class JAXMClient{
public static void main(String[] args){
String me = "Simon";
try{
SOAPConnectionFactory scFactory = SOAPConnectionFactory.newInstance();
SOAPConnection con = scFactory.createConnection();
MessageFactory factory = MessageFactory.newInstance();
SOAPMessage message = factory.createMessage();
// create attachment
AttachmentPart attachment = message.createAttachmentPart();
attachment.setContent(me, "text/plain");
attachment.setContentId("my_name");
message.addAttachmentPart(attachment);
URL endpoint = new URL("http://localhost:8080/EGSO/TestServlet");
System.out.println("Calling service....");
SOAPMessage response = con.call(message,endpoint);
System.out.println("Reply received!");
response.writeTo(System.out);
con.close();
catch(Exception e){
System.out.println("Error somewehere");I use the below code to add attachments (from JWSDP tutorial)
StringBuffer urlSB = new StringBuffer();
urlSB.append(req.getScheme()).append("://").append(req.getServerName());
urlSB.append( ":" ).append( req.getServerPort() ).append( req.getContextPath() );
String reqBase = urlSB.toString();
AttachmentPart apText = msg.createAttachmentPart(new DataHandler(new URL(reqBase + "/test.html")));
apText.setContentType("text/html");
msg.addAttachmentPart(apText);
(where msg is the SOAPMessage, and the "test.html" file resides in your servlet container's ROOT dir (eg $TOMCAT_HOME/webapps/ROOT)
Ben -
SOAP attachments :: Error while downloading attachments more than 10MB
Hi,
We are getting the below error when downloading the attachments of size > 10mb.
Client details:
Java version: 1.6.0_05
OS: SunOS
OS version: 5.10
OS architecture: sparc
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2786)
at java.io.ByteArrayOutputStream.toByteArray(ByteArrayOutputStream.java:133)
at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.readFully(HttpSOAPConnection.java:636)
at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOAPConnection.java:379)
at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection$PriviledgedPost.run(HttpSOAPConnection.java:169)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:140)
at com.sun.sunit.webservice.soap.SOAPClient.invokeService(SOAPClient.java:94)
at com.sun.sunit.webservice.soap.SOAPClient.invokeService(SOAPClient.java:69)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.sunit.util.MethodUtil.invokeMethod(MethodUtil.java:74)
at com.sun.sunit.util.MethodUtil.invokeMethod(MethodUtil.java:38)
at java.lang.Thread.run(Thread.java:619)
Download of large attachments used to work when code is 1.4.2 compiled and SAAJ is 1.2
We have upgraded the code to 1.5 and using SAAJ 1.3 now.
We are unable to download attachments > 10MB.
Please let us know if we need to do any changes at SAAJ to fix this error ?
Note : This message has been posted accidentally in Java Servlet and hence re-posting.
Thanks.RaghuNaveen wrote:
Download of large attachments used to work when code is 1.4.2 compiled and SAAJ is 1.2
We have upgraded the code to 1.5 and using SAAJ 1.3 now.So, this problem is actually caused by SAAJ 1.3 or possibly Java 1.5?
Try downgrading to SAAJ 1.2 first. If that doesn't help, then is it probably a bug in Java 1.5. But according to the stacktrace, I rather think it's a bug in SAAJ 1.3 (as mentioned in the previous topic). -
Does OC4J support soap attachments???
If yes where can I find the api???
Is it the same as apache soap? someting like message.add/getAttach(mimebodypart)?
Does the wizards handle it?
TAD
MauroYou can use Oracle SOAP services to send attachments with SOAP request.
Refer documentation on Oracle9iAS SOAP services here
http://otn.oracle.com/docs/products/ias/doc_library/903doc_otn/generic.903/b10004/oraclesoap.htm#640260
You can look at the sample services described here
http://otn.oracle.com/docs/products/ias/doc_library/903doc_otn/generic.903/b10004/oraclesoap.htm#643327
The samples.jar referred in above doc can be found in in
<OC4J_Home>\soap\webapps\soap.ear =>soap.war =>samples.jar
The Mime Sample demonstrates SOAP with attachment
Chandar -
Sending SOAP Attachments through BPEL--Urgent
Hi All,
we are calling one external web service from bpel.webservice expecting 2 attachments as part of request. here is the sample soap request.
*<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:imp="http://www.agile.com/2004/01/ais/import">*
*<soapenv:Header/>*
*<soapenv:Body>*
*<imp:importDataRequest>*
*<imp:dataSource>*
*<imp:attachmentRef href="cid:12266262222"/>*
*<imp:type>aXML</imp:type>*
*</imp:dataSource>*
*<imp:mapping>*
*<imp:attachmentRef href="cid:9876553333"/>*
*</imp:mapping>*
*</imp:importDataRequest>*
*</soapenv:Body>*
*</soapenv:Envelope>*
1.how can we attach file throgh bpel in SOAP request and then how to provide reference number to href field..
2. is there any alternative to achive this?
if anyone have the working example or link please send me to [email protected]
Thanks,
Sudhakar.MYou could create a variable base64Binary and assign the content of the ora:getAttachmentContent() return value. And then write to a file using the option "Native format translation is not required (Schema is opaque)" from the file adapter and assign to the opaque element.
Maybe you are looking for
-
Screen goes dark..not completely black
Hi Last night my computer screen went dark. I could still see what was on the screen but it was very very dark. Had to force quit with power button. Computer came back on and was fine. Now this morning when I went to power on, it powered on fine then
-
What video file format should i use for a banner mpu ad
Hi, I have to make a banner mpu ad which plays video, the file i have is a wmv file (3000k). Should i convert this file to a flash video file and drop it in the flash file or should i convert it to another video file format bearing in mind that the f
-
Error when loading actuals re: admin task exception thrown
The "admin task" step (#176 below) of an actuals load package we run is failing and yielding the error message "exception has been thrown by the target of an invocation". We have seen this error ourselves in the past on the front end when we try to
-
IPhoto6 not accepting Lumix FX150 RAW images
Dismayed to discover that iPhoto6 changes the FX150 RAW files to JPEGs (presumably because it does not support this Panasonic camera). However, Image Capture will "let them through" unaffected. Is iPhoto 08 o.k. with OS 10.4.11. and does it support t
-
CRXIr2 - PDF Export, Font size issue
I know this is covered in other threads, however I've tried the registry hacks suggested, and it doesn't work. I have the following keys in place HKEY_USERS\S-1-5-20\Software\Business Objects\Suite 11.5\Crystal Reports\Export\PDF HKEY_LOCAL_MACHINE\S