You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by imorales <im...@ignos.com> on 2007/10/16 11:19:52 UTC

MTOM and @XmlMimeType("application/octet-stream") annotation.

Hi all.

I´m trying to implemente a web service that uses MTOM Attachments. The way
I´m doing is "Annotation if JAXB bean". The problem is that the wsdl that I
generate with ant task "java2wsdl" doesn´t add the annotation
@XmlMimeType("application/octet-stream") in the <wsdl:types>. 

My bean is:
----------------------------------------------------------------------------
@XmlType
public class FicheroXML {

	private String title;

	@XmlMimeType("application/octet-stream")
	private DataHandler xmlData;

	public String getTitle() {return title;	}
	public void setTitle(String title) {this.title = title;	}
	@XmlTransient public DataHandler getXmlData() {	return xmlData;}
	public void setXmlData(DataHandler xmlData) {this.xmlData = xmlData;}
}
----------------------------------------------------------------------------

My service is:
----------------------------------------------------------------------------
@WebService
public interface ServicioFormularios {
	@WebResult(name="uuid") 
	String guardaFormulario(@WebParam(name="xml")FicheroXML xml);
}
----------------------------------------------------------------------------


My cxf configuration is:
----------------------------------------------------------------------------
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:jaxws="http://cxf.apache.org/jaxws"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">

 <import resource="classpath:META-INF/cxf/cxf.xml"/>
 <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
 <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
 
<jaxws:endpoint 
  id="servicioFormulario" 
  implementor="com.servicios.ServicioFormulariosImpl" 
  address="/servicioFormulario">  
  <jaxws:properties>
      <entry key="mtom-enabled" value="true"/>
  </jaxws:properties>
</jaxws:endpoint>
</beans>
----------------------------------------------------------------------------

The wsdl generated whit java2wsdl:
----------------------------------------------------------------------------
.
..
...
<xs:complexType name="ficheroXML">
<xs:sequence>
<xs:element minOccurs="0" name="xmlData" type="xs:base64Binary"/>
<xs:element minOccurs="0" name="title" type="xs:string"/>
</xs:sequence>
</xs:complexType>
...
..
.
<xs:complexType name="guardaFormulario">
<xs:sequence>
<xs:element minOccurs="0" name="xml" type="ficheroXML"/>
</xs:sequence>
</xs:complexType>
...
..
.
----------------------------------------------------------------------------

Why the attribute (xmime:expectedContentTypes="application/octet-stream")
isn´t in the "xmlData" element of "FicheroXML" ?

Any ideas ...  it seam like the annotation @XmlMimeType it´s not running.

Thanks in advance.

-- 
View this message in context: http://www.nabble.com/MTOM-and-%40XmlMimeType%28%22application-octet-stream%22%29-annotation.-tf4632898.html#a13229561
Sent from the cxf-user mailing list archive at Nabble.com.


Re: MTOM and @XmlMimeType("application/octet-stream") annotation.

Posted by pfb <pe...@gmail.com>.
Hi,

¿Anybody could send and example about implementing @RequestHandler and
@ResponseHandler for make @XmlMimeType("application/octet-stream") works
properly?

Thanks


dkulp wrote:
> 
> 
> Just FYI, I've logged a bug for the XmlSchema project:
> 
> http://issues.apache.org/jira/browse/WSCOMMONS-261
> 
> Dan
> 
> 
> On Tuesday 16 October 2007, James Mao wrote:
>> Sorry,
>>
>> False alarm, I'm testing against with the old distribution which not
>> included Dan's fix
>> The java2ws works perfect, I'll commit a test in java2ws soon
>>
>> Cheers,
>> James
>>
>> > Hi Dan,
>> >
>> > Is it fix the java2ws tools as well, or just the runtime?
>> > in the runtime the http header now should contain the
>> > "application/octet-stream", right?
>> >
>> > But I tested with the java2ws, it's not working. the
>> > expectedContentTypes="image/png" still missing in the schema
>> >
>> >
>> > James
>> >
>> >> It's definitely a bug in XmlSchema.   Updating to the latest
>> >> version of XmlSchema helped a little bit, but not enough.   It at
>> >> least attempts to write the extensors.   The problem is the parsing
>> >> only saves the last extensor.    I've worked around that bug by
>> >> writing a Deserializer that actually works correctly so it should
>> >> work now. Just committed the fix to trunk.
>> >>
>> >> Dan
>> >>
>> >> On Tuesday 16 October 2007, Daniel Kulp wrote:
>> >>> OK.   Not a JAXB issue.   Seems to be an XmlSchema issue.   The
>> >>> DOM we feed into XmlSchema contains the contenttype stuff.   If I
>> >>> immediately print the schema, it's gone.   :-(
>> >>>
>> >>> Dan
>> >>>
>> >>> On Tuesday 16 October 2007, Daniel Kulp wrote:
>> >>>> No, this is different.   That thread talks about parameters to
>> >>>> the SEI methods that should be attachments.    In this case, this
>> >>>> is a field inside one of the objects that is a parameter.   This
>> >>>> SHOULD work. We just pass the object class as-is to JAXB so this
>> >>>> seems to be a JAXB issue.
>> >>>>
>> >>>> Dan
>> >>>>
>> >>>> On Tuesday 16 October 2007, Jim Ma wrote:
>> >>>>> This is not supported in CXF .
>> >>>>> This thread FYI:
>> >>>>> http://www.nabble.com/MTOM-sample-generated-WSDL-with-DataHandle
>> >>>>>r- on -s erver-t4210895.html
>> >>>>>
>> >>>>> imorales wrote:
>> >>>>>> Hi all.
>> >>>>>>
>> >>>>>> I´m trying to implemente a web service that uses MTOM
>> >>>>>> Attachments. The way I´m doing is "Annotation if JAXB bean".
>> >>>>>> The problem is that the wsdl that I generate with ant task
>> >>>>>> "java2wsdl" doesn´t add the annotation
>> >>>>>> @XmlMimeType("application/octet-stream") in the <wsdl:types>.
>> >>>>>>
>> >>>>>> My bean is:
>> >>>>>> ---------------------------------------------------------------
>> >>>>>>- -- -- -------- @XmlType
>> >>>>>> public class FicheroXML {
>> >>>>>>
>> >>>>>>     private String title;
>> >>>>>>
>> >>>>>>     @XmlMimeType("application/octet-stream")
>> >>>>>>     private DataHandler xmlData;
>> >>>>>>
>> >>>>>>     public String getTitle() {return title;    }
>> >>>>>>     public void setTitle(String title) {this.title = title;   
>> >>>>>> } @XmlTransient public DataHandler getXmlData() {    return
>> >>>>>> xmlData;} public void setXmlData(DataHandler xmlData)
>> >>>>>> {this.xmlData = xmlData;} }
>> >>>>>> ---------------------------------------------------------------
>> >>>>>>- -- -- --------
>> >>>>>>
>> >>>>>> My service is:
>> >>>>>> ---------------------------------------------------------------
>> >>>>>>- -- -- -------- @WebService
>> >>>>>> public interface ServicioFormularios {
>> >>>>>>     @WebResult(name="uuid")
>> >>>>>>     String guardaFormulario(@WebParam(name="xml")FicheroXML
>> >>>>>> xml); }
>> >>>>>> ---------------------------------------------------------------
>> >>>>>>- -- -- --------
>> >>>>>>
>> >>>>>>
>> >>>>>> My cxf configuration is:
>> >>>>>> ---------------------------------------------------------------
>> >>>>>>- -- -- -------- <beans
>> >>>>>> xmlns="http://www.springframework.org/schema/beans"
>> >>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> >>>>>>     xmlns:jaxws="http://cxf.apache.org/jaxws"
>> >>>>>>    
>> >>>>>> xsi:schemaLocation="http://www.springframework.org/schema/beans
>> >>>>>> http://www.springframework.org/schema/beans/spring-beans-2.0.xs
>> >>>>>>d http://cxf.apache.org/jaxws
>> >>>>>> http://cxf.apache.org/schemas/jaxws.xsd">
>> >>>>>>
>> >>>>>>  <import resource="classpath:META-INF/cxf/cxf.xml"/>
>> >>>>>>  <import
>> >>>>>> resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
>> >>>>>> <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
>> >>>>>>
>> >>>>>> <jaxws:endpoint
>> >>>>>>   id="servicioFormulario"
>> >>>>>>   implementor="com.servicios.ServicioFormulariosImpl"
>> >>>>>>   address="/servicioFormulario">
>> >>>>>>   <jaxws:properties>
>> >>>>>>       <entry key="mtom-enabled" value="true"/>
>> >>>>>>   </jaxws:properties>
>> >>>>>> </jaxws:endpoint>
>> >>>>>> </beans>
>> >>>>>> ---------------------------------------------------------------
>> >>>>>>- -- -- --------
>> >>>>>>
>> >>>>>> The wsdl generated whit java2wsdl:
>> >>>>>> ---------------------------------------------------------------
>> >>>>>>- -- -- -------- .
>> >>>>>> ..
>> >>>>>> ...
>> >>>>>> <xs:complexType name="ficheroXML">
>> >>>>>> <xs:sequence>
>> >>>>>> <xs:element minOccurs="0" name="xmlData"
>> >>>>>> type="xs:base64Binary"/> <xs:element minOccurs="0" name="title"
>> >>>>>> type="xs:string"/> </xs:sequence>
>> >>>>>> </xs:complexType>
>> >>>>>> ...
>> >>>>>> ..
>> >>>>>> .
>> >>>>>> <xs:complexType name="guardaFormulario">
>> >>>>>> <xs:sequence>
>> >>>>>> <xs:element minOccurs="0" name="xml" type="ficheroXML"/>
>> >>>>>> </xs:sequence>
>> >>>>>> </xs:complexType>
>> >>>>>> ...
>> >>>>>> ..
>> >>>>>> .
>> >>>>>> ---------------------------------------------------------------
>> >>>>>>- -- -- --------
>> >>>>>>
>> >>>>>> Why the attribute
>> >>>>>> (xmime:expectedContentTypes="application/octet-stream") isn´t
>> >>>>>> in the "xmlData" element of "FicheroXML" ?
>> >>>>>>
>> >>>>>> Any ideas ...  it seam like the annotation @XmlMimeType it´s
>> >>>>>> not running.
>> >>>>>>
>> >>>>>> Thanks in advance.
> 
> 
> 
> -- 
> J. Daniel Kulp
> Principal Engineer
> IONA
> P: 781-902-8727    C: 508-380-7194
> daniel.kulp@iona.com
> http://www.dankulp.com/blog
> 
> 

