You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Eliú <lo...@gmail.com> on 2008/02/22 21:19:01 UTC

MTOM attachments question

Hi, i'm new with CXF and i'm trying to use MTOM attachments in my web
services.
I followed the Apache CXF 2.0 User's Guide and right now i can get a binary
file from the server to my client using MTOM attachments.
My problem is that i cannot send a file from the client to the server using
MTOM. When I pass my JAXB class or the DataHandler
as a parameter to the Web Service, it always goes base64Binary encoded in
the request SOAP message.
In the server side, i have this endpoint declaration:

*<jaxws:endpoint id="FileTransferWebService"
    implementor="
com.iafis.sici.server.webServiceImpl.FileTransferWebServiceImpl"
    address="/FileTransferWebService">
    <jaxws:properties>
      <entry key="mtom-enabled" value="true"/>
    </jaxws:properties>
</jaxws:endpoint>*

and this is my JAXB bean:

*@XmlType
public class BinaryFile {

    /**
     * Contenido binario del archivo.
     */
    @XmlMimeType("application/octet-stream")
    private DataHandler imageData;

    /**
     * @return el valor de imageData como InputStream
     * @throws IOException en caso de error al obtener el
     * InputStream a partir del DataHandler
     */
    public InputStream getInputStream() throws IOException {
        return imageData.getInputStream();
    }

    /**
     * @param imageData el valor de imageData a establecer
     */
    public void setImageData(DataHandler imageData) {
        this.imageData = imageData;
    }
}*

When i call this service:

*BinaryFile getOperationCodesFile(String filePath);*

the file comes in the response SOAP as MTOM attachment, but when i call this
other:

*void updateOpCodesFileOnServer(BinaryFile file, Date updateDate);*

the file goes in the request message inside the Envelope of the SOAP message
encoded as a base64Binary.
I need to know if i can send the file to the server as a MTOM attachment
with CXF and annotations for JAXB beans.
Thanks in advance.

P.D.: I'm not a member of this mailing list, so i'll thank you if you copy
your replay to this address. Thanks.

Re: MTOM attachments question

Posted by Benson Margulies <bi...@gmail.com>.
I'm sorry, my head was on sideways. I was confusing the WSDL extension with
the xmime stuff (xmime:base64Binary) that goes on the wire.

On Sat, Feb 23, 2008 at 2:48 PM, Glen Mazza <gl...@verizon.net> wrote:

> Really?  Our MTOM docs mention the expectedContentType attribution in
> multiple places: http://cwiki.apache.org/CXF20DOC/mtom.html.  I wonder
> if CXF could pass the TCK if it actually ignored it.
>
> Glen
>
> Am Samstag, den 23.02.2008, 12:33 -0500 schrieb Benson Margulies:
> > 2.0.4 doesn't know anything about xmime:expectedContentType, AFAIK. Do
> you
> > have the @MTOM annotation in place to enable the threshold?
> >
> > On Fri, Feb 22, 2008 at 8:01 PM, Glen Mazza <gl...@verizon.net>
> wrote:
> >
> > > Some possibilities:
> > >
> > > 1.) From Step #5 of [1], make sure you have xmime:expectedContentTypes
> > > declared in your WSDL (you can see me using it under <element
> > > name="getWeatherForecastResponse" at the top).
> > >
> > > 2.) From Step #6 of [1], make sure you use @BindingType annotation
> just
> > > before your web service implementation.
> > >
> > > 3.)  Also, your address in your cxf.xml ("/FileTransferWebService")
> may
> > > need to be a full URL as shown in our sample here[2].
> > >
> > > HTH,
> > > Glen
> > >
> > >
> > > [1] http://www.jroller.com/gmazza/date/20071102
> > > [2]
> > >
> http://cwiki.apache.org/confluence/display/CXF20DOC/MTOM#MTOM-ConfigFile
> > >
> > >
> > > Am Freitag, den 22.02.2008, 21:19 +0100 schrieb Eliú:
> > > > Hi, i'm new with CXF and i'm trying to use MTOM attachments in my
> web
> > > > services.
> > > > I followed the Apache CXF 2.0 User's Guide and right now i can get a
> > > binary
> > > > file from the server to my client using MTOM attachments.
> > > > My problem is that i cannot send a file from the client to the
> server
> > > using
> > > > MTOM. When I pass my JAXB class or the DataHandler
> > > > as a parameter to the Web Service, it always goes base64Binary
> encoded
> > > in
> > > > the request SOAP message.
> > > > In the server side, i have this endpoint declaration:
> > > >
> > > > *<jaxws:endpoint id="FileTransferWebService"
> > > >     implementor="
> > > > com.iafis.sici.server.webServiceImpl.FileTransferWebServiceImpl"
> > > >     address="/FileTransferWebService">
> > > >     <jaxws:properties>
> > > >       <entry key="mtom-enabled" value="true"/>
> > > >     </jaxws:properties>
> > > > </jaxws:endpoint>*
> > > >
> > > > and this is my JAXB bean:
> > > >
> > > > *@XmlType
> > > > public class BinaryFile {
> > > >
> > > >     /**
> > > >      * Contenido binario del archivo.
> > > >      */
> > > >     @XmlMimeType("application/octet-stream")
> > > >     private DataHandler imageData;
> > > >
> > > >     /**
> > > >      * @return el valor de imageData como InputStream
> > > >      * @throws IOException en caso de error al obtener el
> > > >      * InputStream a partir del DataHandler
> > > >      */
> > > >     public InputStream getInputStream() throws IOException {
> > > >         return imageData.getInputStream();
> > > >     }
> > > >
> > > >     /**
> > > >      * @param imageData el valor de imageData a establecer
> > > >      */
> > > >     public void setImageData(DataHandler imageData) {
> > > >         this.imageData = imageData;
> > > >     }
> > > > }*
> > > >
> > > > When i call this service:
> > > >
> > > > *BinaryFile getOperationCodesFile(String filePath);*
> > > >
> > > > the file comes in the response SOAP as MTOM attachment, but when i
> call
> > > this
> > > > other:
> > > >
> > > > *void updateOpCodesFileOnServer(BinaryFile file, Date updateDate);*
> > > >
> > > > the file goes in the request message inside the Envelope of the SOAP
> > > message
> > > > encoded as a base64Binary.
> > > > I need to know if i can send the file to the server as a MTOM
> attachment
> > > > with CXF and annotations for JAXB beans.
> > > > Thanks in advance.
> > > >
> > > > P.D.: I'm not a member of this mailing list, so i'll thank you if
> you
> > > copy
> > > > your replay to this address. Thanks.
> > >
> > >
>
>

Re: MTOM attachments question

Posted by Glen Mazza <gl...@verizon.net>.
Really?  Our MTOM docs mention the expectedContentType attribution in
multiple places: http://cwiki.apache.org/CXF20DOC/mtom.html.  I wonder
if CXF could pass the TCK if it actually ignored it.

Glen

