You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Ephemeris Lappis <ep...@gmail.com> on 2007/04/17 10:19:58 UTC

[Axis2] Attachment on client using generated stub

Hello.

 

I have not found any example of simple client, using the interface code
generated from WSDL, and calling a service stub to send an attachment.

 

The service operation signature is :

 

public TestReport processTestRequest(final TestRequest request, final String
attchmentID) throws TestException

 

Where TestRequest and TestReport are simple javabeans. The service
implementation uses the message context to retrieve the attachment data
handler for the given id :

 

MessageContext messageContext = MessageContext.getCurrentMessageContext();

Attachments attachments = messageContext.getAttachmentMap();

DataHandler dataHandler = attachments.getDataHandler(attchmentID);

 

If I'm not wrong, interpreting what I've seen in samples code, the client
must create the attachment using the message context :

 

FileDataSource dataSource = new FileDataSource(file);

DataHandler dataHandler = new DataHandler(dataSource);

MessageContext messageContext = new MessageContext();

String attachmentID = messageContext.addAttachment(dataHandler);

 

But I've not found any way to take into account the message context except
with a sample code that creates from scratch an OperationClient, etc.

 

What is the better way to do that ?

 

Thanks for your help.

 

--

Ephemeris Lappis

 


Re: [Axis2] Attachment on client using generated stub

Posted by Thilina Gunarathne <cs...@gmail.com>.
> Indeed, my question is how to build a SwA service for old clients (possibly
> not java clients) ?
I'm lost..
Normally web service clients are independent of the service
implementation, other than for interop issues...

Please be more specific on your question...

thanks,
~Thilina
>
> Thanks for your help !
>
> --
> Ephemeris Lappis
>
> > -----Message d'origine-----
> > De: Thilina Gunarathne [mailto:csethil@gmail.com]
> > Envoyé: mercredi 18 avril 2007 11:47
> > À: axis-user@ws.apache.org
> > Objet: Re: [Axis2] Attachment on client using generated stub
> >
> > > This looks like the old Axis1 way to generate code for the attachment,
> > using
> > > the DataHandler.
> > That way you'll be using MTOM/XOP for sending your attachments.. MTOM
> > will be THE attachment mechanism in the future...
> >
> > >But this is not what the Axis2 example shows, using the
> > > MessageContext to puts the attachments with the low level
> > OperationClient
> > > API…
> > Axis2 SOAP with Attachments sample does it using the Operation
> > Client... If you need to use SwA then you have to use the
> > OperationClient...
> >
> > You can have a look at the MTOM Sample to figure out what Valrie has
> > mentioned...
> >
> > Thanks,
> > Thilina
> >
> > PS: MTOM is the first class attachment citizen in Axis2...
> > >
> > >
> > >
> > > I will test with this kind of WSDL… A question : why the XMIME base64
> > binary
> > > type is not already mapped with a java type and must be imported in
> > projects
> > > schemas ?
> > >
> > >
> > >
> > > Thanks for your help…
> > >
> > >
> > >
> > >
> > > --
> > >
> > > Ephemeris Lappis
> > >
> > >
> > >
> > >
> > >  ________________________________
> > >
> > >
> > > De : Masin, Valerie [mailto:VJMasin@docharbor.com]
> > >  Envoyé : mardi 17 avril 2007 19:56
> > >  À : axis-user@ws.apache.org
> > >  Objet : RE: [Axis2] Attachment on client using generated stub
> > >
> > >
> > >
> > >
> > > I'm no expert so I don't know if I am answering your question exactly,
> > but I
> > > send attachments this way.
> > >
> > > In my wsdl I have something like this:
> > >
> > >  <wsdl:types>
> > >    <schema xmlns="http://www.w3.org/2001/XMLSchema" ...>
> > >     <element name="importDocument">
> > >      <complexType>
> > >       <sequence>
> > >        <element name="name" type="xsd:string"/>
> > >        <element name="document" type="xmime:base64Binary"/>
> > >       </sequence>
> > >      </complexType>
> > >     </element>
> > >
> > >   </schema>
> > >   </wsdl:types>
> > >
> > >  <wsdl:message name="importDocumentRequest">
> > >    <wsdl:part name="parameters" element="impl:importDocument"/>
> > >   </wsdl:message>
> > >
> > > which generates this signature:
> > >
> > >         public
> > > com.docharbor.webservices.ImportDocumentResponse
> > > importDocument
> > >          (
> > >            java.lang.String param48,javax.activation.DataHandler param49
> > >           )
> > >
> > >
> > >
> > > So you are working directly with DataHandlers, not with MessageContext
> > >
> > >
> > >
> > > Hope this helps
> > >
> > >
> > >  ________________________________
> > >
> > >
> > > From: Ephemeris Lappis [mailto:ephemeris.lappis@gmail.com]
> > >  Sent: Tuesday, April 17, 2007 4:20 AM
> > >  To: Axis-User
> > >  Subject: [Axis2] Attachment on client using generated stub
> > >
> > > Hello.
> > >
> > >
> > >
> > > I have not found any example of simple client, using the interface code
> > > generated from WSDL, and calling a service stub to send an attachment…
> > >
> > >
> > >
> > > The service operation signature is :
> > >
> > >
> > >
> > > public TestReport processTestRequest(final TestRequest request, final
> > String
> > > attchmentID) throws TestException
> > >
> > >
> > >
> > > Where TestRequest and TestReport are simple javabeans. The service
> > > implementation uses the message context to retrieve the attachment data
> > > handler for the given id :
> > >
> > >
> > >
> > > MessageContext messageContext =
> > MessageContext.getCurrentMessageContext();
> > >
> > > Attachments attachments = messageContext.getAttachmentMap();
> > >
> > > DataHandler dataHandler = attachments.getDataHandler(attchmentID);
> > >
> > >
> > >
> > > If I'm not wrong, interpreting what I've seen in samples code, the
> > client
> > > must create the attachment using the message context :
> > >
> > >
> > >
> > > FileDataSource dataSource = new FileDataSource(file);
> > >
> > > DataHandler dataHandler = new DataHandler(dataSource);
> > >
> > > MessageContext messageContext = new MessageContext();
> > >
> > > String attachmentID = messageContext.addAttachment(dataHandler);
> > >
> > >
> > >
> > > But I've not found any way to take into account the message context
> > except
> > > with a sample code that creates from scratch an OperationClient, etc.
> > >
> > >
> > >
> > > What is the better way to do that ?
> > >
> > >
> > >
> > > Thanks for your help…
> > >
> > >
> > >
> > > --
> > >
> > > Ephemeris Lappis
> > >
> > >
> >
> >
> > --
> > Thilina Gunarathne  -  http://www.wso2.com - http://thilinag.blogspot.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Thilina Gunarathne  -  http://www.wso2.com - http://thilinag.blogspot.com

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


RE: [Axis2] Attachment on client using generated stub

Posted by Ephemeris Lappis <ep...@gmail.com>.
This is effectively the MTOM example that Valerie's code reminded.

I've already personally tested something based on this example, to verify
how the MTOM option changes the SOAP data, passing from a single message to
a multipart format.

But I was also trying to build a simple example that uses SwA following the
SOAP With Attachment example. In this example, with a POJO service, the
client relies on the low level API, and not on generated stubs...

Indeed, my question is how to build a SwA service for old clients (possibly
not java clients) ?

Thanks for your help !

--
Ephemeris Lappis
 