-- 
View this message in context: http://www.nabble.com/MTOM-and-%40XmlMimeType%28%22application-octet-stream%22%29-annotation.-tf4632898.html#a13310886
Sent from the cxf-user mailing list archive at Nabble.com.


Re: MTOM and @XmlMimeType("application/octet-stream") annotation.

Posted by Daniel Kulp <dk...@apache.org>.
Just FYI, I've logged a bug for the XmlSchema project:

http://issues.apache.org/jira/browse/WSCOMMONS-261

Dan


On Tuesday 16 October 2007, James Mao wrote:
> Sorry,
>
> False alarm, I'm testing against with the old distribution which not
> included Dan's fix
> The java2ws works perfect, I'll commit a test in java2ws soon
>
> Cheers,
> James
>
> > Hi Dan,
> >
> > Is it fix the java2ws tools as well, or just the runtime?
> > in the runtime the http header now should contain the
> > "application/octet-stream", right?
> >
> > But I tested with the java2ws, it's not working. the
> > expectedContentTypes="image/png" still missing in the schema
> >
> >
> > James
> >
> >> It's definitely a bug in XmlSchema.   Updating to the latest
> >> version of XmlSchema helped a little bit, but not enough.   It at
> >> least attempts to write the extensors.   The problem is the parsing
> >> only saves the last extensor.    I've worked around that bug by
> >> writing a Deserializer that actually works correctly so it should
> >> work now. Just committed the fix to trunk.
> >>
> >> Dan
> >>
> >> On Tuesday 16 October 2007, Daniel Kulp wrote:
> >>> OK.   Not a JAXB issue.   Seems to be an XmlSchema issue.   The
> >>> DOM we feed into XmlSchema contains the contenttype stuff.   If I
> >>> immediately print the schema, it's gone.   :-(
> >>>
> >>> Dan
> >>>
> >>> On Tuesday 16 October 2007, Daniel Kulp wrote:
> >>>> No, this is different.   That thread talks about parameters to
> >>>> the SEI methods that should be attachments.    In this case, this
> >>>> is a field inside one of the objects that is a parameter.   This
> >>>> SHOULD work. We just pass the object class as-is to JAXB so this
> >>>> seems to be a JAXB issue.
> >>>>
> >>>> Dan
> >>>>
> >>>> On Tuesday 16 October 2007, Jim Ma wrote:
> >>>>> This is not supported in CXF .
> >>>>> This thread FYI:
> >>>>> http://www.nabble.com/MTOM-sample-generated-WSDL-with-DataHandle
> >>>>>r- on -s erver-t4210895.html
> >>>>>
> >>>>> imorales wrote:
> >>>>>> Hi all.
> >>>>>>
> >>>>>> I´m trying to implemente a web service that uses MTOM
> >>>>>> Attachments. The way I´m doing is "Annotation if JAXB bean".
> >>>>>> The problem is that the wsdl that I generate with ant task
> >>>>>> "java2wsdl" doesn´t add the annotation
> >>>>>> @XmlMimeType("application/octet-stream") in the <wsdl:types>.
> >>>>>>
> >>>>>> My bean is:
> >>>>>> ---------------------------------------------------------------
> >>>>>>- -- -- -------- @XmlType
> >>>>>> public class FicheroXML {
> >>>>>>
> >>>>>>     private String title;
> >>>>>>
> >>>>>>     @XmlMimeType("application/octet-stream")
> >>>>>>     private DataHandler xmlData;
> >>>>>>
> >>>>>>     public String getTitle() {return title;    }
> >>>>>>     public void setTitle(String title) {this.title = title;   
> >>>>>> } @XmlTransient public DataHandler getXmlData() {    return
> >>>>>> xmlData;} public void setXmlData(DataHandler xmlData)
> >>>>>> {this.xmlData = xmlData;} }
> >>>>>> ---------------------------------------------------------------
> >>>>>>- -- -- --------
> >>>>>>
> >>>>>> My service is:
> >>>>>> ---------------------------------------------------------------
> >>>>>>- -- -- -------- @WebService
> >>>>>> public interface ServicioFormularios {
> >>>>>>     @WebResult(name="uuid")
> >>>>>>     String guardaFormulario(@WebParam(name="xml")FicheroXML
> >>>>>> xml); }
> >>>>>> ---------------------------------------------------------------
> >>>>>>- -- -- --------
> >>>>>>
> >>>>>>
> >>>>>> My cxf configuration is:
> >>>>>> ---------------------------------------------------------------
> >>>>>>- -- -- -------- <beans
> >>>>>> xmlns="http://www.springframework.org/schema/beans"
> >>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >>>>>>     xmlns:jaxws="http://cxf.apache.org/jaxws"
> >>>>>>    
> >>>>>> xsi:schemaLocation="http://www.springframework.org/schema/beans
> >>>>>> http://www.springframework.org/schema/beans/spring-beans-2.0.xs
> >>>>>>d http://cxf.apache.org/jaxws
> >>>>>> http://cxf.apache.org/schemas/jaxws.xsd">
> >>>>>>
> >>>>>>  <import resource="classpath:META-INF/cxf/cxf.xml"/>
> >>>>>>  <import
> >>>>>> resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
> >>>>>> <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
> >>>>>>
> >>>>>> <jaxws:endpoint
> >>>>>>   id="servicioFormulario"
> >>>>>>   implementor="com.servicios.ServicioFormulariosImpl"
> >>>>>>   address="/servicioFormulario">
> >>>>>>   <jaxws:properties>
> >>>>>>       <entry key="mtom-enabled" value="true"/>
> >>>>>>   </jaxws:properties>
> >>>>>> </jaxws:endpoint>
> >>>>>> </beans>
> >>>>>> ---------------------------------------------------------------
> >>>>>>- -- -- --------
> >>>>>>
> >>>>>> The wsdl generated whit java2wsdl:
> >>>>>> ---------------------------------------------------------------
> >>>>>>- -- -- -------- .
> >>>>>> ..
> >>>>>> ...
> >>>>>> <xs:complexType name="ficheroXML">
> >>>>>> <xs:sequence>
> >>>>>> <xs:element minOccurs="0" name="xmlData"
> >>>>>> type="xs:base64Binary"/> <xs:element minOccurs="0" name="title"
> >>>>>> type="xs:string"/> </xs:sequence>
> >>>>>> </xs:complexType>
> >>>>>> ...
> >>>>>> ..
> >>>>>> .
> >>>>>> <xs:complexType name="guardaFormulario">
> >>>>>> <xs:sequence>
> >>>>>> <xs:element minOccurs="0" name="xml" type="ficheroXML"/>
> >>>>>> </xs:sequence>
> >>>>>> </xs:complexType>
> >>>>>> ...
> >>>>>> ..
> >>>>>> .
> >>>>>> ---------------------------------------------------------------
> >>>>>>- -- -- --------
> >>>>>>
> >>>>>> Why the attribute
> >>>>>> (xmime:expectedContentTypes="application/octet-stream") isn´t
> >>>>>> in the "xmlData" element of "FicheroXML" ?
> >>>>>>
> >>>>>> Any ideas ...  it seam like the annotation @XmlMimeType it´s
> >>>>>> not running.
> >>>>>>
> >>>>>> Thanks in advance.



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Re: MTOM and @XmlMimeType("application/octet-stream") annotation.