Am Samstag, den 23.02.2008, 12:33 -0500 schrieb Benson Margulies:
> 2.0.4 doesn't know anything about xmime:expectedContentType, AFAIK. Do you
> have the @MTOM annotation in place to enable the threshold?
> 
> On Fri, Feb 22, 2008 at 8:01 PM, Glen Mazza <gl...@verizon.net> wrote:
> 
> > Some possibilities:
> >
> > 1.) From Step #5 of [1], make sure you have xmime:expectedContentTypes
> > declared in your WSDL (you can see me using it under <element
> > name="getWeatherForecastResponse" at the top).
> >
> > 2.) From Step #6 of [1], make sure you use @BindingType annotation just
> > before your web service implementation.
> >
> > 3.)  Also, your address in your cxf.xml ("/FileTransferWebService") may
> > need to be a full URL as shown in our sample here[2].
> >
> > HTH,
> > Glen
> >
> >
> > [1] http://www.jroller.com/gmazza/date/20071102
> > [2]
> > http://cwiki.apache.org/confluence/display/CXF20DOC/MTOM#MTOM-ConfigFile
> >
> >
> > Am Freitag, den 22.02.2008, 21:19 +0100 schrieb Eliú:
> > > Hi, i'm new with CXF and i'm trying to use MTOM attachments in my web
> > > services.
> > > I followed the Apache CXF 2.0 User's Guide and right now i can get a
> > binary
> > > file from the server to my client using MTOM attachments.
> > > My problem is that i cannot send a file from the client to the server
> > using
> > > MTOM. When I pass my JAXB class or the DataHandler
> > > as a parameter to the Web Service, it always goes base64Binary encoded
> > in
> > > the request SOAP message.
> > > In the server side, i have this endpoint declaration:
> > >
> > > *<jaxws:endpoint id="FileTransferWebService"
> > >     implementor="
> > > com.iafis.sici.server.webServiceImpl.FileTransferWebServiceImpl"
> > >     address="/FileTransferWebService">
> > >     <jaxws:properties>
> > >       <entry key="mtom-enabled" value="true"/>
> > >     </jaxws:properties>
> > > </jaxws:endpoint>*
> > >
> > > and this is my JAXB bean:
> > >
> > > *@XmlType
> > > public class BinaryFile {
> > >
> > >     /**
> > >      * Contenido binario del archivo.
> > >      */
> > >     @XmlMimeType("application/octet-stream")
> > >     private DataHandler imageData;
> > >
> > >     /**
> > >      * @return el valor de imageData como InputStream
> > >      * @throws IOException en caso de error al obtener el
> > >      * InputStream a partir del DataHandler
> > >      */
> > >     public InputStream getInputStream() throws IOException {
> > >         return imageData.getInputStream();
> > >     }
> > >
> > >     /**
> > >      * @param imageData el valor de imageData a establecer
> > >      */
> > >     public void setImageData(DataHandler imageData) {
> > >         this.imageData = imageData;
> > >     }
> > > }*
> > >
> > > When i call this service:
> > >
> > > *BinaryFile getOperationCodesFile(String filePath);*
> > >
> > > the file comes in the response SOAP as MTOM attachment, but when i call
> > this
> > > other:
> > >
> > > *void updateOpCodesFileOnServer(BinaryFile file, Date updateDate);*
> > >
> > > the file goes in the request message inside the Envelope of the SOAP
> > message
> > > encoded as a base64Binary.
> > > I need to know if i can send the file to the server as a MTOM attachment
> > > with CXF and annotations for JAXB beans.
> > > Thanks in advance.
> > >
> > > P.D.: I'm not a member of this mailing list, so i'll thank you if you
> > copy
> > > your replay to this address. Thanks.
> >
> >


Re: MTOM attachments question

Posted by Daniel Kulp <dk...@apache.org>.
On Saturday 23 February 2008, Benson Margulies wrote:
> 2.0.4 doesn't know anything about xmime:expectedContentType, AFAIK. Do
> you have the @MTOM annotation in place to enable the threshold?

Yea, you're backwords....

2.0.4 should deal with the expectedContentType stuff fine.   It DOESN'T, 
however, have an @MTOM annotation.   That was added in 2.1.

In general, and base64Binary thing in the wsdl should be attachable if 
MTOM is turned on.   However, our default threshold is 4K.   Under 4k 
and it will be inlined.

Dan


> On Fri, Feb 22, 2008 at 8:01 PM, Glen Mazza <gl...@verizon.net> 
wrote:
> > Some possibilities:
> >
> > 1.) From Step #5 of [1], make sure you have
> > xmime:expectedContentTypes declared in your WSDL (you can see me
> > using it under <element name="getWeatherForecastResponse" at the
> > top).
> >
> > 2.) From Step #6 of [1], make sure you use @BindingType annotation
> > just before your web service implementation.
> >
> > 3.)  Also, your address in your cxf.xml ("/FileTransferWebService")
> > may need to be a full URL as shown in our sample here[2].
> >
> > HTH,
> > Glen
> >
> >
> > [1] http://www.jroller.com/gmazza/date/20071102
> > [2]
> > http://cwiki.apache.org/confluence/display/CXF20DOC/MTOM#MTOM-Config
> >File
> >
> > Am Freitag, den 22.02.2008, 21:19 +0100 schrieb Eliú:
> > > Hi, i'm new with CXF and i'm trying to use MTOM attachments in my
> > > web services.
> > > I followed the Apache CXF 2.0 User's Guide and right now i can get
> > > a
> >
> > binary
> >
> > > file from the server to my client using MTOM attachments.
> > > My problem is that i cannot send a file from the client to the
> > > server
> >
> > using
> >
> > > MTOM. When I pass my JAXB class or the DataHandler
> > > as a parameter to the Web Service, it always goes base64Binary
> > > encoded
> >
> > in
> >
> > > the request SOAP message.
> > > In the server side, i have this endpoint declaration:
> > >
> > > *<jaxws:endpoint id="FileTransferWebService"
> > >     implementor="
> > > com.iafis.sici.server.webServiceImpl.FileTransferWebServiceImpl"
> > >     address="/FileTransferWebService">
> > >     <jaxws:properties>
> > >       <entry key="mtom-enabled" value="true"/>
> > >     </jaxws:properties>
> > > </jaxws:endpoint>*
> > >
> > > and this is my JAXB bean:
> > >
> > > *@XmlType
> > > public class BinaryFile {
> > >
> > >     /**
> > >      * Contenido binario del archivo.
> > >      */
> > >     @XmlMimeType("application/octet-stream")
> > >     private DataHandler imageData;
> > >
> > >     /**
> > >      * @return el valor de imageData como InputStream
> > >      * @throws IOException en caso de error al obtener el
> > >      * InputStream a partir del DataHandler
> > >      */
> > >     public InputStream getInputStream() throws IOException {
> > >         return imageData.getInputStream();
> > >     }
> > >
> > >     /**
> > >      * @param imageData el valor de imageData a establecer
> > >      */
> > >     public void setImageData(DataHandler imageData) {
> > >         this.imageData = imageData;
> > >     }
> > > }*
> > >
> > > When i call this service:
> > >
> > > *BinaryFile getOperationCodesFile(String filePath);*
> > >
> > > the file comes in the response SOAP as MTOM attachment, but when i
> > > call
> >
> > this
> >
> > > other:
> > >
> > > *void updateOpCodesFileOnServer(BinaryFile file, Date
> > > updateDate);*
> > >
> > > the file goes in the request message inside the Envelope of the
> > > SOAP
> >
> > message
> >
> > > encoded as a base64Binary.
> > > I need to know if i can send the file to the server as a MTOM
> > > attachment with CXF and annotations for JAXB beans.
> > > Thanks in advance.
> > >
> > > P.D.: I'm not a member of this mailing list, so i'll thank you if
> > > you
> >
> > copy
> >
> > > your replay to this address. Thanks.



-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog

Re: MTOM attachments question

Posted by Benson Margulies <bi...@gmail.com>.
2.0.4 doesn't know anything about xmime:expectedContentType, AFAIK. Do you
have the @MTOM annotation in place to enable the threshold?

On Fri, Feb 22, 2008 at 8:01 PM, Glen Mazza <gl...@verizon.net> wrote:

> Some possibilities:
>
> 1.) From Step #5 of [1], make sure you have xmime:expectedContentTypes
> declared in your WSDL (you can see me using it under <element
> name="getWeatherForecastResponse" at the top).
>
> 2.) From Step #6 of [1], make sure you use @BindingType annotation just
> before your web service implementation.
>
> 3.)  Also, your address in your cxf.xml ("/FileTransferWebService") may
> need to be a full URL as shown in our sample here[2].
>
> HTH,
> Glen
>
>
> [1] http://www.jroller.com/gmazza/date/20071102
> [2]
> http://cwiki.apache.org/confluence/display/CXF20DOC/MTOM#MTOM-ConfigFile
>
>
> Am Freitag, den 22.02.2008, 21:19 +0100 schrieb Eliú:
> > Hi, i'm new with CXF and i'm trying to use MTOM attachments in my web
> > services.
> > I followed the Apache CXF 2.0 User's Guide and right now i can get a
> binary
> > file from the server to my client using MTOM attachments.
> > My problem is that i cannot send a file from the client to the server
> using
> > MTOM. When I pass my JAXB class or the DataHandler
> > as a parameter to the Web Service, it always goes base64Binary encoded
> in
> > the request SOAP message.
> > In the server side, i have this endpoint declaration:
> >
> > *<jaxws:endpoint id="FileTransferWebService"
> >     implementor="
> > com.iafis.sici.server.webServiceImpl.FileTransferWebServiceImpl"
> >     address="/FileTransferWebService">
> >     <jaxws:properties>
> >       <entry key="mtom-enabled" value="true"/>
> >     </jaxws:properties>
> > </jaxws:endpoint>*
> >
> > and this is my JAXB bean:
> >
> > *@XmlType
> > public class BinaryFile {
> >
> >     /**
> >      * Contenido binario del archivo.
> >      */
> >     @XmlMimeType("application/octet-stream")
> >     private DataHandler imageData;
> >
> >     /**
> >      * @return el valor de imageData como InputStream
> >      * @throws IOException en caso de error al obtener el
> >      * InputStream a partir del DataHandler
> >      */
> >     public InputStream getInputStream() throws IOException {
> >         return imageData.getInputStream();
> >     }
> >
> >     /**
> >      * @param imageData el valor de imageData a establecer
> >      */
> >     public void setImageData(DataHandler imageData) {
> >         this.imageData = imageData;
> >     }
> > }*
> >
> > When i call this service:
> >
> > *BinaryFile getOperationCodesFile(String filePath);*
> >
> > the file comes in the response SOAP as MTOM attachment, but when i call
> this
> > other:
> >
> > *void updateOpCodesFileOnServer(BinaryFile file, Date updateDate);*
> >
> > the file goes in the request message inside the Envelope of the SOAP
> message
> > encoded as a base64Binary.
> > I need to know if i can send the file to the server as a MTOM attachment
> > with CXF and annotations for JAXB beans.
> > Thanks in advance.
> >
> > P.D.: I'm not a member of this mailing list, so i'll thank you if you
> copy
> > your replay to this address. Thanks.
>
>

Re: MTOM attachments question

Posted by Glen Mazza <gl...@verizon.net>.
Some possibilities:

1.) From Step #5 of [1], make sure you have xmime:expectedContentTypes
declared in your WSDL (you can see me using it under <element
name="getWeatherForecastResponse" at the top).

2.) From Step #6 of [1], make sure you use @BindingType annotation just
before your web service implementation.

3.)  Also, your address in your cxf.xml ("/FileTransferWebService") may
need to be a full URL as shown in our sample here[2].

HTH,
Glen


[1] http://www.jroller.com/gmazza/date/20071102
[2]
http://cwiki.apache.org/confluence/display/CXF20DOC/MTOM#MTOM-ConfigFile


Am Freitag, den 22.02.2008, 21:19 +0100 schrieb Eliú:
> Hi, i'm new with CXF and i'm trying to use MTOM attachments in my web
> services.
> I followed the Apache CXF 2.0 User's Guide and right now i can get a binary
> file from the server to my client using MTOM attachments.
> My problem is that i cannot send a file from the client to the server using
> MTOM. When I pass my JAXB class or the DataHandler
> as a parameter to the Web Service, it always goes base64Binary encoded in
> the request SOAP message.
> In the server side, i have this endpoint declaration:
> 
> *<jaxws:endpoint id="FileTransferWebService"
>     implementor="
> com.iafis.sici.server.webServiceImpl.FileTransferWebServiceImpl"
>     address="/FileTransferWebService">
>     <jaxws:properties>
>       <entry key="mtom-enabled" value="true"/>
>     </jaxws:properties>
> </jaxws:endpoint>*
> 
> and this is my JAXB bean:
> 
> *@XmlType
> public class BinaryFile {
> 
>     /**
>      * Contenido binario del archivo.
>      */
>     @XmlMimeType("application/octet-stream")
>     private DataHandler imageData;
> 
>     /**
>      * @return el valor de imageData como InputStream
>      * @throws IOException en caso de error al obtener el
>      * InputStream a partir del DataHandler
>      */
>     public InputStream getInputStream() throws IOException {
>         return imageData.getInputStream();
>     }
> 
>     /**
>      * @param imageData el valor de imageData a establecer
>      */
>     public void setImageData(DataHandler imageData) {
>         this.imageData = imageData;
>     }
> }*
> 
> When i call this service:
> 
> *BinaryFile getOperationCodesFile(String filePath);*
> 
> the file comes in the response SOAP as MTOM attachment, but when i call this
> other:
> 
> *void updateOpCodesFileOnServer(BinaryFile file, Date updateDate);*
> 
> the file goes in the request message inside the Envelope of the SOAP message
> encoded as a base64Binary.
> I need to know if i can send the file to the server as a MTOM attachment
> with CXF and annotations for JAXB beans.
> Thanks in advance.
> 
> P.D.: I'm not a member of this mailing list, so i'll thank you if you copy
> your replay to this address. Thanks.


Re: How to pass a HashMap

Posted by Benson Margulies <bi...@gmail.com>.
This is now CXF-1451. Please comment there, but mostly stand by whilst I try
to make some sense of it.

On Sat, Feb 23, 2008 at 1:11 PM, Benson Margulies <bi...@gmail.com>
wrote:

> I've reproduced this.
>
> On Fri, Feb 22, 2008 at 4:39 PM, Li, Weiye <We...@stjude.org> wrote:
>
> > The CXF document says that Aegis data binding can even works on Map. I
> > tried this, but it always return an empty one. Here's my testing codes. Did
> > I miss something? Or I need to write special config file?
> >
> >
> >
> >
> > @WebService(name="EmicroManager", targetNamespace="http://test.emicro ")
> > @SOAPBinding(style=Style.RPC, use=Use.LITERAL, parameterStyle=
> > ParameterStyle.WRAPPED)
> > public interface EmicroService {
> >      @WebMethod
> >      @RequestWrapper(className="test.model.Employee",
> >                  localName="employee", targetNamespace="
> > http://test.emicro/types ")
> >      @Oneway
> >      public void addEmployee(Employee emp);
> >
> >
> >      @WebMethod(operationName="getEmployeesAsMap")
> >      @ResponseWrapper(className="java.util.HashMap",
> >                  localName="EmployeesMap", targetNamespace="
> > http://test.emicro/types")
> >      public Map getEmployeesMap();
> >
> > }
> >
> >
> >
> >
> >
> > public static void main(String args[]) throws Exception {
> >
> >      JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
> >
> >      factory.setServiceClass(test.EmicroService.class);
> >
> >      factory.setAddress("http://localhost:9080/emicro-ws/EmicroService
> > ");
> >
> >      factory.getServiceFactory().setDataBinding(new AegisDatabinding());
> >
> >
> >
> >      EmicroService client = (EmicroService)factory.create();
> >
> >
> >
> >        // add 2 employees here, then
> >
> >
> >
> >        Map<Integer, Employee> emap = client.getEmployeesMap();
> >
> >        logger.info(emap);
> >
> >
> >
> >        System.exit(0);
> >
> >    }
> >
> >
> >
> > The backend configuration is just following the CXF tutorial
> > <bean id="aegisBean" class="
> > org.apache.cxf.aegis.databinding.AegisDatabinding" scope="prototype"/>
> >
> >
> >
> >      <bean id="jaxws-and-aegis-service-factory"
> >
> >            class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"
> > scope="prototype">
> >
> >            <property name="dataBinding" ref="aegisBean" />
> >
> >            <property name="serviceConfigurations">
> >
> >                  <list>
> >
> >                        <bean class="
> > org.apache.cxf.jaxws.support.JaxWsServiceConfiguration" />
> >
> >                        <bean class="
> > org.apache.cxf.aegis.databinding.AegisServiceConfiguration" />
> >
> >                        <bean class="
> > org.apache.cxf.service.factory.DefaultServiceConfiguration" />
> >
> >                  </list>
> >
> >            </property>
> >
> >      </bean>
> >
> >
> >
> >
> >
> >      <bean id="emicro" class="org.stjude.ri.emicro.ws.EmicroServiceImpl"
> > />
> >
> >
> >
> >      <jaxws:endpoint id="helloWorld" implementor="#emicro"
> > address="/EmicroService">
> >
> >            <jaxws:serviceFactory>
> >
> >                  <ref bean='jaxws-and-aegis-service-factory' />
> >
> >            </jaxws:serviceFactory>
> >
> >      </jaxws:endpoint>
> >
> >
> >
> >
> >
> > Any advice? Thanks
> >
> >
> >
>

Re: How to pass a HashMap

Posted by Benson Margulies <bi...@gmail.com>.
I've reproduced this.

On Fri, Feb 22, 2008 at 4:39 PM, Li, Weiye <We...@stjude.org> wrote:

> The CXF document says that Aegis data binding can even works on Map. I
> tried this, but it always return an empty one. Here's my testing codes. Did
> I miss something? Or I need to write special config file?
>
>
>
>
> @WebService(name="EmicroManager", targetNamespace="http://test.emicro ")
> @SOAPBinding(style=Style.RPC, use=Use.LITERAL, parameterStyle=
> ParameterStyle.WRAPPED)
> public interface EmicroService {
>      @WebMethod
>      @RequestWrapper(className="test.model.Employee",
>                  localName="employee", targetNamespace="
> http://test.emicro/types ")
>      @Oneway
>      public void addEmployee(Employee emp);
>
>
>      @WebMethod(operationName="getEmployeesAsMap")
>      @ResponseWrapper(className="java.util.HashMap",
>                  localName="EmployeesMap", targetNamespace="
> http://test.emicro/types")
>      public Map getEmployeesMap();
>
> }
>
>
>
>
>
> public static void main(String args[]) throws Exception {
>
>      JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
>
>      factory.setServiceClass(test.EmicroService.class);
>
>      factory.setAddress("http://localhost:9080/emicro-ws/EmicroService");
>
>      factory.getServiceFactory().setDataBinding(new AegisDatabinding());
>
>
>
>      EmicroService client = (EmicroService)factory.create();
>
>
>
>        // add 2 employees here, then
>
>
>
>        Map<Integer, Employee> emap = client.getEmployeesMap();
>
>        logger.info(emap);
>
>
>
>        System.exit(0);
>
>    }
>
>
>
> The backend configuration is just following the CXF tutorial
> <bean id="aegisBean" class="
> org.apache.cxf.aegis.databinding.AegisDatabinding" scope="prototype"/>
>
>
>
>      <bean id="jaxws-and-aegis-service-factory"
>
>            class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"
> scope="prototype">
>
>            <property name="dataBinding" ref="aegisBean" />
>
>            <property name="serviceConfigurations">
>
>                  <list>
>
>                        <bean class="
> org.apache.cxf.jaxws.support.JaxWsServiceConfiguration" />
>
>                        <bean class="
> org.apache.cxf.aegis.databinding.AegisServiceConfiguration" />
>
>                        <bean class="
> org.apache.cxf.service.factory.DefaultServiceConfiguration" />
>
>                  </list>
>
>            </property>
>
>      </bean>
>
>
>
>
>
>      <bean id="emicro" class="org.stjude.ri.emicro.ws.EmicroServiceImpl"
> />
>
>
>
>      <jaxws:endpoint id="helloWorld" implementor="#emicro"
> address="/EmicroService">
>
>            <jaxws:serviceFactory>
>
>                  <ref bean='jaxws-and-aegis-service-factory' />
>
>            </jaxws:serviceFactory>
>
>      </jaxws:endpoint>
>
>
>
>
>
> Any advice? Thanks
>
>
>

Re: How to work with document type?

Posted by Benson Margulies <bi...@gmail.com>.
If you get rid of all your JAX-WS annotations except @WebParam, which are
not needed for CXF, you won't get this error. I tried it with your test
case.

On Mon, Feb 25, 2008 at 10:35 AM, Li, Weiye <We...@stjude.org> wrote:

> My testing Jax-WS with Aegis worked only with RPC style. When I changed
> soapbinding with RPC style, the same codes give exception. Here's my WS
> file:
>
> @WebService(name="EmicroManager", targetNamespace="http://emicro.test")
> @SOAPBinding(style=Style.DOCUMENT, use=Use.LITERAL, parameterStyle=
> ParameterStyle.WRAPPED) public interface EmicroService {
> .....
> }
>
> When client tried to use the service: ws.addEmployee(Employee) or any
> other method, exception thrown as:
> Feb 25, 2008 9:32:29 AM org.apache.cxf.phase.PhaseInterceptorChaindoIntercept INFO: Interceptor has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault: NO_MESSAGE_FOR_PART    at
> org.apache.cxf.aegis.databinding.XMLStreamDataWriter.write(
> XMLStreamDataWriter.java:72)    at
> org.apache.cxf.aegis.databinding.XMLStreamDataWriter.write(
> XMLStreamDataWriter.java:45)    at
> org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(
> AbstractOutDatabindingInterceptor.java:93)    at
> org.apache.cxf.interceptor.BareOutInterceptor.handleMessage(
> BareOutInterceptor.java:68)    at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(
> PhaseInterceptorChain.java:208)    at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:276)    at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:222)    at
> org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)    at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135)
>  at $Proxy24.addEmployee(Unknown Source)
>
>
> Where the "Employee" extends a base class "People". Both of them are
> simple Java bean.
>
> The same codes works if I change DOCUMENT to RPC. I believe I must miss
> something, but what's that?
> Help?
>
> Thanks.
>
>

How to work with document type?

Posted by "Li, Weiye" <We...@STJUDE.ORG>.
My testing Jax-WS with Aegis worked only with RPC style. When I changed soapbinding with RPC style, the same codes give exception. Here's my WS file:

@WebService(name="EmicroManager", targetNamespace="http://emicro.test") @SOAPBinding(style=Style.DOCUMENT, use=Use.LITERAL, parameterStyle=ParameterStyle.WRAPPED) public interface EmicroService {
.....
}

When client tried to use the service: ws.addEmployee(Employee) or any other method, exception thrown as:
Feb 25, 2008 9:32:29 AM org.apache.cxf.phase.PhaseInterceptorChain doIntercept INFO: Interceptor has thrown exception, unwinding now org.apache.cxf.interceptor.Fault: NO_MESSAGE_FOR_PART    at org.apache.cxf.aegis.databinding.XMLStreamDataWriter.write(XMLStreamDataWriter.java:72)    at org.apache.cxf.aegis.databinding.XMLStreamDataWriter.write(XMLStreamDataWriter.java:45)    at org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:93)    at org.apache.cxf.interceptor.BareOutInterceptor.handleMessage(BareOutInterceptor.java:68)    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:208)    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:276)    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:222)    at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135)    at $Proxy24.addEmployee(Unknown Source)