> -----Message d'origine-----
> De : Thilina Gunarathne [mailto:csethil@gmail.com]
> Envoyé : mercredi 18 avril 2007 11:47
> À : axis-user@ws.apache.org
> Objet : Re: [Axis2] Attachment on client using generated stub
> 
> > This looks like the old Axis1 way to generate code for the attachment,
> using
> > the DataHandler.
> That way you'll be using MTOM/XOP for sending your attachments.. MTOM
> will be THE attachment mechanism in the future...
> 
> >But this is not what the Axis2 example shows, using the
> > MessageContext to puts the attachments with the low level
> OperationClient
> > API…
> Axis2 SOAP with Attachments sample does it using the Operation
> Client... If you need to use SwA then you have to use the
> OperationClient...
> 
> You can have a look at the MTOM Sample to figure out what Valrie has
> mentioned...
> 
> Thanks,
> Thilina
> 
> PS: MTOM is the first class attachment citizen in Axis2...
> >
> >
> >
> > I will test with this kind of WSDL… A question : why the XMIME base64
> binary
> > type is not already mapped with a java type and must be imported in
> projects
> > schemas ?
> >
> >
> >
> > Thanks for your help…
> >
> >
> >
> >
> > --
> >
> > Ephemeris Lappis
> >
> >
> >
> >
> >  ________________________________
> >
> >
> > De : Masin, Valerie [mailto:VJMasin@docharbor.com]
> >  Envoyé : mardi 17 avril 2007 19:56
> >  À : axis-user@ws.apache.org
> >  Objet : RE: [Axis2] Attachment on client using generated stub
> >
> >
> >
> >
> > I'm no expert so I don't know if I am answering your question exactly,
> but I
> > send attachments this way.
> >
> > In my wsdl I have something like this:
> >
> >  <wsdl:types>
> >    <schema xmlns="http://www.w3.org/2001/XMLSchema" ...>
> >     <element name="importDocument">
> >      <complexType>
> >       <sequence>
> >        <element name="name" type="xsd:string"/>
> >        <element name="document" type="xmime:base64Binary"/>
> >       </sequence>
> >      </complexType>
> >     </element>
> >
> >   </schema>
> >   </wsdl:types>
> >
> >  <wsdl:message name="importDocumentRequest">
> >    <wsdl:part name="parameters" element="impl:importDocument"/>
> >   </wsdl:message>
> >
> > which generates this signature:
> >
> >         public
> > com.docharbor.webservices.ImportDocumentResponse
> > importDocument
> >          (
> >            java.lang.String param48,javax.activation.DataHandler param49
> >           )
> >
> >
> >
> > So you are working directly with DataHandlers, not with MessageContext
> >
> >
> >
> > Hope this helps
> >
> >
> >  ________________________________
> >
> >
> > From: Ephemeris Lappis [mailto:ephemeris.lappis@gmail.com]
> >  Sent: Tuesday, April 17, 2007 4:20 AM
> >  To: Axis-User
> >  Subject: [Axis2] Attachment on client using generated stub
> >
> > Hello.
> >
> >
> >
> > I have not found any example of simple client, using the interface code
> > generated from WSDL, and calling a service stub to send an attachment…
> >
> >
> >
> > The service operation signature is :
> >
> >
> >
> > public TestReport processTestRequest(final TestRequest request, final
> String
> > attchmentID) throws TestException
> >
> >
> >
> > Where TestRequest and TestReport are simple javabeans. The service
> > implementation uses the message context to retrieve the attachment data
> > handler for the given id :
> >
> >
> >
> > MessageContext messageContext =
> MessageContext.getCurrentMessageContext();
> >
> > Attachments attachments = messageContext.getAttachmentMap();
> >
> > DataHandler dataHandler = attachments.getDataHandler(attchmentID);
> >
> >
> >
> > If I'm not wrong, interpreting what I've seen in samples code, the
> client
> > must create the attachment using the message context :
> >
> >
> >
> > FileDataSource dataSource = new FileDataSource(file);
> >
> > DataHandler dataHandler = new DataHandler(dataSource);
> >
> > MessageContext messageContext = new MessageContext();
> >
> > String attachmentID = messageContext.addAttachment(dataHandler);
> >
> >
> >
> > But I've not found any way to take into account the message context
> except
> > with a sample code that creates from scratch an OperationClient, etc.
> >
> >
> >
> > What is the better way to do that ?
> >
> >
> >
> > Thanks for your help…
> >
> >
> >
> > --
> >
> > Ephemeris Lappis
> >
> >
> 
> 
> --
> Thilina Gunarathne  -  http://www.wso2.com - http://thilinag.blogspot.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: [Axis2] Attachment on client using generated stub

Posted by Thilina Gunarathne <cs...@gmail.com>.
> This looks like the old Axis1 way to generate code for the attachment, using
> the DataHandler.
That way you'll be using MTOM/XOP for sending your attachments.. MTOM
will be THE attachment mechanism in the future...

>But this is not what the Axis2 example shows, using the
> MessageContext to puts the attachments with the low level OperationClient
> API…
Axis2 SOAP with Attachments sample does it using the Operation
Client... If you need to use SwA then you have to use the
OperationClient...

You can have a look at the MTOM Sample to figure out what Valrie has
mentioned...

Thanks,
Thilina

PS: MTOM is the first class attachment citizen in Axis2...
>
>
>
> I will test with this kind of WSDL… A question : why the XMIME base64 binary
> type is not already mapped with a java type and must be imported in projects
> schemas ?
>
>
>
> Thanks for your help…
>
>
>
>
> --
>
> Ephemeris Lappis
>
>
>
>
>  ________________________________
>
>
> De : Masin, Valerie [mailto:VJMasin@docharbor.com]
>  Envoyé : mardi 17 avril 2007 19:56
>  À : axis-user@ws.apache.org
>  Objet : RE: [Axis2] Attachment on client using generated stub
>
>
>
>
> I'm no expert so I don't know if I am answering your question exactly, but I
> send attachments this way.
>
> In my wsdl I have something like this:
>
>  <wsdl:types>
>    <schema xmlns="http://www.w3.org/2001/XMLSchema" ...>
>     <element name="importDocument">
>      <complexType>
>       <sequence>
>        <element name="name" type="xsd:string"/>
>        <element name="document" type="xmime:base64Binary"/>
>       </sequence>
>      </complexType>
>     </element>
>
>   </schema>
>   </wsdl:types>
>
>  <wsdl:message name="importDocumentRequest">
>    <wsdl:part name="parameters" element="impl:importDocument"/>
>   </wsdl:message>
>
> which generates this signature:
>
>         public
> com.docharbor.webservices.ImportDocumentResponse
> importDocument
>          (
>            java.lang.String param48,javax.activation.DataHandler param49
>           )
>
>
>
> So you are working directly with DataHandlers, not with MessageContext
>
>
>
> Hope this helps
>
>
>  ________________________________
>
>
> From: Ephemeris Lappis [mailto:ephemeris.lappis@gmail.com]
>  Sent: Tuesday, April 17, 2007 4:20 AM
>  To: Axis-User
>  Subject: [Axis2] Attachment on client using generated stub
>
> Hello.
>
>
>
> I have not found any example of simple client, using the interface code
> generated from WSDL, and calling a service stub to send an attachment…
>
>
>
> The service operation signature is :
>
>
>
> public TestReport processTestRequest(final TestRequest request, final String
> attchmentID) throws TestException
>
>
>
> Where TestRequest and TestReport are simple javabeans. The service
> implementation uses the message context to retrieve the attachment data
> handler for the given id :
>
>
>
> MessageContext messageContext = MessageContext.getCurrentMessageContext();
>
> Attachments attachments = messageContext.getAttachmentMap();
>
> DataHandler dataHandler = attachments.getDataHandler(attchmentID);
>
>
>
> If I'm not wrong, interpreting what I've seen in samples code, the client
> must create the attachment using the message context :
>
>
>
> FileDataSource dataSource = new FileDataSource(file);
>
> DataHandler dataHandler = new DataHandler(dataSource);
>
> MessageContext messageContext = new MessageContext();
>
> String attachmentID = messageContext.addAttachment(dataHandler);
>
>
>
> But I've not found any way to take into account the message context except
> with a sample code that creates from scratch an OperationClient, etc.
>
>
>
> What is the better way to do that ?
>
>
>
> Thanks for your help…
>
>
>
> --
>
> Ephemeris Lappis
>
>