Posted by James Mao <ja...@iona.com>.
Sorry,

False alarm, I'm testing against with the old distribution which not 
included Dan's fix
The java2ws works perfect, I'll commit a test in java2ws soon

Cheers,
James

> Hi Dan,
>
> Is it fix the java2ws tools as well, or just the runtime?
> in the runtime the http header now should contain the 
> "application/octet-stream", right?
>
> But I tested with the java2ws, it's not working. the 
> expectedContentTypes="image/png" still missing in the schema
>
>
> James
>
>> It's definitely a bug in XmlSchema.   Updating to the latest version 
>> of XmlSchema helped a little bit, but not enough.   It at least 
>> attempts to write the extensors.   The problem is the parsing only 
>> saves the last extensor.    I've worked around that bug by writing a 
>> Deserializer that actually works correctly so it should work now.   
>> Just committed the fix to trunk.
>>
>> Dan
>>
>> On Tuesday 16 October 2007, Daniel Kulp wrote:
>>  
>>> OK.   Not a JAXB issue.   Seems to be an XmlSchema issue.   The DOM we
>>> feed into XmlSchema contains the contenttype stuff.   If I immediately
>>> print the schema, it's gone.   :-(
>>>
>>> Dan
>>>
>>> On Tuesday 16 October 2007, Daniel Kulp wrote:
>>>    
>>>> No, this is different.   That thread talks about parameters to the
>>>> SEI methods that should be attachments.    In this case, this is a
>>>> field inside one of the objects that is a parameter.   This SHOULD
>>>> work. We just pass the object class as-is to JAXB so this seems to
>>>> be a JAXB issue.
>>>>
>>>> Dan
>>>>
>>>> On Tuesday 16 October 2007, Jim Ma wrote:
>>>>      
>>>>> This is not supported in CXF .
>>>>> This thread FYI:
>>>>> http://www.nabble.com/MTOM-sample-generated-WSDL-with-DataHandler-
>>>>> on -s erver-t4210895.html
>>>>>
>>>>> imorales wrote:
>>>>>        
>>>>>> Hi all.
>>>>>>
>>>>>> I´m trying to implemente a web service that uses MTOM
>>>>>> Attachments. The way I´m doing is "Annotation if JAXB bean". The
>>>>>> problem is that the wsdl that I generate with ant task
>>>>>> "java2wsdl" doesn´t add the annotation
>>>>>> @XmlMimeType("application/octet-stream") in the <wsdl:types>.
>>>>>>
>>>>>> My bean is:
>>>>>> ----------------------------------------------------------------
>>>>>> -- -- -------- @XmlType
>>>>>> public class FicheroXML {
>>>>>>
>>>>>>     private String title;
>>>>>>
>>>>>>     @XmlMimeType("application/octet-stream")
>>>>>>     private DataHandler xmlData;
>>>>>>
>>>>>>     public String getTitle() {return title;    }
>>>>>>     public void setTitle(String title) {this.title = title;    }
>>>>>>     @XmlTransient public DataHandler getXmlData() {    return
>>>>>> xmlData;} public void setXmlData(DataHandler xmlData)
>>>>>> {this.xmlData = xmlData;} }
>>>>>> ----------------------------------------------------------------
>>>>>> -- -- --------
>>>>>>
>>>>>> My service is:
>>>>>> ----------------------------------------------------------------
>>>>>> -- -- -------- @WebService
>>>>>> public interface ServicioFormularios {
>>>>>>     @WebResult(name="uuid")
>>>>>>     String guardaFormulario(@WebParam(name="xml")FicheroXML xml);
>>>>>> }
>>>>>> ----------------------------------------------------------------
>>>>>> -- -- --------
>>>>>>
>>>>>>
>>>>>> My cxf configuration is:
>>>>>> ----------------------------------------------------------------
>>>>>> -- -- -------- <beans
>>>>>> xmlns="http://www.springframework.org/schema/beans"
>>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>>>     xmlns:jaxws="http://cxf.apache.org/jaxws"
>>>>>>     xsi:schemaLocation="http://www.springframework.org/schema/beans
>>>>>> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>>>>>> http://cxf.apache.org/jaxws
>>>>>> http://cxf.apache.org/schemas/jaxws.xsd">
>>>>>>
>>>>>>  <import resource="classpath:META-INF/cxf/cxf.xml"/>
>>>>>>  <import
>>>>>> resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
>>>>>> <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
>>>>>>
>>>>>> <jaxws:endpoint
>>>>>>   id="servicioFormulario"
>>>>>>   implementor="com.servicios.ServicioFormulariosImpl"
>>>>>>   address="/servicioFormulario">
>>>>>>   <jaxws:properties>
>>>>>>       <entry key="mtom-enabled" value="true"/>
>>>>>>   </jaxws:properties>
>>>>>> </jaxws:endpoint>
>>>>>> </beans>
>>>>>> ----------------------------------------------------------------
>>>>>> -- -- --------
>>>>>>
>>>>>> The wsdl generated whit java2wsdl:
>>>>>> ----------------------------------------------------------------
>>>>>> -- -- -------- .
>>>>>> ..
>>>>>> ...
>>>>>> <xs:complexType name="ficheroXML">
>>>>>> <xs:sequence>
>>>>>> <xs:element minOccurs="0" name="xmlData"
>>>>>> type="xs:base64Binary"/> <xs:element minOccurs="0" name="title"
>>>>>> type="xs:string"/> </xs:sequence>
>>>>>> </xs:complexType>
>>>>>> ...
>>>>>> ..
>>>>>> .
>>>>>> <xs:complexType name="guardaFormulario">
>>>>>> <xs:sequence>
>>>>>> <xs:element minOccurs="0" name="xml" type="ficheroXML"/>
>>>>>> </xs:sequence>
>>>>>> </xs:complexType>
>>>>>> ...
>>>>>> ..
>>>>>> .
>>>>>> ----------------------------------------------------------------
>>>>>> -- -- --------
>>>>>>
>>>>>> Why the attribute
>>>>>> (xmime:expectedContentTypes="application/octet-stream") isn´t in
>>>>>> the "xmlData" element of "FicheroXML" ?
>>>>>>
>>>>>> Any ideas ...  it seam like the annotation @XmlMimeType it´s not
>>>>>> running.
>>>>>>
>>>>>> Thanks in advance.
>>>>>>           
>>
>>
>>
>>   
>

