Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / February 2005

Tip: Looking for answers? Try searching our database.

how do i get an attachment from axis with dotnet client...

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Elhanan - 02 Feb 2005 20:34 GMT
hi..

i can't figure this out...

i have a small web service in axis 1.1 which returns a file:

import javax.activation.DataHandler;
import javax.activation.FileDataSource;

public class AttachmentHandler {

public DataHandler GetAttachment(String isFileName)
{
String sFileName=isFileName;
DataHandler dh = new DataHandler(new FileDataSource(sFileName));
return dh;
}
}

it works in a java client off course, and on vb6 with soap toolkit 3.0
client.
now i've stumbled upon the "DataHandler being exposed in the wsdl" and
i solved it by simply creating a wsdl from a function in vb with the
same signature as the one in java, (i've used the wizard in the
toolkit) i them compared both wsdl and by trial and error i found out i
needed to switch between apach:DataHandler type in the wsdl with the
UnknownBinaryContent Type (i copied and pasted the whole thing and
created a static wsdl file for the Java web Service so vb client can
consume it.

this works.

problem is, i can't do the same with DOTNET client, if i tell it to
consume the modified wsd file it creates to proxy classes
AttachmentHandlerService
and AttachmentHandlerServiceWSE

if i try to use the first i get an exception in the invoke method
saying:
System.InvalidOperationException: Client found response content type of
'multipart/related; type=\"text/xml\";
start=\"<16D767B35F8E70F81BCBE1E03AF9314A>\";
\tboundary=\"----=_Part_3_8355938.1107376652875\"', but expected
'text/xml'.

if i use AttachmentHandlerServiceWSE i simply get a SystemError
exception
Ritu Kedia - 04 Feb 2005 09:41 GMT
If you are using DIME for attachments then .Net does not  support referencing
attachments as method arguments or return values. So you would have to access
attachments directly from the ResponseSoapContext in your case.  Here is the
.Net code for that:
WebServiceProxy proxy = new WebServiceProxy();
proxy.GetAttachment(isFileName);
if (proxy.ResponseSoapContext.Attachments.Count == 1)
{
      DimeAttachment attachment =
    (DimeAttachment)proxy.ResponseSoapContext.Attachments[0];
}

Note you would need MS WSE 2.0 for DIME Attachment support.

Hope this helps.

-Ritu

> hi..
>
[quoted text clipped - 43 lines]
> if i use AttachmentHandlerServiceWSE i simply get a SystemError
> exception
Elhanan - 04 Feb 2005 11:44 GMT
i sorat figured that out, but how do i configure wsdl of the webservice
so that dotnet could understand it? (automatics wsdl contains
datahandler as return type which  dotnet does not recognize).

don't forget that dotnet builds a proxy automatically from the wsdl and
it didn't do anything regarding the attachment.

> If you are using DIME for attachments then .Net does not  support referencing
> attachments as method arguments or return values. So you would have to access
[quoted text clipped - 61 lines]
> > if i use AttachmentHandlerServiceWSE i simply get a SystemError
> > exception
KC - 17 Feb 2005 21:59 GMT
I have the same problem.... the .NET wsdl.exe doesn't recognize the java date
type DataHandler. Therefore, it failed to generate the client proxy... Have
you find the solition yet?

Thank

> i sorat figured that out, but how do i configure wsdl of the webservice
> so that dotnet could understand it? (automatics wsdl contains
[quoted text clipped - 78 lines]
> > > if i use AttachmentHandlerServiceWSE i simply get a SystemError
> > > exception

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.