-- 
Thilina Gunarathne  -  http://www.wso2.com - http://thilinag.blogspot.com

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


RE: [Axis2] Attachment on client using generated stub

Posted by Ephemeris Lappis <ep...@gmail.com>.
Hello.

 

I’ve tried to do things with the MS WSE 3.0. Not so easy when you have no
experience with a technology !!!

 

I’m not sure I’ve followed the right process. I’ve removed my web reference
based on the pure .net 2.0, and generated a new one using the WSE WSEWSDL
tool. But it seems the tool only produces asynchronous calls, and doesn’t
use the right SOAP actions from my WSDL bindings : it uses the name of the
input part of the operation instead of using the given soapAction value…

 

Is this a bug ? I was looking at possible options, but nothing…

 

Well… As my first goal is to build my Axis services or clients, and not .net
applications, I think I will let all that for the future… If someone has
some experience with that, it is welcome !!!

 

Thanks for your help.

 

--

Ephemeris Lappis

 

  _____  

De : Masin, Valerie [mailto:VJMasin@docharbor.com] 
Envoyé : mercredi 18 avril 2007 21:20
À : axis-user@ws.apache.org
Objet : RE: [Axis2] Attachment on client using generated stub

 

Go google. I found this message at this site.

http://forums.java.net/jive/message.jspa?messageID=97298

Yes there is a way to configure MS with MTOM. After installing the add-in
WSE 3.0, you can enable it.

 

  _____  

From: Ephemeris Lappis [mailto:ephemeris.lappis@gmail.com] 
Sent: Wednesday, April 18, 2007 2:51 PM
To: axis-user@ws.apache.org
Subject: RE: [Axis2] Attachment on client using generated stub

That’s what I do for my axis2 java client…

 

I’ve just built a new simple test in c#. It seems the .net 2.0 client
doesn’t support MTOM multipart messages. The same call is done without
problem if I let my Axis2 server using common attachment, but when I
activate the MTOM option, my .net client throws an exception rejecting the
body content type…

 

I have not enough knowledge of .net to say if a mean exists to set MTOM
support… Any help is welcome…

 

Thanks for your help…

--

Ephemeris Lappis

 

  _____  

De : Masin, Valerie [mailto:VJMasin@docharbor.com] 
Envoyé : mercredi 18 avril 2007 20:17
À : axis-user@ws.apache.org
Objet : RE: [Axis2] Attachment on client using generated stub

 

If you can enable MTOM on the client then the arrays get transformed into
mime attachments. With java using Axis2 you enable mtom on the client by
saying:

 
stub._getServiceClient().getOptions().setProperty(Constants.Configuration.EN
ABLE_MTOM, Constants.VALUE_TRUE);

 

I am not sure how/if you can do that with .net.

 

 

  _____  

From: Ephemeris Lappis [mailto:ephemeris.lappis@gmail.com] 
Sent: Wednesday, April 18, 2007 1:24 PM
To: axis-user@ws.apache.org
Subject: RE: [Axis2] Attachment on client using generated stub

It’s ok ! I’ve already seen that the XMIME is defined in the MTOM example.
The question now is why W3 types must be declared and mapped by projects
files, and not in some standard module ?

 

I’ve tested an MTOM example with a .net c-sharp client, and it seems to work
: the Microsoft studio generates mapped classes for the custom types, and
converts the Base64Binary to a structure with an array of byte. This works
but this is not the better way. The application must load the whole data
array before it’s sent in a simple message without attachment, instead of
reading the data when needed, as do the DataHandler, and send them attached.
I’ve just had a look on this problem, but I don’t know if there is a
solution…

 

This mailing list is not the right place for questions about .net web
services, but I’d like to know if the Base64Binary type is actually and
correctly used by other implementations.

 

--

Ephemeris Lappis

 

  _____  

De : Masin, Valerie [mailto:VJMasin@docharbor.com] 
Envoyé : mercredi 18 avril 2007 16:36
À : axis-user@ws.apache.org
Objet : RE: [Axis2] Attachment on client using generated stub

 

I realize that my wsdl showed xmime:base64Binary where presumably xmime is
"http://www.w3.org/2005/05/xmlmime which came from their mtom sample code.
But I mapped xmime to http://www.w3.org/2001/XMLSchema and it works fine.

 

  _____  

From: Ephemeris Lappis [mailto:ephemeris.lappis@gmail.com] 
Sent: Wednesday, April 18, 2007 12:32 AM
To: axis-user@ws.apache.org
Subject: RE: [Axis2] Attachment on client using generated stub

Hello.

 

This looks like the old Axis1 way to generate code for the attachment, using
the DataHandler. But this is not what the Axis2 example shows, using the
MessageContext to puts the attachments with the low level OperationClient
API…

 

I will test with this kind of WSDL… A question : why the XMIME base64 binary
type is not already mapped with a java type and must be imported in projects
schemas ?

 

Thanks for your help…

 

--

Ephemeris Lappis

 

  _____  

De : Masin, Valerie [mailto:VJMasin@docharbor.com] 
Envoyé : mardi 17 avril 2007 19:56
À : axis-user@ws.apache.org
Objet : RE: [Axis2] Attachment on client using generated stub

 

I'm no expert so I don't know if I am answering your question exactly, but I
send attachments this way.

In my wsdl I have something like this:

 <wsdl:types>
  <schema xmlns="http://www.w3.org/2001/XMLSchema" ...>
   <element name="importDocument">
    <complexType>
     <sequence>
      <element name="name" type="xsd:string"/>
      <element name="document" type="xmime:base64Binary"/>
     </sequence>
    </complexType>
   </element>

  </schema>
 </wsdl:types>

 <wsdl:message name="importDocumentRequest">
  <wsdl:part name="parameters" element="impl:importDocument"/>
 </wsdl:message>

which generates this signature:

        public  com.docharbor.webservices.ImportDocumentResponse
importDocument
        (
          java.lang.String param48,javax.activation.DataHandler param49     
         )

 

So you are working directly with DataHandlers, not with MessageContext

 

Hope this helps

 

  _____  

From: Ephemeris Lappis [mailto:ephemeris.lappis@gmail.com] 
Sent: Tuesday, April 17, 2007 4:20 AM
To: Axis-User
Subject: [Axis2] Attachment on client using generated stub

Hello.

 

I have not found any example of simple client, using the interface code
generated from WSDL, and calling a service stub to send an attachment…

 

The service operation signature is :

 

public TestReport processTestRequest(final TestRequest request, final String
attchmentID) throws TestException

 

Where TestRequest and TestReport are simple javabeans. The service
implementation uses the message context to retrieve the attachment data
handler for the given id :

 