Re: MTOM and @XmlMimeType("application/octet-stream") annotation.

Posted by James Mao <ja...@iona.com>.
Hi Dan,

Is it fix the java2ws tools as well, or just the runtime?
in the runtime the http header now should contain the 
"application/octet-stream", right?

But I tested with the java2ws, it's not working. the 
expectedContentTypes="image/png" still missing in the schema


James

> It's definitely a bug in XmlSchema.   Updating to the latest version of 
> XmlSchema helped a little bit, but not enough.   It at least attempts to 
> write the extensors.   The problem is the parsing only saves the last 
> extensor.    I've worked around that bug by writing a Deserializer that 
> actually works correctly so it should work now.   Just committed the fix 
> to trunk.
>
> Dan
>
> On Tuesday 16 October 2007, Daniel Kulp wrote:
>   
>> OK.   Not a JAXB issue.   Seems to be an XmlSchema issue.   The DOM we
>> feed into XmlSchema contains the contenttype stuff.   If I immediately
>> print the schema, it's gone.   :-(
>>
>> Dan
>>
>> On Tuesday 16 October 2007, Daniel Kulp wrote:
>>     
>>> No, this is different.   That thread talks about parameters to the
>>> SEI methods that should be attachments.    In this case, this is a
>>> field inside one of the objects that is a parameter.   This SHOULD
>>> work. We just pass the object class as-is to JAXB so this seems to
>>> be a JAXB issue.
>>>
>>> Dan
>>>
>>> On Tuesday 16 October 2007, Jim Ma wrote:
>>>       
>>>> This is not supported in CXF .
>>>> This thread FYI:
>>>> http://www.nabble.com/MTOM-sample-generated-WSDL-with-DataHandler-
>>>> on -s erver-t4210895.html
>>>>
>>>> imorales wrote:
>>>>         
>>>>> Hi all.
>>>>>
>>>>> I´m trying to implemente a web service that uses MTOM
>>>>> Attachments. The way I´m doing is "Annotation if JAXB bean". The
>>>>> problem is that the wsdl that I generate with ant task
>>>>> "java2wsdl" doesn´t add the annotation
>>>>> @XmlMimeType("application/octet-stream") in the <wsdl:types>.
>>>>>
>>>>> My bean is:
>>>>> ----------------------------------------------------------------
>>>>> -- -- -------- @XmlType
>>>>> public class FicheroXML {
>>>>>
>>>>> 	private String title;
>>>>>
>>>>> 	@XmlMimeType("application/octet-stream")
>>>>> 	private DataHandler xmlData;
>>>>>
>>>>> 	public String getTitle() {return title;	}
>>>>> 	public void setTitle(String title) {this.title = title;	}
>>>>> 	@XmlTransient public DataHandler getXmlData() {	return
>>>>> xmlData;} public void setXmlData(DataHandler xmlData)
>>>>> {this.xmlData = xmlData;} }
>>>>> ----------------------------------------------------------------
>>>>> -- -- --------
>>>>>
>>>>> My service is:
>>>>> ----------------------------------------------------------------
>>>>> -- -- -------- @WebService
>>>>> public interface ServicioFormularios {
>>>>> 	@WebResult(name="uuid")
>>>>> 	String guardaFormulario(@WebParam(name="xml")FicheroXML xml);
>>>>> }
>>>>> ----------------------------------------------------------------
>>>>> -- -- --------
>>>>>
>>>>>
>>>>> My cxf configuration is:
>>>>> ----------------------------------------------------------------
>>>>> -- -- -------- <beans
>>>>> xmlns="http://www.springframework.org/schema/beans"
>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
>>>>> 	xsi:schemaLocation="http://www.springframework.org/schema/beans
>>>>> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>>>>> http://cxf.apache.org/jaxws
>>>>> http://cxf.apache.org/schemas/jaxws.xsd">
>>>>>
>>>>>  <import resource="classpath:META-INF/cxf/cxf.xml"/>
>>>>>  <import
>>>>> resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
>>>>> <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
>>>>>
>>>>> <jaxws:endpoint
>>>>>   id="servicioFormulario"
>>>>>   implementor="com.servicios.ServicioFormulariosImpl"
>>>>>   address="/servicioFormulario">
>>>>>   <jaxws:properties>
>>>>>       <entry key="mtom-enabled" value="true"/>
>>>>>   </jaxws:properties>
>>>>> </jaxws:endpoint>
>>>>> </beans>
>>>>> ----------------------------------------------------------------
>>>>> -- -- --------
>>>>>
>>>>> The wsdl generated whit java2wsdl:
>>>>> ----------------------------------------------------------------
>>>>> -- -- -------- .
>>>>> ..
>>>>> ...
>>>>> <xs:complexType name="ficheroXML">
>>>>> <xs:sequence>
>>>>> <xs:element minOccurs="0" name="xmlData"
>>>>> type="xs:base64Binary"/> <xs:element minOccurs="0" name="title"
>>>>> type="xs:string"/> </xs:sequence>
>>>>> </xs:complexType>
>>>>> ...
>>>>> ..
>>>>> .
>>>>> <xs:complexType name="guardaFormulario">
>>>>> <xs:sequence>
>>>>> <xs:element minOccurs="0" name="xml" type="ficheroXML"/>
>>>>> </xs:sequence>
>>>>> </xs:complexType>
>>>>> ...
>>>>> ..
>>>>> .
>>>>> ----------------------------------------------------------------
>>>>> -- -- --------
>>>>>
>>>>> Why the attribute
>>>>> (xmime:expectedContentTypes="application/octet-stream") isn´t in
>>>>> the "xmlData" element of "FicheroXML" ?
>>>>>
>>>>> Any ideas ...  it seam like the annotation @XmlMimeType it´s not
>>>>> running.
>>>>>
>>>>> Thanks in advance.
>>>>>           
>
>
>
>   

