You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Selena85 <l....@gmail.com> on 2008/08/12 14:11:42 UTC

MTOM + Aegis

I've got problem to enabling MTOM in mine service. I've followed CXF
documentaion, but it's not working. The first problem is that even I've
annotated my bean with @XmlMimeType("application/octet-stream") the WSDL is
generated without xsd:element
expectedContentTypes="application/octet-stream". 
My bean:
@XmlType
public class MyBean{
	private String param1;
	@XmlMimeType("application/octet-stream")
	private DataHandler fileToTranslate;
...
and service
@WebService
public interface DocumentService {
	@WebResult(name = "docRespons")
	TranslationRespons translate(
			@WebParam(name = "param") MyBean param);
}
and spring configuration:
	<!-- Document translation service -->
	<jaxws:endpoint id="documentService"
		implementor="#documentServiceImpl" address="/documentTranslation">
		<jaxws:serviceFactory> <ref bean="jaxws-and-aegis-service-factory" />
			</jaxws:serviceFactory>
		<jaxws:properties>
			<entry key="mtom-enabled" value="true" />
		</jaxws:properties>
		<jaxws:inInterceptors>
					<bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
				<constructor-arg>
					<map>
						<entry key="action" value="UsernameToken" />
						<entry key="passwordType" value="PasswordText" />
						<entry key="passwordCallbackRef"
value-ref="serverAuthorizationCallback" />
					</map>
				</constructor-arg>
			</bean>
		</jaxws:inInterceptors>
	</jaxws:endpoint>

Why it's not working?

I've solved this problem using annotation in service method:
	@WebService
	public interface DocumentService {
		@WebResult(name = "docRespons")
		TranslationRespons translate(
				@WebParam(name = "param") String dstLanguage,
				@WebParam(name = "fileToTranslation")
@XmlMimeType("application/octet-stream") DataHandler file);
	}
then WSDL is generate properly with
expectedContentTypes="application/octet-stream".
But when I attempt to test this solution using soapUI I've got exception
when I've enabled MTOM:
2008-08-12 14:10:23 org.apache.cxf.phase.PhaseInterceptorChain doIntercept
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Unexpected element:
{http://www.w3.org/2004/08/xop/include}Include
	at
org.apache.cxf.aegis.databinding.XMLStreamDataReader.read(XMLStreamDataReader.java:49)
	at
org.apache.cxf.aegis.databinding.XMLStreamDataReader.read(XMLStreamDataReader.java:34)
...

Caused by: org.apache.cxf.aegis.DatabindingException: Unexpected element:
{http://www.w3.org/2004/08/xop/include}Include
	at
org.apache.cxf.aegis.type.basic.Base64Type.readObject(Base64Type.java:74)
	at
org.apache.cxf.aegis.type.mtom.AbstractXOPType.readObject(AbstractXOPType.java:127)
	at
org.apache.cxf.aegis.AegisXMLStreamDataReader.read(AegisXMLStreamDataReader.java:82)

Without MTOM it's work (really strange). What wrong in my configuration?
-- 
View this message in context: http://www.nabble.com/MTOM-%2B-Aegis-tp18943116p18943116.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: MTOM + Aegis

Posted by Benson Margulies <bi...@gmail.com>.
You will probably have to package this up as a test case and put it in JIRA.

We have a test that does Aegis+MTOM,
/cxf-systests/src/test/java/org/apache/cxf/systest/aegis/mtom/MtomTest.java.

I can now tell you that Aegis does not know anything about XmlMimeType. If
you require that, you'll have to use the JAXB data binding.



On Wed, Aug 13, 2008 at 2:59 AM, Selena85 <l....@gmail.com> wrote:

>
> Maybe someone else know answer for my question or You can show me some
> solution.
>
> Benson Margulies-4 wrote:
> >
> > I'm not sure that Aegis knows about XmlMimeType. Due to a broken
> computer,
> > I
> > can't research this for you until this evening.
> >
> > On Tue, Aug 12, 2008 at 8:11 AM, Selena85 <l....@gmail.com> wrote:
> >
> >>
> >> I've got problem to enabling MTOM in mine service. I've followed CXF
> >> documentaion, but it's not working. The first problem is that even I've
> >> annotated my bean with @XmlMimeType("application/octet-stream") the WSDL
> >> is
> >> generated without xsd:element
> >> expectedContentTypes="application/octet-stream".
> >> My bean:
> >> @XmlType
> >> public class MyBean{
> >>        private String param1;
> >>        @XmlMimeType("application/octet-stream")
> >>        private DataHandler fileToTranslate;
> >> ...
> >> and service
> >> @WebService
> >> public interface DocumentService {
> >>        @WebResult(name = "docRespons")
> >>        TranslationRespons translate(
> >>                        @WebParam(name = "param") MyBean param);
> >> }
> >> and spring configuration:
> >>        <!-- Document translation service -->
> >>        <jaxws:endpoint id="documentService"
> >>                implementor="#documentServiceImpl"
> >> address="/documentTranslation">
> >>                <jaxws:serviceFactory> <ref
> >> bean="jaxws-and-aegis-service-factory" />
> >>                        </jaxws:serviceFactory>
> >>                <jaxws:properties>
> >>                        <entry key="mtom-enabled" value="true" />
> >>                </jaxws:properties>
> >>                <jaxws:inInterceptors>
> >>                                        <bean
> >> class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
> >>                                <constructor-arg>
> >>                                        <map>
> >>                                                <entry key="action"
> >> value="UsernameToken" />
> >>                                                <entry key="passwordType"
> >> value="PasswordText" />
> >>                                                <entry
> >> key="passwordCallbackRef"
> >> value-ref="serverAuthorizationCallback" />
> >>                                        </map>
> >>                                </constructor-arg>
> >>                        </bean>
> >>                </jaxws:inInterceptors>
> >>        </jaxws:endpoint>
> >>
> >> Why it's not working?
> >>
> >> I've solved this problem using annotation in service method:
> >>        @WebService
> >>        public interface DocumentService {
> >>                @WebResult(name = "docRespons")
> >>                TranslationRespons translate(
> >>                                @WebParam(name = "param") String
> >> dstLanguage,
> >>                                @WebParam(name = "fileToTranslation")
> >> @XmlMimeType("application/octet-stream") DataHandler file);
> >>        }
> >> then WSDL is generate properly with
> >> expectedContentTypes="application/octet-stream".
> >> But when I attempt to test this solution using soapUI I've got exception
> >> when I've enabled MTOM:
> >> 2008-08-12 14:10:23 org.apache.cxf.phase.PhaseInterceptorChain
> >> doIntercept
> >> INFO: Interceptor has thrown exception, unwinding now
> >> org.apache.cxf.interceptor.Fault: Unexpected element:
> >> {http://www.w3.org/2004/08/xop/include}Include<http://www.w3.org/2004/08/xop/include%7DInclude>
> <http://www.w3.org/2004/08/xop/include%7DInclude>
> >>        at
> >>
> >>
> org.apache.cxf.aegis.databinding.XMLStreamDataReader.read(XMLStreamDataReader.java:49)
> >>        at
> >>
> >>
> org.apache.cxf.aegis.databinding.XMLStreamDataReader.read(XMLStreamDataReader.java:34)
> >> ...
> >>
> >> Caused by: org.apache.cxf.aegis.DatabindingException: Unexpected
> element:
> >> {http://www.w3.org/2004/08/xop/include}Include<http://www.w3.org/2004/08/xop/include%7DInclude>
> <http://www.w3.org/2004/08/xop/include%7DInclude>
> >>        at
> >>
> org.apache.cxf.aegis.type.basic.Base64Type.readObject(Base64Type.java:74)
> >>        at
> >>
> >>
> org.apache.cxf.aegis.type.mtom.AbstractXOPType.readObject(AbstractXOPType.java:127)
> >>        at
> >>
> >>
> org.apache.cxf.aegis.AegisXMLStreamDataReader.read(AegisXMLStreamDataReader.java:82)
> >>
> >> Without MTOM it's work (really strange). What wrong in my configuration?
> >> --
> >> View this message in context:
> >> http://www.nabble.com/MTOM-%2B-Aegis-tp18943116p18943116.html
> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/MTOM-%2B-Aegis-tp18943116p18957959.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>

Re: MTOM + Aegis

Posted by Selena85 <l....@gmail.com>.
Maybe someone else know answer for my question or You can show me some
solution.

Benson Margulies-4 wrote:
> 
> I'm not sure that Aegis knows about XmlMimeType. Due to a broken computer,
> I
> can't research this for you until this evening.
> 
> On Tue, Aug 12, 2008 at 8:11 AM, Selena85 <l....@gmail.com> wrote:
> 
>>
>> I've got problem to enabling MTOM in mine service. I've followed CXF
>> documentaion, but it's not working. The first problem is that even I've
>> annotated my bean with @XmlMimeType("application/octet-stream") the WSDL
>> is
>> generated without xsd:element
>> expectedContentTypes="application/octet-stream".
>> My bean:
>> @XmlType
>> public class MyBean{
>>        private String param1;
>>        @XmlMimeType("application/octet-stream")
>>        private DataHandler fileToTranslate;
>> ...
>> and service
>> @WebService
>> public interface DocumentService {
>>        @WebResult(name = "docRespons")
>>        TranslationRespons translate(
>>                        @WebParam(name = "param") MyBean param);
>> }
>> and spring configuration:
>>        <!-- Document translation service -->
>>        <jaxws:endpoint id="documentService"
>>                implementor="#documentServiceImpl"
>> address="/documentTranslation">
>>                <jaxws:serviceFactory> <ref
>> bean="jaxws-and-aegis-service-factory" />
>>                        </jaxws:serviceFactory>
>>                <jaxws:properties>
>>                        <entry key="mtom-enabled" value="true" />
>>                </jaxws:properties>
>>                <jaxws:inInterceptors>
>>                                        <bean
>> class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
>>                                <constructor-arg>
>>                                        <map>
>>                                                <entry key="action"
>> value="UsernameToken" />
>>                                                <entry key="passwordType"
>> value="PasswordText" />
>>                                                <entry
>> key="passwordCallbackRef"
>> value-ref="serverAuthorizationCallback" />
>>                                        </map>
>>                                </constructor-arg>
>>                        </bean>
>>                </jaxws:inInterceptors>
>>        </jaxws:endpoint>
>>
>> Why it's not working?
>>
>> I've solved this problem using annotation in service method:
>>        @WebService
>>        public interface DocumentService {
>>                @WebResult(name = "docRespons")
>>                TranslationRespons translate(
>>                                @WebParam(name = "param") String
>> dstLanguage,
>>                                @WebParam(name = "fileToTranslation")
>> @XmlMimeType("application/octet-stream") DataHandler file);
>>        }
>> then WSDL is generate properly with
>> expectedContentTypes="application/octet-stream".
>> But when I attempt to test this solution using soapUI I've got exception
>> when I've enabled MTOM:
>> 2008-08-12 14:10:23 org.apache.cxf.phase.PhaseInterceptorChain
>> doIntercept
>> INFO: Interceptor has thrown exception, unwinding now
>> org.apache.cxf.interceptor.Fault: Unexpected element:
>> {http://www.w3.org/2004/08/xop/include}Include<http://www.w3.org/2004/08/xop/include%7DInclude>
>>        at
>>
>> org.apache.cxf.aegis.databinding.XMLStreamDataReader.read(XMLStreamDataReader.java:49)
>>        at
>>
>> org.apache.cxf.aegis.databinding.XMLStreamDataReader.read(XMLStreamDataReader.java:34)
>> ...
>>
>> Caused by: org.apache.cxf.aegis.DatabindingException: Unexpected element:
>> {http://www.w3.org/2004/08/xop/include}Include<http://www.w3.org/2004/08/xop/include%7DInclude>
>>        at
>> org.apache.cxf.aegis.type.basic.Base64Type.readObject(Base64Type.java:74)
>>        at
>>
>> org.apache.cxf.aegis.type.mtom.AbstractXOPType.readObject(AbstractXOPType.java:127)
>>        at
>>
>> org.apache.cxf.aegis.AegisXMLStreamDataReader.read(AegisXMLStreamDataReader.java:82)
>>
>> Without MTOM it's work (really strange). What wrong in my configuration?
>> --
>> View this message in context:
>> http://www.nabble.com/MTOM-%2B-Aegis-tp18943116p18943116.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/MTOM-%2B-Aegis-tp18943116p18957959.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: MTOM + Aegis

Posted by Benson Margulies <bi...@gmail.com>.
I'm not sure that Aegis knows about XmlMimeType. Due to a broken computer, I
can't research this for you until this evening.

On Tue, Aug 12, 2008 at 8:11 AM, Selena85 <l....@gmail.com> wrote:

>
> I've got problem to enabling MTOM in mine service. I've followed CXF
> documentaion, but it's not working. The first problem is that even I've
> annotated my bean with @XmlMimeType("application/octet-stream") the WSDL is
> generated without xsd:element
> expectedContentTypes="application/octet-stream".
> My bean:
> @XmlType
> public class MyBean{
>        private String param1;
>        @XmlMimeType("application/octet-stream")
>        private DataHandler fileToTranslate;
> ...
> and service
> @WebService
> public interface DocumentService {
>        @WebResult(name = "docRespons")
>        TranslationRespons translate(
>                        @WebParam(name = "param") MyBean param);
> }
> and spring configuration:
>        <!-- Document translation service -->
>        <jaxws:endpoint id="documentService"
>                implementor="#documentServiceImpl"
> address="/documentTranslation">
>                <jaxws:serviceFactory> <ref
> bean="jaxws-and-aegis-service-factory" />
>                        </jaxws:serviceFactory>
>                <jaxws:properties>
>                        <entry key="mtom-enabled" value="true" />
>                </jaxws:properties>
>                <jaxws:inInterceptors>
>                                        <bean
> class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
>                                <constructor-arg>
>                                        <map>
>                                                <entry key="action"
> value="UsernameToken" />
>                                                <entry key="passwordType"
> value="PasswordText" />
>                                                <entry
> key="passwordCallbackRef"
> value-ref="serverAuthorizationCallback" />
>                                        </map>
>                                </constructor-arg>
>                        </bean>
>                </jaxws:inInterceptors>
>        </jaxws:endpoint>
>
> Why it's not working?
>
> I've solved this problem using annotation in service method:
>        @WebService
>        public interface DocumentService {
>                @WebResult(name = "docRespons")
>                TranslationRespons translate(
>                                @WebParam(name = "param") String
> dstLanguage,
>                                @WebParam(name = "fileToTranslation")
> @XmlMimeType("application/octet-stream") DataHandler file);
>        }
> then WSDL is generate properly with
> expectedContentTypes="application/octet-stream".
> But when I attempt to test this solution using soapUI I've got exception
> when I've enabled MTOM:
> 2008-08-12 14:10:23 org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> INFO: Interceptor has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault: Unexpected element:
> {http://www.w3.org/2004/08/xop/include}Include<http://www.w3.org/2004/08/xop/include%7DInclude>
>        at
>
> org.apache.cxf.aegis.databinding.XMLStreamDataReader.read(XMLStreamDataReader.java:49)
>        at
>
> org.apache.cxf.aegis.databinding.XMLStreamDataReader.read(XMLStreamDataReader.java:34)
> ...
>
> Caused by: org.apache.cxf.aegis.DatabindingException: Unexpected element:
> {http://www.w3.org/2004/08/xop/include}Include<http://www.w3.org/2004/08/xop/include%7DInclude>
>        at
> org.apache.cxf.aegis.type.basic.Base64Type.readObject(Base64Type.java:74)
>        at
>
> org.apache.cxf.aegis.type.mtom.AbstractXOPType.readObject(AbstractXOPType.java:127)
>        at
>
> org.apache.cxf.aegis.AegisXMLStreamDataReader.read(AegisXMLStreamDataReader.java:82)
>
> Without MTOM it's work (really strange). What wrong in my configuration?
> --
> View this message in context:
> http://www.nabble.com/MTOM-%2B-Aegis-tp18943116p18943116.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>