MessageContext messageContext = MessageContext.getCurrentMessageContext();

Attachments attachments = messageContext.getAttachmentMap();

DataHandler dataHandler = attachments.getDataHandler(attchmentID);

 

If I’m not wrong, interpreting what I’ve seen in samples code, the client
must create the attachment using the message context :

 

FileDataSource dataSource = new FileDataSource(file);

DataHandler dataHandler = new DataHandler(dataSource);

MessageContext messageContext = new MessageContext();

String attachmentID = messageContext.addAttachment(dataHandler);

 

But I’ve not found any way to take into account the message context except
with a sample code that creates from scratch an OperationClient, etc.

 

What is the better way to do that ?

 

Thanks for your help…

 

--

Ephemeris Lappis

 


RE: [Axis2] Attachment on client using generated stub

Posted by Ephemeris Lappis <ep...@gmail.com>.
Hello again !

 

I’ve just had a look at your link. It’s seems effectively a solution exists…
But I have no idea about what is WSE 3.0 !

I will search more information later, and if I have some positive result,
I’ll give you feedback.

Thanks again.

 

--

Ephemeris Lappis

 

  _____  

De : Masin, Valerie [mailto:VJMasin@docharbor.com] 
Envoyé : mercredi 18 avril 2007 21:20
À : axis-user@ws.apache.org
Objet : RE: [Axis2] Attachment on client using generated stub

 

Go google. I found this message at this site.

http://forums.java.net/jive/message.jspa?messageID=97298

Yes there is a way to configure MS with MTOM. After installing the add-in
WSE 3.0, you can enable it.

 

  _____  

From: Ephemeris Lappis [mailto:ephemeris.lappis@gmail.com] 
Sent: Wednesday, April 18, 2007 2:51 PM
To: axis-user@ws.apache.org
Subject: RE: [Axis2] Attachment on client using generated stub

That’s what I do for my axis2 java client…

 

I’ve just built a new simple test in c#. It seems the .net 2.0 client
doesn’t support MTOM multipart messages. The same call is done without
problem if I let my Axis2 server using common attachment, but when I
activate the MTOM option, my .net client throws an exception rejecting the
body content type…

 

I have not enough knowledge of .net to say if a mean exists to set MTOM
support… Any help is welcome…

 

Thanks for your help…

--

Ephemeris Lappis

 

  _____  

De : Masin, Valerie [mailto:VJMasin@docharbor.com] 
Envoyé : mercredi 18 avril 2007 20:17
À : axis-user@ws.apache.org
Objet : RE: [Axis2] Attachment on client using generated stub

 

If you can enable MTOM on the client then the arrays get transformed into
mime attachments. With java using Axis2 you enable mtom on the client by
saying:

 
stub._getServiceClient().getOptions().setProperty(Constants.Configuration.EN
ABLE_MTOM, Constants.VALUE_TRUE);

 

I am not sure how/if you can do that with .net.

 

 

  _____  

From: Ephemeris Lappis [mailto:ephemeris.lappis@gmail.com] 
Sent: Wednesday, April 18, 2007 1:24 PM
To: axis-user@ws.apache.org
Subject: RE: [Axis2] Attachment on client using generated stub

It’s ok ! I’ve already seen that the XMIME is defined in the MTOM example.
The question now is why W3 types must be declared and mapped by projects
files, and not in some standard module ?

 

I’ve tested an MTOM example with a .net c-sharp client, and it seems to work
: the Microsoft studio generates mapped classes for the custom types, and
converts the Base64Binary to a structure with an array of byte. This works
but this is not the better way. The application must load the whole data
array before it’s sent in a simple message without attachment, instead of
reading the data when needed, as do the DataHandler, and send them attached.
I’ve just had a look on this problem, but I don’t know if there is a
solution…

 

This mailing list is not the right place for questions about .net web
services, but I’d like to know if the Base64Binary type is actually and
correctly used by other implementations.

 

--

Ephemeris Lappis

 

  _____  

De : Masin, Valerie [mailto:VJMasin@docharbor.com] 
Envoyé : mercredi 18 avril 2007 16:36
À : axis-user@ws.apache.org
Objet : RE: [Axis2] Attachment on client using generated stub

 

I realize that my wsdl showed xmime:base64Binary where presumably xmime is
"http://www.w3.org/2005/05/xmlmime which came from their mtom sample code.
But I mapped xmime to http://www.w3.org/2001/XMLSchema and it works fine.

 

  _____  

From: Ephemeris Lappis [mailto:ephemeris.lappis@gmail.com] 
Sent: Wednesday, April 18, 2007 12:32 AM
To: axis-user@ws.apache.org
Subject: RE: [Axis2] Attachment on client using generated stub

Hello.

 

This looks like the old Axis1 way to generate code for the attachment, using
the DataHandler. But this is not what the Axis2 example shows, using the
MessageContext to puts the attachments with the low level OperationClient
API…

 

I will test with this kind of WSDL… A question : why the XMIME base64 binary
type is not already mapped with a java type and must be imported in projects
schemas ?

 

Thanks for your help…

 

--

Ephemeris Lappis

 

  _____  

De : Masin, Valerie [mailto:VJMasin@docharbor.com] 
Envoyé : mardi 17 avril 2007 19:56
À : axis-user@ws.apache.org
Objet : RE: [Axis2] Attachment on client using generated stub

 

I'm no expert so I don't know if I am answering your question exactly, but I
send attachments this way.

In my wsdl I have something like this:

 <wsdl:types>
  <schema xmlns="http://www.w3.org/2001/XMLSchema" ...>
   <element name="importDocument">
    <complexType>
     <sequence>
      <element name="name" type="xsd:string"/>
      <element name="document" type="xmime:base64Binary"/>
     </sequence>
    </complexType>
   </element>

  </schema>
 </wsdl:types>

 <wsdl:message name="importDocumentRequest">
  <wsdl:part name="parameters" element="impl:importDocument"/>
 </wsdl:message>

which generates this signature:

        public  com.docharbor.webservices.ImportDocumentResponse
importDocument
        (
          java.lang.String param48,javax.activation.DataHandler param49     
         )

 

So you are working directly with DataHandlers, not with MessageContext

 

Hope this helps

 

  _____  

From: Ephemeris Lappis [mailto:ephemeris.lappis@gmail.com] 
Sent: Tuesday, April 17, 2007 4:20 AM
To: Axis-User
Subject: [Axis2] Attachment on client using generated stub

Hello.

 

I have not found any example of simple client, using the interface code
generated from WSDL, and calling a service stub to send an attachment…

 

The service operation signature is :

 

public TestReport processTestRequest(final TestRequest request, final String
attchmentID) throws TestException

 

Where TestRequest and TestReport are simple javabeans. The service
implementation uses the message context to retrieve the attachment data
handler for the given id :

 

MessageContext messageContext = MessageContext.getCurrentMessageContext();

Attachments attachments = messageContext.getAttachmentMap();

DataHandler dataHandler = attachments.getDataHandler(attchmentID);

 

If I’m not wrong, interpreting what I’ve seen in samples code, the client
must create the attachment using the message context :

 

FileDataSource dataSource = new FileDataSource(file);

DataHandler dataHandler = new DataHandler(dataSource);

MessageContext messageContext = new MessageContext();

String attachmentID = messageContext.addAttachment(dataHandler);

 

But I’ve not found any way to take into account the message context except
with a sample code that creates from scratch an OperationClient, etc.

 

What is the better way to do that ?

 

Thanks for your help…

 

--

Ephemeris Lappis

 