Re: MTOM and @XmlMimeType("application/octet-stream") annotation.

Posted by Daniel Kulp <dk...@apache.org>.
It's definitely a bug in XmlSchema.   Updating to the latest version of 
XmlSchema helped a little bit, but not enough.   It at least attempts to 
write the extensors.   The problem is the parsing only saves the last 
extensor.    I've worked around that bug by writing a Deserializer that 
actually works correctly so it should work now.   Just committed the fix 
to trunk.

Dan

On Tuesday 16 October 2007, Daniel Kulp wrote:
> OK.   Not a JAXB issue.   Seems to be an XmlSchema issue.   The DOM we
> feed into XmlSchema contains the contenttype stuff.   If I immediately
> print the schema, it's gone.   :-(
>
> Dan
>
> On Tuesday 16 October 2007, Daniel Kulp wrote:
> > No, this is different.   That thread talks about parameters to the
> > SEI methods that should be attachments.    In this case, this is a
> > field inside one of the objects that is a parameter.   This SHOULD
> > work. We just pass the object class as-is to JAXB so this seems to
> > be a JAXB issue.
> >
> > Dan
> >
> > On Tuesday 16 October 2007, Jim Ma wrote:
> > > This is not supported in CXF .
> > > This thread FYI:
> > > http://www.nabble.com/MTOM-sample-generated-WSDL-with-DataHandler-
> > >on -s erver-t4210895.html
> > >
> > > imorales wrote:
> > > > Hi all.
> > > >
> > > > I´m trying to implemente a web service that uses MTOM
> > > > Attachments. The way I´m doing is "Annotation if JAXB bean". The
> > > > problem is that the wsdl that I generate with ant task
> > > > "java2wsdl" doesn´t add the annotation
> > > > @XmlMimeType("application/octet-stream") in the <wsdl:types>.
> > > >
> > > > My bean is:
> > > > ----------------------------------------------------------------
> > > >-- -- -------- @XmlType
> > > > public class FicheroXML {
> > > >
> > > > 	private String title;
> > > >
> > > > 	@XmlMimeType("application/octet-stream")
> > > > 	private DataHandler xmlData;
> > > >
> > > > 	public String getTitle() {return title;	}
> > > > 	public void setTitle(String title) {this.title = title;	}
> > > > 	@XmlTransient public DataHandler getXmlData() {	return
> > > > xmlData;} public void setXmlData(DataHandler xmlData)
> > > > {this.xmlData = xmlData;} }
> > > > ----------------------------------------------------------------
> > > >-- -- --------
> > > >
> > > > My service is:
> > > > ----------------------------------------------------------------
> > > >-- -- -------- @WebService
> > > > public interface ServicioFormularios {
> > > > 	@WebResult(name="uuid")
> > > > 	String guardaFormulario(@WebParam(name="xml")FicheroXML xml);
> > > > }
> > > > ----------------------------------------------------------------
> > > >-- -- --------
> > > >
> > > >
> > > > My cxf configuration is:
> > > > ----------------------------------------------------------------
> > > >-- -- -------- <beans
> > > > xmlns="http://www.springframework.org/schema/beans"
> > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > > > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> > > > 	xsi:schemaLocation="http://www.springframework.org/schema/beans
> > > > http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> > > > http://cxf.apache.org/jaxws
> > > > http://cxf.apache.org/schemas/jaxws.xsd">
> > > >
> > > >  <import resource="classpath:META-INF/cxf/cxf.xml"/>
> > > >  <import
> > > > resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
> > > > <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
> > > >
> > > > <jaxws:endpoint
> > > >   id="servicioFormulario"
> > > >   implementor="com.servicios.ServicioFormulariosImpl"
> > > >   address="/servicioFormulario">
> > > >   <jaxws:properties>
> > > >       <entry key="mtom-enabled" value="true"/>
> > > >   </jaxws:properties>
> > > > </jaxws:endpoint>
> > > > </beans>
> > > > ----------------------------------------------------------------
> > > >-- -- --------
> > > >
> > > > The wsdl generated whit java2wsdl:
> > > > ----------------------------------------------------------------
> > > >-- -- -------- .
> > > > ..
> > > > ...
> > > > <xs:complexType name="ficheroXML">
> > > > <xs:sequence>
> > > > <xs:element minOccurs="0" name="xmlData"
> > > > type="xs:base64Binary"/> <xs:element minOccurs="0" name="title"
> > > > type="xs:string"/> </xs:sequence>
> > > > </xs:complexType>
> > > > ...
> > > > ..
> > > > .
> > > > <xs:complexType name="guardaFormulario">
> > > > <xs:sequence>
> > > > <xs:element minOccurs="0" name="xml" type="ficheroXML"/>
> > > > </xs:sequence>
> > > > </xs:complexType>
> > > > ...
> > > > ..
> > > > .
> > > > ----------------------------------------------------------------
> > > >-- -- --------
> > > >
> > > > Why the attribute
> > > > (xmime:expectedContentTypes="application/octet-stream") isn´t in
> > > > the "xmlData" element of "FicheroXML" ?
> > > >
> > > > Any ideas ...  it seam like the annotation @XmlMimeType it´s not
> > > > running.
> > > >
> > > > Thanks in advance.



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Re: MTOM and @XmlMimeType("application/octet-stream") annotation.

Posted by Daniel Kulp <dk...@apache.org>.
OK.   Not a JAXB issue.   Seems to be an XmlSchema issue.   The DOM we 
feed into XmlSchema contains the contenttype stuff.   If I immediately 
print the schema, it's gone.   :-(

Dan


