all groups > dotnet xml > august 2006 >
You're in the

dotnet xml

group:

Net 2.0 client calling Axis WS -- send document problem


Net 2.0 client calling Axis WS -- send document problem David R
8/31/2006 11:40:02 AM
dotnet xml:
I am calling an Axis web service from a Net 2.0 client. To be helpful, the
developers on the Axis side sent a test client that they created, with
snippets below. What I am trying to do is add a document to a workplan
object, and return the object. I can return the object okay, but do not see
how I can do this with .NET.

I was expecting something like an attachfile method that returns an array of
bytes.

I have the WSE 3.0 installed.



Thanks,

David


private WorkPlanDocumentTO addWorkPlanDocument(Long workPlanId) {

(Axis call.registerTypeMappings )

call.setOperationName("addWorkPlanDocument");
WorkPlanDocumentTO workPlanDocumentTO = createWorkPlanDocument(workPlanId);

call.setProperty(Call.ATTACHMENT_ENCAPSULATION_FORMAT,
Call.ATTACHMENT_ENCAPSULATION_FORMAT_MTOM);
call.addParameter("param", workPlanDocumentTOQN, WorkPlanDocumentTO.class,
ParameterMode.IN);
call.setReturnType(workPlanDocumentTOQN);

attachFiles(workPlanDocumentTO, call);

****
}

And then later on....

private void attachFiles(WorkPlanDocumentTO workPlanDocumentTO, Call call) {

DocumentDescriptor[] docDesc = workPlanDocumentTO.getDocuments();
for(int i = 0; i < docDesc.length; i++)
{
String filePath = "C:\\temp\\" + i + ".doc";
DataHandler dh = new DataHandler(new FileDataSource(filePath));
AttachmentPart attachmentPart = new
org.apache.axis.attachments.AttachmentPart();
attachmentPart.addMimeHeader(DocumentDescriptor.FILE_NAME,
docDesc[i].getDocumentName());
attachmentPart.setDataHandler(dh);
call.addAttachmentPart(attachmentPart);
}



My question is this. All the
RE: Net 2.0 client calling Axis WS -- send document problem David R
8/31/2006 2:31:02 PM
Solved the problem. A simple thing of forgetting that .NET uses properties
to identify properties, while Java uses methods. So the line

DocumentDescriptor[] docDesc = workPlanDocumentTO.getDocuments();

becomes
DocumentDescriptor[] docDesc = workPlanDocumentTO.Documents;



[quoted text, click to view]
AddThis Social Bookmark Button