RE: [Axis2] Attachment on client using generated stub

Posted by "Masin, Valerie" <VJ...@docharbor.com>.
Go google. I found this message at this site.
http://forums.java.net/jive/message.jspa?messageID=97298
Yes there is a way to configure MS with MTOM. After installing the add-in WSE 3.0, you can enable it.



________________________________

From: Ephemeris Lappis [mailto:ephemeris.lappis@gmail.com] 
Sent: Wednesday, April 18, 2007 2:51 PM
To: axis-user@ws.apache.org
Subject: RE: [Axis2] Attachment on client using generated stub



That's what I do for my axis2 java client...

 

I've just built a new simple test in c#. It seems the .net 2.0 client doesn't support MTOM multipart messages. The same call is done without problem if I let my Axis2 server using common attachment, but when I activate the MTOM option, my .net client throws an exception rejecting the body content type...

 

I have not enough knowledge of .net to say if a mean exists to set MTOM support... Any help is welcome...

 

Thanks for your help...

--

Ephemeris Lappis

 

________________________________

De : Masin, Valerie [mailto:VJMasin@docharbor.com] 
Envoyé : mercredi 18 avril 2007 20:17
À : axis-user@ws.apache.org
Objet : RE: [Axis2] Attachment on client using generated stub

 

If you can enable MTOM on the client then the arrays get transformed into mime attachments. With java using Axis2 you enable mtom on the client by saying:

    stub._getServiceClient().getOptions().setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);

 

I am not sure how/if you can do that with .net.

 

 

________________________________

From: Ephemeris Lappis [mailto:ephemeris.lappis@gmail.com] 
Sent: Wednesday, April 18, 2007 1:24 PM
To: axis-user@ws.apache.org
Subject: RE: [Axis2] Attachment on client using generated stub

It's ok ! I've already seen that the XMIME is defined in the MTOM example. The question now is why W3 types must be declared and mapped by projects files, and not in some standard module ?

 

I've tested an MTOM example with a .net c-sharp client, and it seems to work : the Microsoft studio generates mapped classes for the custom types, and converts the Base64Binary to a structure with an array of byte. This works but this is not the better way. The application must load the whole data array before it's sent in a simple message without attachment, instead of reading the data when needed, as do the DataHandler, and send them attached. I've just had a look on this problem, but I don't know if there is a solution...

 

This mailing list is not the right place for questions about .net web services, but I'd like to know if the Base64Binary type is actually and correctly used by other implementations.

 

--

Ephemeris Lappis

 

________________________________

De : Masin, Valerie [mailto:VJMasin@docharbor.com] 
Envoyé : mercredi 18 avril 2007 16:36
À : axis-user@ws.apache.org
Objet : RE: [Axis2] Attachment on client using generated stub

 

I realize that my wsdl showed xmime:base64Binary where presumably xmime is "http://www.w3.org/2005/05/xmlmime which came from their mtom sample code. But I mapped xmime to http://www.w3.org/2001/XMLSchema and it works fine.

 

________________________________

From: Ephemeris Lappis [mailto:ephemeris.lappis@gmail.com] 
Sent: Wednesday, April 18, 2007 12:32 AM
To: axis-user@ws.apache.org
Subject: RE: [Axis2] Attachment on client using generated stub

Hello.

 

This looks like the old Axis1 way to generate code for the attachment, using the DataHandler. But this is not what the Axis2 example shows, using the MessageContext to puts the attachments with the low level OperationClient API...

 

I will test with this kind of WSDL... A question : why the XMIME base64 binary type is not already mapped with a java type and must be imported in projects schemas ?

 

Thanks for your help...

 

--

Ephemeris Lappis

 

________________________________

De : Masin, Valerie [mailto:VJMasin@docharbor.com] 
Envoyé : mardi 17 avril 2007 19:56
À : axis-user@ws.apache.org
Objet : RE: [Axis2] Attachment on client using generated stub

 

I'm no expert so I don't know if I am answering your question exactly, but I send attachments this way.

In my wsdl I have something like this:

 <wsdl:types>
  <schema xmlns="http://www.w3.org/2001/XMLSchema" ...>
   <element name="importDocument">
    <complexType>
     <sequence>
      <element name="name" type="xsd:string"/>
      <element name="document" type="xmime:base64Binary"/>
     </sequence>
    </complexType>
   </element>

  </schema>
 </wsdl:types>

 <wsdl:message name="importDocumentRequest">
  <wsdl:part name="parameters" element="impl:importDocument"/>
 </wsdl:message>

which generates this signature:

        public  com.docharbor.webservices.ImportDocumentResponse importDocument
        (
          java.lang.String param48,javax.activation.DataHandler param49     
         )

 

So you are working directly with DataHandlers, not with MessageContext

 

Hope this helps

 

________________________________

From: Ephemeris Lappis [mailto:ephemeris.lappis@gmail.com] 
Sent: Tuesday, April 17, 2007 4:20 AM
To: Axis-User
Subject: [Axis2] Attachment on client using generated stub

Hello.

 

I have not found any example of simple client, using the interface code generated from WSDL, and calling a service stub to send an attachment...

 

The service operation signature is :

 

public TestReport processTestRequest(final TestRequest request, final String attchmentID) throws TestException

 

Where TestRequest and TestReport are simple javabeans. The service implementation uses the message context to retrieve the attachment data handler for the given id :

 

MessageContext messageContext = MessageContext.getCurrentMessageContext();

Attachments attachments = messageContext.getAttachmentMap();

DataHandler dataHandler = attachments.getDataHandler(attchmentID);

 

If I'm not wrong, interpreting what I've seen in samples code, the client must create the attachment using the message context :

 

FileDataSource dataSource = new FileDataSource(file);

DataHandler dataHandler = new DataHandler(dataSource);

MessageContext messageContext = new MessageContext();

String attachmentID = messageContext.addAttachment(dataHandler);

 

But I've not found any way to take into account the message context except with a sample code that creates from scratch an OperationClient, etc.

 

What is the better way to do that ?

 

Thanks for your help...

 

--

Ephemeris Lappis

 


RE: [Axis2] Attachment on client using generated stub

Posted by Ephemeris Lappis <ep...@gmail.com>.
That’s what I do for my axis2 java client…

 

I’ve just built a new simple test in c#. It seems the .net 2.0 client
doesn’t support MTOM multipart messages. The same call is done without
problem if I let my Axis2 server using common attachment, but when I
activate the MTOM option, my .net client throws an exception rejecting the
body content type…

 

I have not enough knowledge of .net to say if a mean exists to set MTOM
support… Any help is welcome…

 

Thanks for your help…

--

Ephemeris Lappis

 

  _____  

De : Masin, Valerie [mailto:VJMasin@docharbor.com] 
Envoyé : mercredi 18 avril 2007 20:17
À : axis-user@ws.apache.org
Objet : RE: [Axis2] Attachment on client using generated stub

 

If you can enable MTOM on the client then the arrays get transformed into
mime attachments. With java using Axis2 you enable mtom on the client by
saying:

 
stub._getServiceClient().getOptions().setProperty(Constants.Configuration.EN
ABLE_MTOM, Constants.VALUE_TRUE);

 

I am not sure how/if you can do that with .net.

 

 

  _____  

From: Ephemeris Lappis [mailto:ephemeris.lappis@gmail.com] 
Sent: Wednesday, April 18, 2007 1:24 PM
To: axis-user@ws.apache.org
Subject: RE: [Axis2] Attachment on client using generated stub