On Tuesday 16 October 2007, Daniel Kulp wrote:
> No, this is different.   That thread talks about parameters to the SEI
> methods that should be attachments.    In this case, this is a field
> inside one of the objects that is a parameter.   This SHOULD work.  
> We just pass the object class as-is to JAXB so this seems to be a JAXB
> issue.
>
> Dan
>
> On Tuesday 16 October 2007, Jim Ma wrote:
> > This is not supported in CXF .
> > This thread FYI:
> > http://www.nabble.com/MTOM-sample-generated-WSDL-with-DataHandler-on
> >-s erver-t4210895.html
> >
> > imorales wrote:
> > > Hi all.
> > >
> > > I´m trying to implemente a web service that uses MTOM Attachments.
> > > The way I´m doing is "Annotation if JAXB bean". The problem is
> > > that the wsdl that I generate with ant task "java2wsdl" doesn´t
> > > add the annotation @XmlMimeType("application/octet-stream") in the
> > > <wsdl:types>.
> > >
> > > My bean is:
> > > ------------------------------------------------------------------
> > >-- -------- @XmlType
> > > public class FicheroXML {
> > >
> > > 	private String title;
> > >
> > > 	@XmlMimeType("application/octet-stream")
> > > 	private DataHandler xmlData;
> > >
> > > 	public String getTitle() {return title;	}
> > > 	public void setTitle(String title) {this.title = title;	}
> > > 	@XmlTransient public DataHandler getXmlData() {	return xmlData;}
> > > 	public void setXmlData(DataHandler xmlData) {this.xmlData =
> > > xmlData;} }
> > > ------------------------------------------------------------------
> > >-- --------
> > >
> > > My service is:
> > > ------------------------------------------------------------------
> > >-- -------- @WebService
> > > public interface ServicioFormularios {
> > > 	@WebResult(name="uuid")
> > > 	String guardaFormulario(@WebParam(name="xml")FicheroXML xml);
> > > }
> > > ------------------------------------------------------------------
> > >-- --------
> > >
> > >
> > > My cxf configuration is:
> > > ------------------------------------------------------------------
> > >-- -------- <beans
> > > xmlns="http://www.springframework.org/schema/beans"
> > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> > > 	xsi:schemaLocation="http://www.springframework.org/schema/beans
> > > http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> > > http://cxf.apache.org/jaxws
> > > http://cxf.apache.org/schemas/jaxws.xsd">
> > >
> > >  <import resource="classpath:META-INF/cxf/cxf.xml"/>
> > >  <import
> > > resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/> <import
> > > resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
> > >
> > > <jaxws:endpoint
> > >   id="servicioFormulario"
> > >   implementor="com.servicios.ServicioFormulariosImpl"
> > >   address="/servicioFormulario">
> > >   <jaxws:properties>
> > >       <entry key="mtom-enabled" value="true"/>
> > >   </jaxws:properties>
> > > </jaxws:endpoint>
> > > </beans>
> > > ------------------------------------------------------------------
> > >-- --------
> > >
> > > The wsdl generated whit java2wsdl:
> > > ------------------------------------------------------------------
> > >-- -------- .
> > > ..
> > > ...
> > > <xs:complexType name="ficheroXML">
> > > <xs:sequence>
> > > <xs:element minOccurs="0" name="xmlData" type="xs:base64Binary"/>
> > > <xs:element minOccurs="0" name="title" type="xs:string"/>
> > > </xs:sequence>
> > > </xs:complexType>
> > > ...
> > > ..
> > > .
> > > <xs:complexType name="guardaFormulario">
> > > <xs:sequence>
> > > <xs:element minOccurs="0" name="xml" type="ficheroXML"/>
> > > </xs:sequence>
> > > </xs:complexType>
> > > ...
> > > ..
> > > .
> > > ------------------------------------------------------------------
> > >-- --------
> > >
> > > Why the attribute
> > > (xmime:expectedContentTypes="application/octet-stream") isn´t in
> > > the "xmlData" element of "FicheroXML" ?
> > >
> > > Any ideas ...  it seam like the annotation @XmlMimeType it´s not
> > > running.
> > >
> > > Thanks in advance.



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Re: MTOM and @XmlMimeType("application/octet-stream") annotation.

Posted by Daniel Kulp <dk...@apache.org>.
No, this is different.   That thread talks about parameters to the SEI 
methods that should be attachments.    In this case, this is a field 
inside one of the objects that is a parameter.   This SHOULD work.   We 
just pass the object class as-is to JAXB so this seems to be a JAXB 
issue.

Dan



On Tuesday 16 October 2007, Jim Ma wrote:
> This is not supported in CXF .
> This thread FYI:
> http://www.nabble.com/MTOM-sample-generated-WSDL-with-DataHandler-on-s
>erver-t4210895.html
>
> imorales wrote:
> > Hi all.
> >
> > I´m trying to implemente a web service that uses MTOM Attachments.
> > The way I´m doing is "Annotation if JAXB bean". The problem is that
> > the wsdl that I generate with ant task "java2wsdl" doesn´t add the
> > annotation @XmlMimeType("application/octet-stream") in the
> > <wsdl:types>.
> >
> > My bean is:
> > --------------------------------------------------------------------
> >-------- @XmlType
> > public class FicheroXML {
> >
> > 	private String title;
> >
> > 	@XmlMimeType("application/octet-stream")
> > 	private DataHandler xmlData;
> >
> > 	public String getTitle() {return title;	}
> > 	public void setTitle(String title) {this.title = title;	}
> > 	@XmlTransient public DataHandler getXmlData() {	return xmlData;}
> > 	public void setXmlData(DataHandler xmlData) {this.xmlData =
> > xmlData;} }
> > --------------------------------------------------------------------
> >--------
> >
> > My service is:
> > --------------------------------------------------------------------
> >-------- @WebService
> > public interface ServicioFormularios {
> > 	@WebResult(name="uuid")
> > 	String guardaFormulario(@WebParam(name="xml")FicheroXML xml);
> > }
> > --------------------------------------------------------------------
> >--------
> >
> >
> > My cxf configuration is:
> > --------------------------------------------------------------------
> >-------- <beans xmlns="http://www.springframework.org/schema/beans"
> > 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> > 	xsi:schemaLocation="http://www.springframework.org/schema/beans
> > http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> > http://cxf.apache.org/jaxws
> > http://cxf.apache.org/schemas/jaxws.xsd">
> >
> >  <import resource="classpath:META-INF/cxf/cxf.xml"/>
> >  <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
> >  <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
> >
> > <jaxws:endpoint
> >   id="servicioFormulario"
> >   implementor="com.servicios.ServicioFormulariosImpl"
> >   address="/servicioFormulario">
> >   <jaxws:properties>
> >       <entry key="mtom-enabled" value="true"/>
> >   </jaxws:properties>
> > </jaxws:endpoint>
> > </beans>
> > --------------------------------------------------------------------
> >--------
> >
> > The wsdl generated whit java2wsdl:
> > --------------------------------------------------------------------
> >-------- .
> > ..
> > ...
> > <xs:complexType name="ficheroXML">
> > <xs:sequence>
> > <xs:element minOccurs="0" name="xmlData" type="xs:base64Binary"/>
> > <xs:element minOccurs="0" name="title" type="xs:string"/>
> > </xs:sequence>
> > </xs:complexType>
> > ...
> > ..
> > .
> > <xs:complexType name="guardaFormulario">
> > <xs:sequence>
> > <xs:element minOccurs="0" name="xml" type="ficheroXML"/>
> > </xs:sequence>
> > </xs:complexType>
> > ...
> > ..
> > .
> > --------------------------------------------------------------------
> >--------
> >
> > Why the attribute
> > (xmime:expectedContentTypes="application/octet-stream") isn´t in the
> > "xmlData" element of "FicheroXML" ?
> >
> > Any ideas ...  it seam like the annotation @XmlMimeType it´s not
> > running.
> >
> > Thanks in advance.



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Re: MTOM and @XmlMimeType("application/octet-stream") annotation.

