Skip to main content

sending DIME attachment with JAX-WS

1 reply [Last post]
sarkis
Offline
Joined: 2008-05-22

Hello all,

I need to write a java client that would send DIME attachments to a web service (supports only DIME). Can I do it using JAX-WS? Can you send me (point me to) a sample client code?

Thanks a lot,
Vlad

P.S.

Here is an exerpt from a WORKING client stub generated by AXIS and then
modified manually (hilighted) to attach DIME. I wanted to do the same using JAX-WS.

....................................................

public java.lang.String fileUpload(java.lang.String communityGlobalID,
java.lang.String accessToken,
java.lang.String IDXGlobalID,
java.lang.String docTypeGlobalID,
java.lang.String docEditionGlobalID,
boolean fileReadOnlyArchive,
boolean createMFDProfileOnly,
java.lang.String dataInputList,
byte[] file,
String fileContentType) throws
java.rmi.RemoteException,
java.io.IOException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[0]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("http://Athena.csfb.net/Athena/Services/AppAPI.asmx/FileUpload");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS,Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://Athena.csfb.net/Athena/Services/AppAPI.asmx", "FileUpload"));

// Modified code to add dime attachment
DataSource ds = new ByteArrayDataSource(file, fileContentType);
DataHandler dh = new DataHandler(ds);

_call.setProperty(org.apache.axis.client.Call.ATTACHMENT_ENCAPSULATION_FORMAT,
org.apache.axis.client.Call.ATTACHMENT_ENCAPSULATION_FORMAT_DIME);
_call.addAttachmentPart(new org.apache.axis.attachments.AttachmentPart(dh));

setRequestHeaders(_call);
setAttachments(_call);

java.lang.Object _resp = _call.invoke(new java.lang.Object[] {communityGlobalID,
accessToken,
IDXGlobalID,
docTypeGlobalID,
docEditionGlobalID,
new java.lang.Boolean(fileReadOnlyArchive),
new java.lang.Boolean(createMFDProfileOnly),
dataInputList});
..................................

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
oleksiys
Offline
Joined: 2006-01-25

Hi,
IMHO you can ask about that on Metro [1] forum.
WBR.

[1] http://forums.java.net/jive/forum.jspa?forumID=46