It’s ok ! I’ve already seen that the XMIME is defined in the MTOM example.
The question now is why W3 types must be declared and mapped by projects
files, and not in some standard module ?

 

I’ve tested an MTOM example with a .net c-sharp client, and it seems to work
: the Microsoft studio generates mapped classes for the custom types, and
converts the Base64Binary to a structure with an array of byte. This works
but this is not the better way. The application must load the whole data
array before it’s sent in a simple message without attachment, instead of
reading the data when needed, as do the DataHandler, and send them attached.
I’ve just had a look on this problem, but I don’t know if there is a
solution…

 

This mailing list is not the right place for questions about .net web
services, but I’d like to know if the Base64Binary type is actually and
correctly used by other implementations.

 

--

Ephemeris Lappis

 

  _____  

De : Masin, Valerie [mailto:VJMasin@docharbor.com] 
Envoyé : mercredi 18 avril 2007 16:36
À : axis-user@ws.apache.org
Objet : RE: [Axis2] Attachment on client using generated stub

 

I realize that my wsdl showed xmime:base64Binary where presumably xmime is
"http://www.w3.org/2005/05/xmlmime which came from their mtom sample code.
But I mapped xmime to http://www.w3.org/2001/XMLSchema and it works fine.

 

  _____  

From: Ephemeris Lappis [mailto:ephemeris.lappis@gmail.com] 
Sent: Wednesday, April 18, 2007 12:32 AM
To: axis-user@ws.apache.org
Subject: RE: [Axis2] Attachment on client using generated stub

Hello.

 

This looks like the old Axis1 way to generate code for the attachment, using
the DataHandler. But this is not what the Axis2 example shows, using the
MessageContext to puts the attachments with the low level OperationClient
API…

 

I will test with this kind of WSDL… A question : why the XMIME base64 binary
type is not already mapped with a java type and must be imported in projects
schemas ?

 

Thanks for your help…

 

--

Ephemeris Lappis

 

  _____  

De : Masin, Valerie [mailto:VJMasin@docharbor.com] 
Envoyé : mardi 17 avril 2007 19:56
À : axis-user@ws.apache.org
Objet : RE: [Axis2] Attachment on client using generated stub

 

I'm no expert so I don't know if I am answering your question exactly, but I
send attachments this way.

In my wsdl I have something like this:

 <wsdl:types>
  <schema xmlns="http://www.w3.org/2001/XMLSchema" ...>
   <element name="importDocument">
    <complexType>
     <sequence>
      <element name="name" type="xsd:string"/>
      <element name="document" type="xmime:base64Binary"/>
     </sequence>
    </complexType>
   </element>

  </schema>
 </wsdl:types>

 <wsdl:message name="importDocumentRequest">
  <wsdl:part name="parameters" element="impl:importDocument"/>
 </wsdl:message>

which generates this signature:

        public  com.docharbor.webservices.ImportDocumentResponse
importDocument
        (
          java.lang.String param48,javax.activation.DataHandler param49     
         )

 

So you are working directly with DataHandlers, not with MessageContext

 

Hope this helps

 

  _____  

From: Ephemeris Lappis [mailto:ephemeris.lappis@gmail.com] 
Sent: Tuesday, April 17, 2007 4:20 AM
To: Axis-User
Subject: [Axis2] Attachment on client using generated stub

Hello.

 

I have not found any example of simple client, using the interface code
generated from WSDL, and calling a service stub to send an attachment…

 

The service operation signature is :

 

public TestReport processTestRequest(final TestRequest request, final String
attchmentID) throws TestException

 

Where TestRequest and TestReport are simple javabeans. The service
implementation uses the message context to retrieve the attachment data
handler for the given id :

 

MessageContext messageContext = MessageContext.getCurrentMessageContext();

Attachments attachments = messageContext.getAttachmentMap();

DataHandler dataHandler = attachments.getDataHandler(attchmentID);

 

If I’m not wrong, interpreting what I’ve seen in samples code, the client
must create the attachment using the message context :

 

FileDataSource dataSource = new FileDataSource(file);

DataHandler dataHandler = new DataHandler(dataSource);

MessageContext messageContext = new MessageContext();

String attachmentID = messageContext.addAttachment(dataHandler);

 

But I’ve not found any way to take into account the message context except
with a sample code that creates from scratch an OperationClient, etc.

 

What is the better way to do that ?

 

Thanks for your help…

 

--

Ephemeris Lappis

 


RE: [Axis2] Attachment on client using generated stub

Posted by "Masin, Valerie" <VJ...@docharbor.com>.
If you can enable MTOM on the client then the arrays get transformed into mime attachments. With java using Axis2 you enable mtom on the client by saying:
    stub._getServiceClient().getOptions().setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
 
I am not sure how/if you can do that with .net.


________________________________

From: Ephemeris Lappis [mailto:ephemeris.lappis@gmail.com] 
Sent: Wednesday, April 18, 2007 1:24 PM
To: axis-user@ws.apache.org
Subject: RE: [Axis2] Attachment on client using generated stub



It's ok ! I've already seen that the XMIME is defined in the MTOM example. The question now is why W3 types must be declared and mapped by projects files, and not in some standard module ?

 

I've tested an MTOM example with a .net c-sharp client, and it seems to work : the Microsoft studio generates mapped classes for the custom types, and converts the Base64Binary to a structure with an array of byte. This works but this is not the better way. The application must load the whole data array before it's sent in a simple message without attachment, instead of reading the data when needed, as do the DataHandler, and send them attached. I've just had a look on this problem, but I don't know if there is a solution...

 

This mailing list is not the right place for questions about .net web services, but I'd like to know if the Base64Binary type is actually and correctly used by other implementations.

 

--

Ephemeris Lappis

 

________________________________

De : Masin, Valerie [mailto:VJMasin@docharbor.com] 
Envoyé : mercredi 18 avril 2007 16:36
À : axis-user@ws.apache.org
Objet : RE: [Axis2] Attachment on client using generated stub

 

I realize that my wsdl showed xmime:base64Binary where presumably xmime is "http://www.w3.org/2005/05/xmlmime which came from their mtom sample code. But I mapped xmime to http://www.w3.org/2001/XMLSchema and it works fine.

 

________________________________

From: Ephemeris Lappis [mailto:ephemeris.lappis@gmail.com] 
Sent: Wednesday, April 18, 2007 12:32 AM
To: axis-user@ws.apache.org
Subject: RE: [Axis2] Attachment on client using generated stub

Hello.

 

This looks like the old Axis1 way to generate code for the attachment, using the DataHandler. But this is not what the Axis2 example shows, using the MessageContext to puts the attachments with the low level OperationClient API...

 

I will test with this kind of WSDL... A question : why the XMIME base64 binary type is not already mapped with a java type and must be imported in projects schemas ?

 

Thanks for your help...

 

--

Ephemeris Lappis

 

________________________________

De : Masin, Valerie [mailto:VJMasin@docharbor.com] 
Envoyé : mardi 17 avril 2007 19:56
À : axis-user@ws.apache.org
Objet : RE: [Axis2] Attachment on client using generated stub

 

I'm no expert so I don't know if I am answering your question exactly, but I send attachments this way.

In my wsdl I have something like this:

 <wsdl:types>
  <schema xmlns="http://www.w3.org/2001/XMLSchema" ...>
   <element name="importDocument">
    <complexType>
     <sequence>
      <element name="name" type="xsd:string"/>
      <element name="document" type="xmime:base64Binary"/>
     </sequence>
    </complexType>
   </element>

  </schema>
 </wsdl:types>

 <wsdl:message name="importDocumentRequest">
  <wsdl:part name="parameters" element="impl:importDocument"/>
 </wsdl:message>