Posted by imorales <im...@ignos.com>.
Thanks guys... I will try ty implement the wrappers

Jim Ma-3 wrote:
> 
> This is not supported in CXF .
> This thread FYI: 
> http://www.nabble.com/MTOM-sample-generated-WSDL-with-DataHandler-on-server-t4210895.html
> 
> imorales wrote:
>> Hi all.
>>
>> I´m trying to implemente a web service that uses MTOM Attachments. The
>> way
>> I´m doing is "Annotation if JAXB bean". The problem is that the wsdl that
>> I
>> generate with ant task "java2wsdl" doesn´t add the annotation
>> @XmlMimeType("application/octet-stream") in the <wsdl:types>. 
>>
>> My bean is:
>> ----------------------------------------------------------------------------
>> @XmlType
>> public class FicheroXML {
>>
>> 	private String title;
>>
>> 	@XmlMimeType("application/octet-stream")
>> 	private DataHandler xmlData;
>>
>> 	public String getTitle() {return title;	}
>> 	public void setTitle(String title) {this.title = title;	}
>> 	@XmlTransient public DataHandler getXmlData() {	return xmlData;}
>> 	public void setXmlData(DataHandler xmlData) {this.xmlData = xmlData;}
>> }
>> ----------------------------------------------------------------------------
>>
>> My service is:
>> ----------------------------------------------------------------------------
>> @WebService
>> public interface ServicioFormularios {
>> 	@WebResult(name="uuid") 
>> 	String guardaFormulario(@WebParam(name="xml")FicheroXML xml);
>> }
>> ----------------------------------------------------------------------------
>>
>>
>> My cxf configuration is:
>> ----------------------------------------------------------------------------
>> <beans xmlns="http://www.springframework.org/schema/beans"
>> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
>> 	xsi:schemaLocation="http://www.springframework.org/schema/beans
>> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
>>
>>  <import resource="classpath:META-INF/cxf/cxf.xml"/>
>>  <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
>>  <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
>>  
>> <jaxws:endpoint 
>>   id="servicioFormulario" 
>>   implementor="com.servicios.ServicioFormulariosImpl" 
>>   address="/servicioFormulario">  
>>   <jaxws:properties>
>>       <entry key="mtom-enabled" value="true"/>
>>   </jaxws:properties>
>> </jaxws:endpoint>
>> </beans>
>> ----------------------------------------------------------------------------
>>
>> The wsdl generated whit java2wsdl:
>> ----------------------------------------------------------------------------
>> .
>> ..
>> ...
>> <xs:complexType name="ficheroXML">
>> <xs:sequence>
>> <xs:element minOccurs="0" name="xmlData" type="xs:base64Binary"/>
>> <xs:element minOccurs="0" name="title" type="xs:string"/>
>> </xs:sequence>
>> </xs:complexType>
>> ...
>> ..
>> .
>> <xs:complexType name="guardaFormulario">
>> <xs:sequence>
>> <xs:element minOccurs="0" name="xml" type="ficheroXML"/>
>> </xs:sequence>
>> </xs:complexType>
>> ...
>> ..
>> .
>> ----------------------------------------------------------------------------
>>
>> Why the attribute (xmime:expectedContentTypes="application/octet-stream")
>> isn´t in the "xmlData" element of "FicheroXML" ?
>>
>> Any ideas ...  it seam like the annotation @XmlMimeType it´s not running.
>>
>> Thanks in advance.
>>
>>   
> 
> 

-- 
View this message in context: http://www.nabble.com/MTOM-and-%40XmlMimeType%28%22application-octet-stream%22%29-annotation.-tf4632898.html#a13230900
Sent from the cxf-user mailing list archive at Nabble.com.


Re: MTOM and @XmlMimeType("application/octet-stream") annotation.

Posted by Jim Ma <em...@iona.com>.
This is not supported in CXF .
This thread FYI: 
http://www.nabble.com/MTOM-sample-generated-WSDL-with-DataHandler-on-server-t4210895.html

imorales wrote:
> Hi all.
>
> I´m trying to implemente a web service that uses MTOM Attachments. The way
> I´m doing is "Annotation if JAXB bean". The problem is that the wsdl that I
> generate with ant task "java2wsdl" doesn´t add the annotation
> @XmlMimeType("application/octet-stream") in the <wsdl:types>. 
>
> My bean is:
> ----------------------------------------------------------------------------
> @XmlType
> public class FicheroXML {
>
> 	private String title;
>
> 	@XmlMimeType("application/octet-stream")
> 	private DataHandler xmlData;
>
> 	public String getTitle() {return title;	}
> 	public void setTitle(String title) {this.title = title;	}
> 	@XmlTransient public DataHandler getXmlData() {	return xmlData;}
> 	public void setXmlData(DataHandler xmlData) {this.xmlData = xmlData;}
> }
> ----------------------------------------------------------------------------
>
> My service is:
> ----------------------------------------------------------------------------
> @WebService
> public interface ServicioFormularios {
> 	@WebResult(name="uuid") 
> 	String guardaFormulario(@WebParam(name="xml")FicheroXML xml);
> }
> ----------------------------------------------------------------------------
>
>
> My cxf configuration is:
> ----------------------------------------------------------------------------
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
>
>  <import resource="classpath:META-INF/cxf/cxf.xml"/>
>  <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
>  <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
>  
> <jaxws:endpoint 
>   id="servicioFormulario" 
>   implementor="com.servicios.ServicioFormulariosImpl" 
>   address="/servicioFormulario">  
>   <jaxws:properties>
>       <entry key="mtom-enabled" value="true"/>
>   </jaxws:properties>
> </jaxws:endpoint>
> </beans>
> ----------------------------------------------------------------------------
>
> The wsdl generated whit java2wsdl:
> ----------------------------------------------------------------------------
> .
> ..
> ...
> <xs:complexType name="ficheroXML">
> <xs:sequence>
> <xs:element minOccurs="0" name="xmlData" type="xs:base64Binary"/>
> <xs:element minOccurs="0" name="title" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> ...
> ..
> .
> <xs:complexType name="guardaFormulario">
> <xs:sequence>
> <xs:element minOccurs="0" name="xml" type="ficheroXML"/>
> </xs:sequence>
> </xs:complexType>
> ...
> ..
> .
> ----------------------------------------------------------------------------
>
> Why the attribute (xmime:expectedContentTypes="application/octet-stream")
> isn´t in the "xmlData" element of "FicheroXML" ?
>
> Any ideas ...  it seam like the annotation @XmlMimeType it´s not running.
>
> Thanks in advance.
>
>   