Where the "Employee" extends a base class "People". Both of them are simple Java bean.

The same codes works if I change DOCUMENT to RPC. I believe I must miss something, but what's that?
Help?

Thanks.


RE: How to pass a HashMap

Posted by "Doubleday, Dennis" <dd...@vocollect.com>.
I reported the same issue in 2.0.3 a while back, and I did have my Map
specified as Map<String, String>. (It was a service that had previously
worked under XFire.) 

I got no response, so I switched to JAXB and just wrapped the Map inside
a bean.

-----Original Message-----
From: Benson Margulies [mailto:bimargulies@gmail.com] 
Sent: Monday, February 25, 2008 10:20 AM
To: cxf-user@incubator.apache.org
Subject: Re: How to pass a HashMap

Please try my suggestion of declaring Map<Type,Type> in your SEI instead
of
just 'map'.


On Mon, Feb 25, 2008 at 10:04 AM, Li, Weiye <We...@stjude.org> wrote:

> Should be the latest one:2.0.4
> Thanks for the reply.
>
>
> On 2/23/08 11:49 AM, "Benson Margulies" <bi...@gmail.com> wrote:
>
> What version of CXF have you got?
>
>
> On Fri, Feb 22, 2008 at 4:39 PM, Li, Weiye <We...@stjude.org>
wrote:
>
> > The CXF document says that Aegis data binding can even works on Map.
I
> > tried this, but it always return an empty one. Here's my testing
codes.
> Did
> > I miss something? Or I need to write special config file?
> >
> >
> >
> >
> > @WebService(name="EmicroManager",
targetNamespace="http://test.emicro ")
> > @SOAPBinding(style=Style.RPC, use=Use.LITERAL, parameterStyle=
> > ParameterStyle.WRAPPED)
> > public interface EmicroService {
> >      @WebMethod
> >      @RequestWrapper(className="test.model.Employee",
> >                  localName="employee", targetNamespace="
> > http://test.emicro/types ")
> >      @Oneway
> >      public void addEmployee(Employee emp);
> >
> >
> >      @WebMethod(operationName="getEmployeesAsMap")
> >      @ResponseWrapper(className="java.util.HashMap",
> >                  localName="EmployeesMap", targetNamespace="
> > http://test.emicro/types")
> >      public Map getEmployeesMap();
> >
> > }
> >
> >
> >
> >
> >
> > public static void main(String args[]) throws Exception {
> >
> >      JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
> >
> >      factory.setServiceClass(test.EmicroService.class);
> >
> >
factory.setAddress("http://localhost:9080/emicro-ws/EmicroService
> ");
> >
> >      factory.getServiceFactory().setDataBinding(new
AegisDatabinding());
> >
> >
> >
> >      EmicroService client = (EmicroService)factory.create();
> >
> >
> >
> >        // add 2 employees here, then
> >
> >
> >
> >        Map<Integer, Employee> emap = client.getEmployeesMap();
> >
> >        logger.info(emap);
> >
> >
> >
> >        System.exit(0);
> >
> >    }
> >
> >
> >
> > The backend configuration is just following the CXF tutorial
> > <bean id="aegisBean" class="
> > org.apache.cxf.aegis.databinding.AegisDatabinding"
scope="prototype"/>
> >
> >
> >
> >      <bean id="jaxws-and-aegis-service-factory"
> >
> >
class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"
> > scope="prototype">
> >
> >            <property name="dataBinding" ref="aegisBean" />
> >
> >            <property name="serviceConfigurations">
> >
> >                  <list>
> >
> >                        <bean class="
> > org.apache.cxf.jaxws.support.JaxWsServiceConfiguration" />
> >
> >                        <bean class="
> > org.apache.cxf.aegis.databinding.AegisServiceConfiguration" />
> >
> >                        <bean class="
> > org.apache.cxf.service.factory.DefaultServiceConfiguration" />
> >
> >                  </list>
> >
> >            </property>
> >
> >      </bean>
> >
> >
> >
> >
> >
> >      <bean id="emicro"
class="org.stjude.ri.emicro.ws.EmicroServiceImpl"
> > />
> >
> >
> >
> >      <jaxws:endpoint id="helloWorld" implementor="#emicro"
> > address="/EmicroService">
> >
> >            <jaxws:serviceFactory>
> >
> >                  <ref bean='jaxws-and-aegis-service-factory' />
> >
> >            </jaxws:serviceFactory>
> >
> >      </jaxws:endpoint>
> >
> >
> >
> >
> >
> > Any advice? Thanks
> >
> >
> >
>
>
>
>

Re: How to pass a HashMap

Posted by Benson Margulies <bi...@gmail.com>.
Please try my suggestion of declaring Map<Type,Type> in your SEI instead of
just 'map'.


On Mon, Feb 25, 2008 at 10:04 AM, Li, Weiye <We...@stjude.org> wrote:

> Should be the latest one:2.0.4
> Thanks for the reply.
>
>
> On 2/23/08 11:49 AM, "Benson Margulies" <bi...@gmail.com> wrote:
>
> What version of CXF have you got?
>
>
> On Fri, Feb 22, 2008 at 4:39 PM, Li, Weiye <We...@stjude.org> wrote:
>
> > The CXF document says that Aegis data binding can even works on Map. I
> > tried this, but it always return an empty one. Here's my testing codes.
> Did
> > I miss something? Or I need to write special config file?
> >
> >
> >
> >
> > @WebService(name="EmicroManager", targetNamespace="http://test.emicro ")
> > @SOAPBinding(style=Style.RPC, use=Use.LITERAL, parameterStyle=
> > ParameterStyle.WRAPPED)
> > public interface EmicroService {
> >      @WebMethod
> >      @RequestWrapper(className="test.model.Employee",
> >                  localName="employee", targetNamespace="
> > http://test.emicro/types ")
> >      @Oneway
> >      public void addEmployee(Employee emp);
> >
> >
> >      @WebMethod(operationName="getEmployeesAsMap")
> >      @ResponseWrapper(className="java.util.HashMap",
> >                  localName="EmployeesMap", targetNamespace="
> > http://test.emicro/types")
> >      public Map getEmployeesMap();
> >
> > }
> >
> >
> >
> >
> >
> > public static void main(String args[]) throws Exception {
> >
> >      JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
> >
> >      factory.setServiceClass(test.EmicroService.class);
> >
> >      factory.setAddress("http://localhost:9080/emicro-ws/EmicroService
> ");
> >
> >      factory.getServiceFactory().setDataBinding(new AegisDatabinding());
> >
> >
> >
> >      EmicroService client = (EmicroService)factory.create();
> >
> >
> >
> >        // add 2 employees here, then
> >
> >
> >
> >        Map<Integer, Employee> emap = client.getEmployeesMap();
> >
> >        logger.info(emap);
> >
> >
> >
> >        System.exit(0);
> >
> >    }
> >
> >
> >
> > The backend configuration is just following the CXF tutorial
> > <bean id="aegisBean" class="
> > org.apache.cxf.aegis.databinding.AegisDatabinding" scope="prototype"/>
> >
> >
> >
> >      <bean id="jaxws-and-aegis-service-factory"
> >
> >            class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"
> > scope="prototype">
> >
> >            <property name="dataBinding" ref="aegisBean" />
> >
> >            <property name="serviceConfigurations">
> >
> >                  <list>
> >
> >                        <bean class="
> > org.apache.cxf.jaxws.support.JaxWsServiceConfiguration" />
> >
> >                        <bean class="
> > org.apache.cxf.aegis.databinding.AegisServiceConfiguration" />
> >
> >                        <bean class="
> > org.apache.cxf.service.factory.DefaultServiceConfiguration" />
> >
> >                  </list>
> >
> >            </property>
> >
> >      </bean>
> >
> >
> >
> >
> >
> >      <bean id="emicro" class="org.stjude.ri.emicro.ws.EmicroServiceImpl"
> > />
> >
> >
> >
> >      <jaxws:endpoint id="helloWorld" implementor="#emicro"
> > address="/EmicroService">
> >
> >            <jaxws:serviceFactory>
> >
> >                  <ref bean='jaxws-and-aegis-service-factory' />
> >
> >            </jaxws:serviceFactory>
> >
> >      </jaxws:endpoint>
> >
> >
> >
> >
> >
> > Any advice? Thanks
> >
> >
> >
>
>
>
>

Re: How to pass a HashMap

Posted by "Li, Weiye" <We...@STJUDE.ORG>.
Should be the latest one:2.0.4
Thanks for the reply.


On 2/23/08 11:49 AM, "Benson Margulies" <bi...@gmail.com> wrote:

What version of CXF have you got?


On Fri, Feb 22, 2008 at 4:39 PM, Li, Weiye <We...@stjude.org> wrote:

> The CXF document says that Aegis data binding can even works on Map. I
> tried this, but it always return an empty one. Here's my testing codes. Did
> I miss something? Or I need to write special config file?
>
>
>
>
> @WebService(name="EmicroManager", targetNamespace="http://test.emicro ")
> @SOAPBinding(style=Style.RPC, use=Use.LITERAL, parameterStyle=
> ParameterStyle.WRAPPED)
> public interface EmicroService {
>      @WebMethod
>      @RequestWrapper(className="test.model.Employee",
>                  localName="employee", targetNamespace="
> http://test.emicro/types ")
>      @Oneway
>      public void addEmployee(Employee emp);
>
>
>      @WebMethod(operationName="getEmployeesAsMap")
>      @ResponseWrapper(className="java.util.HashMap",
>                  localName="EmployeesMap", targetNamespace="
> http://test.emicro/types")
>      public Map getEmployeesMap();
>
> }
>
>
>
>
>
> public static void main(String args[]) throws Exception {
>
>      JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
>
>      factory.setServiceClass(test.EmicroService.class);
>
>      factory.setAddress("http://localhost:9080/emicro-ws/EmicroService");
>
>      factory.getServiceFactory().setDataBinding(new AegisDatabinding());
>
>
>
>      EmicroService client = (EmicroService)factory.create();
>
>
>
>        // add 2 employees here, then
>
>
>
>        Map<Integer, Employee> emap = client.getEmployeesMap();
>
>        logger.info(emap);
>
>
>
>        System.exit(0);
>
>    }
>
>
>
> The backend configuration is just following the CXF tutorial
> <bean id="aegisBean" class="
> org.apache.cxf.aegis.databinding.AegisDatabinding" scope="prototype"/>
>
>
>
>      <bean id="jaxws-and-aegis-service-factory"
>
>            class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"
> scope="prototype">
>
>            <property name="dataBinding" ref="aegisBean" />
>
>            <property name="serviceConfigurations">
>
>                  <list>
>
>                        <bean class="
> org.apache.cxf.jaxws.support.JaxWsServiceConfiguration" />
>
>                        <bean class="
> org.apache.cxf.aegis.databinding.AegisServiceConfiguration" />
>
>                        <bean class="
> org.apache.cxf.service.factory.DefaultServiceConfiguration" />
>
>                  </list>
>
>            </property>
>
>      </bean>
>
>
>
>
>
>      <bean id="emicro" class="org.stjude.ri.emicro.ws.EmicroServiceImpl"
> />
>
>
>
>      <jaxws:endpoint id="helloWorld" implementor="#emicro"
> address="/EmicroService">
>
>            <jaxws:serviceFactory>
>
>                  <ref bean='jaxws-and-aegis-service-factory' />
>
>            </jaxws:serviceFactory>
>
>      </jaxws:endpoint>
>
>
>
>
>
> Any advice? Thanks
>
>
>




Re: How to pass a HashMap

Posted by Benson Margulies <bi...@gmail.com>.
What version of CXF have you got?


On Fri, Feb 22, 2008 at 4:39 PM, Li, Weiye <We...@stjude.org> wrote:

> The CXF document says that Aegis data binding can even works on Map. I
> tried this, but it always return an empty one. Here's my testing codes. Did
> I miss something? Or I need to write special config file?
>
>
>
>
> @WebService(name="EmicroManager", targetNamespace="http://test.emicro ")
> @SOAPBinding(style=Style.RPC, use=Use.LITERAL, parameterStyle=
> ParameterStyle.WRAPPED)
> public interface EmicroService {
>      @WebMethod
>      @RequestWrapper(className="test.model.Employee",
>                  localName="employee", targetNamespace="
> http://test.emicro/types ")
>      @Oneway
>      public void addEmployee(Employee emp);
>
>
>      @WebMethod(operationName="getEmployeesAsMap")
>      @ResponseWrapper(className="java.util.HashMap",
>                  localName="EmployeesMap", targetNamespace="
> http://test.emicro/types")
>      public Map getEmployeesMap();
>
> }
>
>
>
>
>
> public static void main(String args[]) throws Exception {
>
>      JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
>
>      factory.setServiceClass(test.EmicroService.class);
>
>      factory.setAddress("http://localhost:9080/emicro-ws/EmicroService");
>
>      factory.getServiceFactory().setDataBinding(new AegisDatabinding());
>
>
>
>      EmicroService client = (EmicroService)factory.create();
>
>
>
>        // add 2 employees here, then
>
>
>
>        Map<Integer, Employee> emap = client.getEmployeesMap();
>
>        logger.info(emap);
>
>
>
>        System.exit(0);
>
>    }
>
>
>
> The backend configuration is just following the CXF tutorial
> <bean id="aegisBean" class="
> org.apache.cxf.aegis.databinding.AegisDatabinding" scope="prototype"/>
>
>
>
>      <bean id="jaxws-and-aegis-service-factory"
>
>            class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"
> scope="prototype">
>
>            <property name="dataBinding" ref="aegisBean" />
>
>            <property name="serviceConfigurations">
>
>                  <list>
>
>                        <bean class="
> org.apache.cxf.jaxws.support.JaxWsServiceConfiguration" />
>
>                        <bean class="
> org.apache.cxf.aegis.databinding.AegisServiceConfiguration" />
>
>                        <bean class="
> org.apache.cxf.service.factory.DefaultServiceConfiguration" />
>
>                  </list>
>
>            </property>
>
>      </bean>
>
>
>
>
>
>      <bean id="emicro" class="org.stjude.ri.emicro.ws.EmicroServiceImpl"
> />
>
>
>
>      <jaxws:endpoint id="helloWorld" implementor="#emicro"
> address="/EmicroService">
>
>            <jaxws:serviceFactory>
>
>                  <ref bean='jaxws-and-aegis-service-factory' />
>
>            </jaxws:serviceFactory>
>
>      </jaxws:endpoint>
>
>
>
>
>
> Any advice? Thanks
>
>
>

Re: How to pass a HashMap

Posted by Daniel Kulp <dk...@apache.org>.
On Monday 25 February 2008, Benson Margulies wrote:
> The use of HashMap as a JAX-WS wrapper type may be a problem. Let me
> try the Map<x,y> experiment in my testbed.

Uhh....  yea.   In general, unless you REALLY know what you are doing, 
for code first, don't put @RequestWrapper and @ResponseWrapper 
annotations.     

Setting the classname in them to something other than a properly 
constructed wrapper type can definitely lead to issues.      In this 
case, if you wanted to use them, you would have to create a bean like:

class GetEmployeesMap {
    Map<Integer, Employee> _return;
    ....getReturn getter
    ....setReturn setter
}

Even then, I'm not sure it would work as I don't know how or if aegis can 
deal with the wrapper types.

So, in summary, don't use them.    Unless the code generator has 
specifically put them there (wsdl2java), ignore them.

Dan
  




On Monday 25 February 2008, Benson Margulies wrote:
> The use of HashMap as a JAX-WS wrapper type may be a problem. Let me
> try the Map<x,y> experiment in my testbed.
>
> On Mon, Feb 25, 2008 at 10:29 AM, Li, Weiye <We...@stjude.org> 
wrote:
> > I think I may have to declare .aegis.xml.
> > It was my 2nd try (I mean, use Map only). I did use Map<Integer,
> > Employee> on my first try and the outcome is the same: empty map
> > returned.
> >
> > On 2/24/08 12:09 PM, "Benson Margulies" <bi...@gmail.com>
> > wrote:
> >
> > It does work. But you have to tell it what's in the map. Either
> > declare the
> > type as
> >
> > Map<A,B>, or use a .aegis.xml file to tell it.
> >
> > > > @WebService(name="EmicroManager",
> > > > targetNamespace="http://test.emicro")
> > > > @SOAPBinding(style=Style.RPC, use=Use.LITERAL, parameterStyle=
> > > > ParameterStyle.WRAPPED)
> > > > public interface EmicroService {
> > > >      @WebMethod
> > > >      @RequestWrapper(className="test.model.Employee",
> > > >                  localName="employee", targetNamespace="
> > > > http://test.emicro/types ")
> > > >      @Oneway
> > > >      public void addEmployee(Employee emp);
> > > >
> > > >
> > > >      @WebMethod(operationName="getEmployeesAsMap")
> > > >      @ResponseWrapper(className="java.util.HashMap",
> > > >                  localName="EmployeesMap", targetNamespace="
> > > > http://test.emicro/types")
> > > >      public Map getEmployeesMap();



-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog

Re: How to pass a HashMap

Posted by Benson Margulies <bi...@gmail.com>.
The use of HashMap as a JAX-WS wrapper type may be a problem. Let me try the
Map<x,y> experiment in my testbed.

On Mon, Feb 25, 2008 at 10:29 AM, Li, Weiye <We...@stjude.org> wrote:

> I think I may have to declare .aegis.xml.
> It was my 2nd try (I mean, use Map only). I did use Map<Integer, Employee>
> on my first try and the outcome is the same: empty map returned.
>
> On 2/24/08 12:09 PM, "Benson Margulies" <bi...@gmail.com> wrote:
>
> It does work. But you have to tell it what's in the map. Either declare
> the
> type as
>
> Map<A,B>, or use a .aegis.xml file to tell it.
>
> > >
> > >
> > >
> > > @WebService(name="EmicroManager", targetNamespace="http://test.emicro")
> > > @SOAPBinding(style=Style.RPC, use=Use.LITERAL, parameterStyle=
> > > ParameterStyle.WRAPPED)
> > > public interface EmicroService {
> > >      @WebMethod
> > >      @RequestWrapper(className="test.model.Employee",
> > >                  localName="employee", targetNamespace="
> > > http://test.emicro/types ")
> > >      @Oneway
> > >      public void addEmployee(Employee emp);
> > >
> > >
> > >      @WebMethod(operationName="getEmployeesAsMap")
> > >      @ResponseWrapper(className="java.util.HashMap",
> > >                  localName="EmployeesMap", targetNamespace="
> > > http://test.emicro/types")
> > >      public Map getEmployeesMap();
> > >
>
>

Re: How to pass a HashMap

Posted by "Li, Weiye" <We...@STJUDE.ORG>.
I think I may have to declare .aegis.xml.
It was my 2nd try (I mean, use Map only). I did use Map<Integer, Employee> on my first try and the outcome is the same: empty map returned.

On 2/24/08 12:09 PM, "Benson Margulies" <bi...@gmail.com> wrote:

It does work. But you have to tell it what's in the map. Either declare the
type as

Map<A,B>, or use a .aegis.xml file to tell it.

> >
> >
> >
> > @WebService(name="EmicroManager", targetNamespace="http://test.emicro ")
> > @SOAPBinding(style=Style.RPC, use=Use.LITERAL, parameterStyle=
> > ParameterStyle.WRAPPED)
> > public interface EmicroService {
> >      @WebMethod
> >      @RequestWrapper(className="test.model.Employee",
> >                  localName="employee", targetNamespace="
> > http://test.emicro/types ")
> >      @Oneway
> >      public void addEmployee(Employee emp);
> >
> >
> >      @WebMethod(operationName="getEmployeesAsMap")
> >      @ResponseWrapper(className="java.util.HashMap",
> >                  localName="EmployeesMap", targetNamespace="
> > http://test.emicro/types")
> >      public Map getEmployeesMap();
> >


Re: How to pass a HashMap

Posted by Benson Margulies <bi...@gmail.com>.
It does work. But you have to tell it what's in the map. Either declare the
type as

Map<A,B>, or use a .aegis.xml file to tell it.

On Sat, Feb 23, 2008 at 1:39 PM, Benson Margulies <bi...@gmail.com>
wrote:

> I'm fairly sure I see what the problem is here. You need to either declare
> your map with generic args, or use a .aegis.xml file to specify the types.
>
> On Fri, Feb 22, 2008 at 4:39 PM, Li, Weiye <We...@stjude.org> wrote:
>
> > The CXF document says that Aegis data binding can even works on Map. I
> > tried this, but it always return an empty one. Here's my testing codes. Did
> > I miss something? Or I need to write special config file?
> >
> >
> >
> >
> > @WebService(name="EmicroManager", targetNamespace="http://test.emicro ")
> > @SOAPBinding(style=Style.RPC, use=Use.LITERAL, parameterStyle=
> > ParameterStyle.WRAPPED)
> > public interface EmicroService {
> >      @WebMethod
> >      @RequestWrapper(className="test.model.Employee",
> >                  localName="employee", targetNamespace="
> > http://test.emicro/types ")
> >      @Oneway
> >      public void addEmployee(Employee emp);
> >
> >
> >      @WebMethod(operationName="getEmployeesAsMap")
> >      @ResponseWrapper(className="java.util.HashMap",
> >                  localName="EmployeesMap", targetNamespace="
> > http://test.emicro/types")
> >      public Map getEmployeesMap();
> >
> > }
> >
> >
> >
> >
> >
> > public static void main(String args[]) throws Exception {
> >
> >      JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
> >
> >      factory.setServiceClass(test.EmicroService.class);
> >
> >      factory.setAddress("http://localhost:9080/emicro-ws/EmicroService
> > ");
> >
> >      factory.getServiceFactory().setDataBinding(new AegisDatabinding());
> >
> >
> >
> >      EmicroService client = (EmicroService)factory.create();
> >
> >
> >
> >        // add 2 employees here, then
> >
> >
> >
> >        Map<Integer, Employee> emap = client.getEmployeesMap();
> >
> >        logger.info(emap);
> >
> >
> >
> >        System.exit(0);
> >
> >    }
> >
> >
> >
> > The backend configuration is just following the CXF tutorial
> > <bean id="aegisBean" class="
> > org.apache.cxf.aegis.databinding.AegisDatabinding" scope="prototype"/>
> >
> >
> >
> >      <bean id="jaxws-and-aegis-service-factory"
> >
> >            class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"
> > scope="prototype">
> >
> >            <property name="dataBinding" ref="aegisBean" />
> >
> >            <property name="serviceConfigurations">
> >
> >                  <list>
> >
> >                        <bean class="
> > org.apache.cxf.jaxws.support.JaxWsServiceConfiguration" />
> >
> >                        <bean class="
> > org.apache.cxf.aegis.databinding.AegisServiceConfiguration" />
> >
> >                        <bean class="
> > org.apache.cxf.service.factory.DefaultServiceConfiguration" />
> >
> >                  </list>
> >
> >            </property>
> >
> >      </bean>
> >
> >
> >
> >
> >
> >      <bean id="emicro" class="org.stjude.ri.emicro.ws.EmicroServiceImpl"
> > />
> >
> >
> >
> >      <jaxws:endpoint id="helloWorld" implementor="#emicro"
> > address="/EmicroService">
> >
> >            <jaxws:serviceFactory>
> >
> >                  <ref bean='jaxws-and-aegis-service-factory' />
> >
> >            </jaxws:serviceFactory>
> >
> >      </jaxws:endpoint>
> >
> >
> >
> >
> >
> > Any advice? Thanks
> >
> >
> >
>

Re: How to pass a HashMap

Posted by Benson Margulies <bi...@gmail.com>.
I'm fairly sure I see what the problem is here. You need to either declare
your map with generic args, or use a .aegis.xml file to specify the types.

On Fri, Feb 22, 2008 at 4:39 PM, Li, Weiye <We...@stjude.org> wrote:

> The CXF document says that Aegis data binding can even works on Map. I
> tried this, but it always return an empty one. Here's my testing codes. Did
> I miss something? Or I need to write special config file?
>
>
>
>
> @WebService(name="EmicroManager", targetNamespace="http://test.emicro ")
> @SOAPBinding(style=Style.RPC, use=Use.LITERAL, parameterStyle=
> ParameterStyle.WRAPPED)
> public interface EmicroService {
>      @WebMethod
>      @RequestWrapper(className="test.model.Employee",
>                  localName="employee", targetNamespace="
> http://test.emicro/types ")
>      @Oneway
>      public void addEmployee(Employee emp);
>
>
>      @WebMethod(operationName="getEmployeesAsMap")
>      @ResponseWrapper(className="java.util.HashMap",
>                  localName="EmployeesMap", targetNamespace="
> http://test.emicro/types")
>      public Map getEmployeesMap();
>
> }
>
>
>
>
>
> public static void main(String args[]) throws Exception {
>
>      JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
>
>      factory.setServiceClass(test.EmicroService.class);
>
>      factory.setAddress("http://localhost:9080/emicro-ws/EmicroService");
>
>      factory.getServiceFactory().setDataBinding(new AegisDatabinding());
>
>
>
>      EmicroService client = (EmicroService)factory.create();
>
>
>
>        // add 2 employees here, then
>
>
>
>        Map<Integer, Employee> emap = client.getEmployeesMap();
>
>        logger.info(emap);
>
>
>
>        System.exit(0);
>
>    }
>
>
>
> The backend configuration is just following the CXF tutorial
> <bean id="aegisBean" class="
> org.apache.cxf.aegis.databinding.AegisDatabinding" scope="prototype"/>
>
>
>
>      <bean id="jaxws-and-aegis-service-factory"
>
>            class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"
> scope="prototype">
>
>            <property name="dataBinding" ref="aegisBean" />
>
>            <property name="serviceConfigurations">
>
>                  <list>
>
>                        <bean class="
> org.apache.cxf.jaxws.support.JaxWsServiceConfiguration" />
>
>                        <bean class="
> org.apache.cxf.aegis.databinding.AegisServiceConfiguration" />
>
>                        <bean class="
> org.apache.cxf.service.factory.DefaultServiceConfiguration" />
>
>                  </list>
>
>            </property>
>
>      </bean>
>
>
>
>
>
>      <bean id="emicro" class="org.stjude.ri.emicro.ws.EmicroServiceImpl"
> />
>
>
>
>      <jaxws:endpoint id="helloWorld" implementor="#emicro"
> address="/EmicroService">
>
>            <jaxws:serviceFactory>
>
>                  <ref bean='jaxws-and-aegis-service-factory' />
>
>            </jaxws:serviceFactory>
>
>      </jaxws:endpoint>
>
>
>
>
>
> Any advice? Thanks
>
>
>

How to pass a HashMap

Posted by "Li, Weiye" <We...@STJUDE.ORG>.
The CXF document says that Aegis data binding can even works on Map. I tried this, but it always return an empty one. Here's my testing codes. Did I miss something? Or I need to write special config file?




@WebService(name="EmicroManager", targetNamespace="http://test.emicro ")
@SOAPBinding(style=Style.RPC, use=Use.LITERAL, parameterStyle=ParameterStyle.WRAPPED)
public interface EmicroService {
      @WebMethod
      @RequestWrapper(className="test.model.Employee",
                  localName="employee", targetNamespace=" http://test.emicro/types ")
      @Oneway
      public void addEmployee(Employee emp);


      @WebMethod(operationName="getEmployeesAsMap")
      @ResponseWrapper(className="java.util.HashMap",
                  localName="EmployeesMap", targetNamespace="http://test.emicro/types")
      public Map getEmployeesMap();

}





public static void main(String args[]) throws Exception {

      JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();

      factory.setServiceClass(test.EmicroService.class);

      factory.setAddress("http://localhost:9080/emicro-ws/EmicroService");

      factory.getServiceFactory().setDataBinding(new AegisDatabinding());



      EmicroService client = (EmicroService)factory.create();



        // add 2 employees here, then



        Map<Integer, Employee> emap = client.getEmployeesMap();

        logger.info(emap);



        System.exit(0);

    }



The backend configuration is just following the CXF tutorial
<bean id="aegisBean" class="org.apache.cxf.aegis.databinding.AegisDatabinding" scope="prototype"/>



      <bean id="jaxws-and-aegis-service-factory"

            class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean" scope="prototype">

            <property name="dataBinding" ref="aegisBean" />

            <property name="serviceConfigurations">

                  <list>

                        <bean class="org.apache.cxf.jaxws.support.JaxWsServiceConfiguration" />

                        <bean class="org.apache.cxf.aegis.databinding.AegisServiceConfiguration" />

                        <bean class="org.apache.cxf.service.factory.DefaultServiceConfiguration" />

                  </list>

            </property>

      </bean>





      <bean id="emicro" class="org.stjude.ri.emicro.ws.EmicroServiceImpl" />



      <jaxws:endpoint id="helloWorld" implementor="#emicro" address="/EmicroService">

            <jaxws:serviceFactory>

                  <ref bean='jaxws-and-aegis-service-factory' />

            </jaxws:serviceFactory>

      </jaxws:endpoint>





Any advice? Thanks