which generates this signature:

        public  com.docharbor.webservices.ImportDocumentResponse importDocument
        (
          java.lang.String param48,javax.activation.DataHandler param49     
         )

 

So you are working directly with DataHandlers, not with MessageContext

 

Hope this helps

 

________________________________

From: Ephemeris Lappis [mailto:ephemeris.lappis@gmail.com] 
Sent: Tuesday, April 17, 2007 4:20 AM
To: Axis-User
Subject: [Axis2] Attachment on client using generated stub

Hello.

 

I have not found any example of simple client, using the interface code generated from WSDL, and calling a service stub to send an attachment...

 

The service operation signature is :

 

public TestReport processTestRequest(final TestRequest request, final String attchmentID) throws TestException

 

Where TestRequest and TestReport are simple javabeans. The service implementation uses the message context to retrieve the attachment data handler for the given id :

 

MessageContext messageContext = MessageContext.getCurrentMessageContext();

Attachments attachments = messageContext.getAttachmentMap();

DataHandler dataHandler = attachments.getDataHandler(attchmentID);

 

If I'm not wrong, interpreting what I've seen in samples code, the client must create the attachment using the message context :

 

FileDataSource dataSource = new FileDataSource(file);

DataHandler dataHandler = new DataHandler(dataSource);

MessageContext messageContext = new MessageContext();

String attachmentID = messageContext.addAttachment(dataHandler);

 

But I've not found any way to take into account the message context except with a sample code that creates from scratch an OperationClient, etc.

 

What is the better way to do that ?

 

Thanks for your help...

 

--

Ephemeris Lappis

 


RE: [Axis2] Attachment on client using generated stub

Posted by Ephemeris Lappis <ep...@gmail.com>.
It’s ok ! I’ve already seen that the XMIME is defined in the MTOM example.
The question now is why W3 types must be declared and mapped by projects
files, and not in some standard module ?

 

I’ve tested an MTOM example with a .net c-sharp client, and it seems to work
: the Microsoft studio generates mapped classes for the custom types, and
converts the Base64Binary to a structure with an array of byte. This works
but this is not the better way. The application must load the whole data
array before it’s sent in a simple message without attachment, instead of
reading the data when needed, as do the DataHandler, and send them attached.
I’ve just had a look on this problem, but I don’t know if there is a
solution…

 

This mailing list is not the right place for questions about .net web
services, but I’d like to know if the Base64Binary type is actually and
correctly used by other implementations.

 

--

Ephemeris Lappis

 

  _____  

De : Masin, Valerie [mailto:VJMasin@docharbor.com] 
Envoyé : mercredi 18 avril 2007 16:36
À : axis-user@ws.apache.org
Objet : RE: [Axis2] Attachment on client using generated stub

 

I realize that my wsdl showed xmime:base64Binary where presumably xmime is
"http://www.w3.org/2005/05/xmlmime which came from their mtom sample code.
But I mapped xmime to http://www.w3.org/2001/XMLSchema and it works fine.

 

  _____  

From: Ephemeris Lappis [mailto:ephemeris.lappis@gmail.com] 
Sent: Wednesday, April 18, 2007 12:32 AM
To: axis-user@ws.apache.org
Subject: RE: [Axis2] Attachment on client using generated stub

Hello.

 

This looks like the old Axis1 way to generate code for the attachment, using
the DataHandler. But this is not what the Axis2 example shows, using the
MessageContext to puts the attachments with the low level OperationClient
API…

 

I will test with this kind of WSDL… A question : why the XMIME base64 binary
type is not already mapped with a java type and must be imported in projects
schemas ?

 

Thanks for your help…

 

--

Ephemeris Lappis

 

  _____  

De : Masin, Valerie [mailto:VJMasin@docharbor.com] 
Envoyé : mardi 17 avril 2007 19:56
À : axis-user@ws.apache.org
Objet : RE: [Axis2] Attachment on client using generated stub

 

I'm no expert so I don't know if I am answering your question exactly, but I
send attachments this way.

In my wsdl I have something like this:

 <wsdl:types>
  <schema xmlns="http://www.w3.org/2001/XMLSchema" ...>
   <element name="importDocument">
    <complexType>
     <sequence>
      <element name="name" type="xsd:string"/>
      <element name="document" type="xmime:base64Binary"/>
     </sequence>
    </complexType>
   </element>

  </schema>
 </wsdl:types>

 <wsdl:message name="importDocumentRequest">
  <wsdl:part name="parameters" element="impl:importDocument"/>
 </wsdl:message>

which generates this signature:

        public  com.docharbor.webservices.ImportDocumentResponse
importDocument
        (
          java.lang.String param48,javax.activation.DataHandler param49     
         )

 

So you are working directly with DataHandlers, not with MessageContext

 

Hope this helps

 

  _____  

From: Ephemeris Lappis [mailto:ephemeris.lappis@gmail.com] 
Sent: Tuesday, April 17, 2007 4:20 AM
To: Axis-User
Subject: [Axis2] Attachment on client using generated stub

Hello.

 

I have not found any example of simple client, using the interface code
generated from WSDL, and calling a service stub to send an attachment…

 

The service operation signature is :

 

public TestReport processTestRequest(final TestRequest request, final String
attchmentID) throws TestException

 

Where TestRequest and TestReport are simple javabeans. The service
implementation uses the message context to retrieve the attachment data
handler for the given id :

 

MessageContext messageContext = MessageContext.getCurrentMessageContext();

Attachments attachments = messageContext.getAttachmentMap();

DataHandler dataHandler = attachments.getDataHandler(attchmentID);

 

If I’m not wrong, interpreting what I’ve seen in samples code, the client
must create the attachment using the message context :

 

FileDataSource dataSource = new FileDataSource(file);

DataHandler dataHandler = new DataHandler(dataSource);

MessageContext messageContext = new MessageContext();

String attachmentID = messageContext.addAttachment(dataHandler);

 

But I’ve not found any way to take into account the message context except
with a sample code that creates from scratch an OperationClient, etc.

 

What is the better way to do that ?

 

Thanks for your help…

 

--

Ephemeris Lappis

 


RE: [Axis2] Attachment on client using generated stub

Posted by "Masin, Valerie" <VJ...@docharbor.com>.
I realize that my wsdl showed xmime:base64Binary where presumably xmime is "http://www.w3.org/2005/05/xmlmime which came from their mtom sample code. But I mapped xmime to http://www.w3.org/2001/XMLSchema and it works fine.

________________________________

From: Ephemeris Lappis [mailto:ephemeris.lappis@gmail.com] 
Sent: Wednesday, April 18, 2007 12:32 AM
To: axis-user@ws.apache.org
Subject: RE: [Axis2] Attachment on client using generated stub



Hello.

 

This looks like the old Axis1 way to generate code for the attachment, using the DataHandler. But this is not what the Axis2 example shows, using the MessageContext to puts the attachments with the low level OperationClient API...

 

I will test with this kind of WSDL... A question : why the XMIME base64 binary type is not already mapped with a java type and must be imported in projects schemas ?

 

Thanks for your help...

 

--

Ephemeris Lappis

 

________________________________

De : Masin, Valerie [mailto:VJMasin@docharbor.com] 
Envoyé : mardi 17 avril 2007 19:56
À : axis-user@ws.apache.org
Objet : RE: [Axis2] Attachment on client using generated stub

 