Re: MTOM and @XmlMimeType("application/octet-stream") annotation.

Posted by imorales <im...@ignos.com>.
I´m trying to implement the @RequestWrapper. My method returns a String and
takes a class "FicheroXML" like a parameter, should I only implement the
@RequestWrapper ?, in that case...What methods should have the class ?  is
there any examples about @RequestWrapper implementions....

Thanks in advance.


Freeman Fang-2 wrote:
> 
> Hi,
> As per the discussion [1], you need use @RequestWrapper/@ResponseWrapper 
> to point to your wrapper bean FicheroXML in your SEI class.
> 
> [1] 
> http://www.nabble.com/MTOM-sample-generated-WSDL-with-DataHandler-on-server-t4210895.html
> 
> Best Regards
> 
> Freeman
> 
> 
> imorales wrote:
>> Hi all.
>>
>> I´m trying to implemente a web service that uses MTOM Attachments. The
>> way
>> I´m doing is "Annotation if JAXB bean". The problem is that the wsdl that
>> I
>> generate with ant task "java2wsdl" doesn´t add the annotation
>> @XmlMimeType("application/octet-stream") in the <wsdl:types>. 
>>
>> My bean is:
>> ----------------------------------------------------------------------------
>> @XmlType
>> public class FicheroXML {
>>
>> 	private String title;
>>
>> 	@XmlMimeType("application/octet-stream")
>> 	private DataHandler xmlData;
>>
>> 	public String getTitle() {return title;	}
>> 	public void setTitle(String title) {this.title = title;	}
>> 	@XmlTransient public DataHandler getXmlData() {	return xmlData;}
>> 	public void setXmlData(DataHandler xmlData) {this.xmlData = xmlData;}
>> }
>> ----------------------------------------------------------------------------
>>
>> My service is:
>> ----------------------------------------------------------------------------
>> @WebService
>> public interface ServicioFormularios {
>> 	@WebResult(name="uuid") 
>> 	String guardaFormulario(@WebParam(name="xml")FicheroXML xml);
>> }
>> ----------------------------------------------------------------------------
>>
>>
>> My cxf configuration is:
>> ----------------------------------------------------------------------------
>> <beans xmlns="http://www.springframework.org/schema/beans"
>> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
>> 	xsi:schemaLocation="http://www.springframework.org/schema/beans
>> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
>>
>>  <import resource="classpath:META-INF/cxf/cxf.xml"/>
>>  <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
>>  <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
>>  
>> <jaxws:endpoint 
>>   id="servicioFormulario" 
>>   implementor="com.servicios.ServicioFormulariosImpl" 
>>   address="/servicioFormulario">  
>>   <jaxws:properties>
>>       <entry key="mtom-enabled" value="true"/>
>>   </jaxws:properties>
>> </jaxws:endpoint>
>> </beans>
>> ----------------------------------------------------------------------------
>>
>> The wsdl generated whit java2wsdl:
>> ----------------------------------------------------------------------------
>> .
>> ..
>> ...
>> <xs:complexType name="ficheroXML">
>> <xs:sequence>
>> <xs:element minOccurs="0" name="xmlData" type="xs:base64Binary"/>
>> <xs:element minOccurs="0" name="title" type="xs:string"/>
>> </xs:sequence>
>> </xs:complexType>
>> ...
>> ..
>> .
>> <xs:complexType name="guardaFormulario">
>> <xs:sequence>
>> <xs:element minOccurs="0" name="xml" type="ficheroXML"/>
>> </xs:sequence>
>> </xs:complexType>
>> ...
>> ..
>> .
>> ----------------------------------------------------------------------------
>>
>> Why the attribute (xmime:expectedContentTypes="application/octet-stream")
>> isn´t in the "xmlData" element of "FicheroXML" ?
>>
>> Any ideas ...  it seam like the annotation @XmlMimeType it´s not running.
>>
>> Thanks in advance.
>>
>>   
> 
> 

-- 
View this message in context: http://www.nabble.com/MTOM-and-%40XmlMimeType%28%22application-octet-stream%22%29-annotation.-tf4632898.html#a13231184
Sent from the cxf-user mailing list archive at Nabble.com.


Re: MTOM and @XmlMimeType("application/octet-stream") annotation.

Posted by Freeman Fang <fr...@iona.com>.
Hi,
As per the discussion [1], you need use @RequestWrapper/@ResponseWrapper 
to point to your wrapper bean FicheroXML in your SEI class.

[1] 
http://www.nabble.com/MTOM-sample-generated-WSDL-with-DataHandler-on-server-t4210895.html

Best Regards

Freeman


imorales wrote:
> Hi all.
>
> I´m trying to implemente a web service that uses MTOM Attachments. The way
> I´m doing is "Annotation if JAXB bean". The problem is that the wsdl that I
> generate with ant task "java2wsdl" doesn´t add the annotation
> @XmlMimeType("application/octet-stream") in the <wsdl:types>. 
>
> My bean is:
> ----------------------------------------------------------------------------
> @XmlType
> public class FicheroXML {
>
> 	private String title;
>
> 	@XmlMimeType("application/octet-stream")
> 	private DataHandler xmlData;
>
> 	public String getTitle() {return title;	}
> 	public void setTitle(String title) {this.title = title;	}
> 	@XmlTransient public DataHandler getXmlData() {	return xmlData;}
> 	public void setXmlData(DataHandler xmlData) {this.xmlData = xmlData;}
> }
> ----------------------------------------------------------------------------
>
> My service is:
> ----------------------------------------------------------------------------
> @WebService
> public interface ServicioFormularios {
> 	@WebResult(name="uuid") 
> 	String guardaFormulario(@WebParam(name="xml")FicheroXML xml);
> }
> ----------------------------------------------------------------------------
>
>
> My cxf configuration is:
> ----------------------------------------------------------------------------
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
>
>  <import resource="classpath:META-INF/cxf/cxf.xml"/>
>  <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
>  <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
>  
> <jaxws:endpoint 
>   id="servicioFormulario" 
>   implementor="com.servicios.ServicioFormulariosImpl" 
>   address="/servicioFormulario">  
>   <jaxws:properties>
>       <entry key="mtom-enabled" value="true"/>
>   </jaxws:properties>
> </jaxws:endpoint>
> </beans>
> ----------------------------------------------------------------------------
>
> The wsdl generated whit java2wsdl:
> ----------------------------------------------------------------------------
> .
> ..
> ...
> <xs:complexType name="ficheroXML">
> <xs:sequence>
> <xs:element minOccurs="0" name="xmlData" type="xs:base64Binary"/>
> <xs:element minOccurs="0" name="title" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> ...
> ..
> .
> <xs:complexType name="guardaFormulario">
> <xs:sequence>
> <xs:element minOccurs="0" name="xml" type="ficheroXML"/>
> </xs:sequence>
> </xs:complexType>
> ...
> ..
> .
> ----------------------------------------------------------------------------
>
> Why the attribute (xmime:expectedContentTypes="application/octet-stream")
> isn´t in the "xmlData" element of "FicheroXML" ?
>
> Any ideas ...  it seam like the annotation @XmlMimeType it´s not running.
>
> Thanks in advance.
>
>