I'm no expert so I don't know if I am answering your question exactly, but I send attachments this way.

In my wsdl I have something like this:

 <wsdl:types>
  <schema xmlns="http://www.w3.org/2001/XMLSchema" ...>
   <element name="importDocument">
    <complexType>
     <sequence>
      <element name="name" type="xsd:string"/>
      <element name="document" type="xmime:base64Binary"/>
     </sequence>
    </complexType>
   </element>

  </schema>
 </wsdl:types>

 <wsdl:message name="importDocumentRequest">
  <wsdl:part name="parameters" element="impl:importDocument"/>
 </wsdl:message>

which generates this signature:

        public  com.docharbor.webservices.ImportDocumentResponse importDocument
        (
          java.lang.String param48,javax.activation.DataHandler param49     
         )

 

So you are working directly with DataHandlers, not with MessageContext

 

Hope this helps

 

________________________________

From: Ephemeris Lappis [mailto:ephemeris.lappis@gmail.com] 
Sent: Tuesday, April 17, 2007 4:20 AM
To: Axis-User
Subject: [Axis2] Attachment on client using generated stub

Hello.

 

I have not found any example of simple client, using the interface code generated from WSDL, and calling a service stub to send an attachment...

 

The service operation signature is :

 

public TestReport processTestRequest(final TestRequest request, final String attchmentID) throws TestException

 

Where TestRequest and TestReport are simple javabeans. The service implementation uses the message context to retrieve the attachment data handler for the given id :

 

MessageContext messageContext = MessageContext.getCurrentMessageContext();

Attachments attachments = messageContext.getAttachmentMap();

DataHandler dataHandler = attachments.getDataHandler(attchmentID);

 

If I'm not wrong, interpreting what I've seen in samples code, the client must create the attachment using the message context :

 

FileDataSource dataSource = new FileDataSource(file);

DataHandler dataHandler = new DataHandler(dataSource);

MessageContext messageContext = new MessageContext();

String attachmentID = messageContext.addAttachment(dataHandler);

 

But I've not found any way to take into account the message context except with a sample code that creates from scratch an OperationClient, etc.

 

What is the better way to do that ?

 

Thanks for your help...

 

--

Ephemeris Lappis

 


RE: [Axis2] Attachment on client using generated stub

Posted by Ephemeris Lappis <ep...@gmail.com>.
Hello.

 

This looks like the old Axis1 way to generate code for the attachment, using
the DataHandler. But this is not what the Axis2 example shows, using the
MessageContext to puts the attachments with the low level OperationClient
API…

 

I will test with this kind of WSDL… A question : why the XMIME base64 binary
type is not already mapped with a java type and must be imported in projects
schemas ?

 

Thanks for your help…

 

--

Ephemeris Lappis

 

  _____  

De : Masin, Valerie [mailto:VJMasin@docharbor.com] 
Envoyé : mardi 17 avril 2007 19:56
À : axis-user@ws.apache.org
Objet : RE: [Axis2] Attachment on client using generated stub

 

I'm no expert so I don't know if I am answering your question exactly, but I
send attachments this way.

In my wsdl I have something like this:

 <wsdl:types>
  <schema xmlns="http://www.w3.org/2001/XMLSchema" ...>
   <element name="importDocument">
    <complexType>
     <sequence>
      <element name="name" type="xsd:string"/>
      <element name="document" type="xmime:base64Binary"/>
     </sequence>
    </complexType>
   </element>

  </schema>
 </wsdl:types>

 <wsdl:message name="importDocumentRequest">
  <wsdl:part name="parameters" element="impl:importDocument"/>
 </wsdl:message>

which generates this signature:

        public  com.docharbor.webservices.ImportDocumentResponse
importDocument
        (
          java.lang.String param48,javax.activation.DataHandler param49     
         )

 

So you are working directly with DataHandlers, not with MessageContext

 

Hope this helps

 

  _____  

From: Ephemeris Lappis [mailto:ephemeris.lappis@gmail.com] 
Sent: Tuesday, April 17, 2007 4:20 AM
To: Axis-User
Subject: [Axis2] Attachment on client using generated stub

Hello.

 

I have not found any example of simple client, using the interface code
generated from WSDL, and calling a service stub to send an attachment…

 

The service operation signature is :

 

public TestReport processTestRequest(final TestRequest request, final String
attchmentID) throws TestException

 

Where TestRequest and TestReport are simple javabeans. The service
implementation uses the message context to retrieve the attachment data
handler for the given id :

 

MessageContext messageContext = MessageContext.getCurrentMessageContext();

Attachments attachments = messageContext.getAttachmentMap();

DataHandler dataHandler = attachments.getDataHandler(attchmentID);

 

If I’m not wrong, interpreting what I’ve seen in samples code, the client
must create the attachment using the message context :

 

FileDataSource dataSource = new FileDataSource(file);

DataHandler dataHandler = new DataHandler(dataSource);

MessageContext messageContext = new MessageContext();

String attachmentID = messageContext.addAttachment(dataHandler);

 

But I’ve not found any way to take into account the message context except
with a sample code that creates from scratch an OperationClient, etc.

 

What is the better way to do that ?

 

Thanks for your help…

 

--

Ephemeris Lappis

 


RE: [Axis2] Attachment on client using generated stub

Posted by "Masin, Valerie" <VJ...@docharbor.com>.
I'm no expert so I don't know if I am answering your question exactly,
but I send attachments this way.
In my wsdl I have something like this:
 <wsdl:types>
  <schema xmlns="http://www.w3.org/2001/XMLSchema" ...>
   <element name="importDocument">
    <complexType>
     <sequence>
      <element name="name" type="xsd:string"/>
      <element name="document" type="xmime:base64Binary"/>
     </sequence>
    </complexType>
   </element>
  </schema>
 </wsdl:types>

 <wsdl:message name="importDocumentRequest">
  <wsdl:part name="parameters" element="impl:importDocument"/>
 </wsdl:message>

which generates this signature:
        public  com.docharbor.webservices.ImportDocumentResponse
importDocument
        (
          java.lang.String param48,javax.activation.DataHandler param49

         )

 
So you are working directly with DataHandlers, not with MessageContext
 
Hope this helps
 
________________________________

From: Ephemeris Lappis [mailto:ephemeris.lappis@gmail.com] 
Sent: Tuesday, April 17, 2007 4:20 AM
To: Axis-User
Subject: [Axis2] Attachment on client using generated stub



Hello.

 

I have not found any example of simple client, using the interface code
generated from WSDL, and calling a service stub to send an attachment...

 

The service operation signature is :

 

public TestReport processTestRequest(final TestRequest request, final
String attchmentID) throws TestException

 

Where TestRequest and TestReport are simple javabeans. The service
implementation uses the message context to retrieve the attachment data
handler for the given id :

 

MessageContext messageContext =
MessageContext.getCurrentMessageContext();

Attachments attachments = messageContext.getAttachmentMap();

DataHandler dataHandler = attachments.getDataHandler(attchmentID);

 

If I'm not wrong, interpreting what I've seen in samples code, the
client must create the attachment using the message context :

 

FileDataSource dataSource = new FileDataSource(file);

DataHandler dataHandler = new DataHandler(dataSource);

MessageContext messageContext = new MessageContext();

String attachmentID = messageContext.addAttachment(dataHandler);

 

But I've not found any way to take into account the message context
except with a sample code that creates from scratch an OperationClient,
etc.

 

What is the better way to do that ?

 

Thanks for your help...

 

--

Ephemeris Lappis