You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Ronald Pieterse <ro...@gmail.com> on 2008/08/13 13:31:27 UTC

Problem client code MTOM enabled service (CXF 2.1.1)

I have a couple of questions and hope that someone will be able to answer
them fairly quickly. I'm in a bit of a rush here...

I have an MTOM enabled service (CXF 2.1.1) and want to use my client code to
receive attachments. The service is implemented correctly I think, since
the following code works just fine:

		JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
		factory.setServiceClass(PrototypeService.class);
		factory.setAddress("http://localhost:83/soap/PrototypeService");
		PrototypeService client = (PrototypeService) factory.create();
		com.tripolis.api.model.v15.Attachment reply = client.getFile();

		InputStream fileStream = (InputStream) reply.getData().getInputStream();

		...here we get the data from the stream (tested fine with 160MB)
		
However this uses classes from the server since I have no client code
generated here. You don't want to have your clients do this, right?
		
My service is MTOM enabled through the WebService annotation like so:

	@BindingType(value = SOAPBinding.SOAP11HTTP_MTOM_BINDING)

My questions:

1. Why does using SOAP12HTTP_MTOM_BINDING throw the following exception for
me:

	WSDLException: faultCode=CONFIGURATION_ERROR: No Java extensionType found
to represent a '{http://schemas.xmlsoap.org/wsdl/soap12/}binding' element in
the context of a 'javax.wsdl.Binding'.: 
		at javax.wsdl.extensions.ExtensionRegistry.createExtension(Unknown Source)
		at
org.apache.cxf.tools.util.SOAPBindingUtil.createSoapBinding(SOAPBindingUtil.java:413)
		at
org.apache.cxf.binding.soap.SoapBindingFactory.createSoapBinding(SoapBindingFactory.java:186)
		at
org.apache.cxf.binding.soap.SoapBindingFactory.createBindingInfo(SoapBindingFactory.java:172)
		at
org.apache.cxf.binding.AbstractBindingFactory.createBindingInfo(AbstractBindingFactory.java:82)
		at
org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createBindingInfo(AbstractWSDLBasedEndpointFactory.java:302)
		at
org.apache.cxf.jaxws.JaxWsServerFactoryBean.createBindingInfo(JaxWsServerFactoryBean.java:154)
		at
org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpointInfo(AbstractWSDLBasedEndpointFactory.java:178)
		at
org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:102)
		at
org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:114)
		at
org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:164)
		at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:334)
		at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:251)
		at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:201)
		at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:392)
		at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
		at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
		at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
		at java.lang.reflect.Method.invoke(Method.java:585)

2. My Axis 1.4 client code does not work when I try to invoke the call.
OCuld this be due to incompatibility between CXF 2.1.1 and Axis 1.4?
It was generated just fine but invocation of the getFile method throws the
following exception:

	2008-08-13 13:21:42,149 ERROR org.apache.axis.client.Call - Exception:
	org.xml.sax.SAXException: SimpleDeserializer encountered a child element,
which is NOT expected, in something it was trying to deserialize.
		at
org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeserializer.java:145)
		at
org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
		at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
		at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
		at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
		at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
		at org.apache.axis.client.Call.invoke(Call.java:2467)
		at org.apache.axis.client.Call.invoke(Call.java:2366)
		at org.apache.axis.client.Call.invoke(Call.java:1812)
		at
com.tripolis.test.prototype.client.PrototypeServiceSoapBindingStub.getFile(PrototypeServiceSoapBindingStub.java:389)
		at
com.tripolis.test.prototype.client.ClientTest.generatedClient(ClientTest.java:27)
		at com.tripolis.test.prototype.client.ClientTest.main(ClientTest.java:21)
	AxisFault
	 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
	 faultSubcode: 
	 faultString: org.xml.sax.SAXException: SimpleDeserializer encountered a
child element, which is NOT expected, in something it was trying to
deserialize.
	 faultActor: 
	 faultNode: 
	 faultDetail: 
		{http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException:
SimpleDeserializer encountered a child element, which is NOT expected, in
something it was trying to deserialize.
		at
org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeserializer.java:145)
		at
org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
		at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
		at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
		at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
		at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
		at org.apache.axis.client.Call.invoke(Call.java:2467)
		at org.apache.axis.client.Call.invoke(Call.java:2366)
		at org.apache.axis.client.Call.invoke(Call.java:1812)
		at
com.tripolis.test.prototype.client.PrototypeServiceSoapBindingStub.getFile(PrototypeServiceSoapBindingStub.java:389)
		at
com.tripolis.test.prototype.client.ClientTest.generatedClient(ClientTest.java:27)
		at com.tripolis.test.prototype.client.ClientTest.main(ClientTest.java:21)
	
		{http://xml.apache.org/axis/}hostname:HP-NX9420-01
	
3. How do I generate client code with CXF 2.1.1? I can't seem to find the
WSDL2Java file anymore. I have the JAX-WS frontend stuff in my classpath
(I use maven so it came in with CXF)

Thnx.
Ronald
-- 
View this message in context: http://www.nabble.com/Problem-client-code-MTOM-enabled-service-%28CXF-2.1.1%29-tp18961332p18961332.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Problem client code MTOM enabled service (CXF 2.1.1)

Posted by Ronald Pieterse <ro...@gmail.com>.

Glen Mazza wrote:
> 
> 
> Ronald Pieterse wrote:
>> 
>> However this uses classes from the server since I have no client code
>> generated here. You don't want to have your clients do this, right?
>> 
> 
> You can split out the JAX-WS artifacts into a separate JAR, usable by both
> client and service provider, using Maven's assembly plugin:
> http://www.jroller.com/gmazza/date/20080417#WFstep2
> 		
> 
> Ronald Pieterse wrote:
>> 
>> My service is MTOM enabled through the WebService annotation like so:
>> 	@BindingType(value = SOAPBinding.SOAP11HTTP_MTOM_BINDING)
>> 
>> My questions:
>> 1. Why does using SOAP12HTTP_MTOM_BINDING throw the following exception
>> for me:
>> 
> 
> Have no idea.  Hopefully someone else can help here, or just say with
> SOAP11 if you can.  Here's my MTOM sample of last year, maybe it has
> something you can snarf:
> http://www.jroller.com/gmazza/date/20071102
> 
> 
> Ronald Pieterse wrote:
>> 
>> 2. My Axis 1.4 client code does not work when I try to invoke the call.
>> Could this be due to incompatibility between CXF 2.1.1 and Axis 1.4?
>> It was generated just fine but invocation of the getFile method throws
>> the following exception:
>> 
>> 
> 
> Axis 1.4 is not a JAX-WS implementation, and I'm unsure if MTOM existed
> when Axis 1.x was implemented--regardless, I would ask on the Axis user's
> list for this.  Or Google your exception stack.
> 	
> 
> Ronald Pieterse wrote:
>> 
>> 3. How do I generate client code with CXF 2.1.1? I can't seem to find the
>> WSDL2Java file anymore. I have the JAX-WS frontend stuff in my classpath
>> (I use maven so it came in with CXF)
>> 
> 
> The link I gave you at the top shows an Ant and Maven way of running
> wsdl2java.
> 
> HTH,
> Glen
> 

Ok, this made some things a bit clearer I guess. About Axis 1.4, before my
upgrade to CXF 2.1.1 I used the same service with CXF 2.0.4 and then the
Axis 1.4 generated client worked just fine, so that should be no problem.
Anyway, we'll figure something out ;-)

Thanx.

Ronaled
-- 
View this message in context: http://www.nabble.com/Problem-client-code-MTOM-enabled-service-%28CXF-2.1.1%29-tp18961332p18976299.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Problem client code MTOM enabled service (CXF 2.1.1)

Posted by Glen Mazza <gl...@gmail.com>.

Ronald Pieterse wrote:
> 
> However this uses classes from the server since I have no client code
> generated here. You don't want to have your clients do this, right?
> 

You can split out the JAX-WS artifacts into a separate JAR, usable by both
client and service provider, using Maven's assembly plugin:
http://www.jroller.com/gmazza/date/20080417#WFstep2
		

Ronald Pieterse wrote:
> 
> My service is MTOM enabled through the WebService annotation like so:
> 	@BindingType(value = SOAPBinding.SOAP11HTTP_MTOM_BINDING)
> 
> My questions:
> 1. Why does using SOAP12HTTP_MTOM_BINDING throw the following exception
> for me:
> 

Have no idea.  Hopefully someone else can help here, or just say with SOAP11
if you can.  Here's my MTOM sample of last year, maybe it has something you
can snarf:
http://www.jroller.com/gmazza/date/20071102


Ronald Pieterse wrote:
> 
> 2. My Axis 1.4 client code does not work when I try to invoke the call.
> Could this be due to incompatibility between CXF 2.1.1 and Axis 1.4?
> It was generated just fine but invocation of the getFile method throws the
> following exception:
> 
> 

Axis 1.4 is not a JAX-WS implementation, and I'm unsure if MTOM existed when
Axis 1.x was implemented--regardless, I would ask on the Axis user's list
for this.  Or Google your exception stack.
	

Ronald Pieterse wrote:
> 
> 3. How do I generate client code with CXF 2.1.1? I can't seem to find the
> WSDL2Java file anymore. I have the JAX-WS frontend stuff in my classpath
> (I use maven so it came in with CXF)
> 

The link I gave you at the top shows an Ant and Maven way of running
wsdl2java.

HTH,
Glen
-- 
View this message in context: http://www.nabble.com/Problem-client-code-MTOM-enabled-service-%28CXF-2.1.1%29-tp18961332p18972873.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Problem client code MTOM enabled service (CXF 2.1.1)

Posted by Daniel Kulp <dk...@apache.org>.
Ronald,

1) Not sure on the exception, that shouldn't have happened.   However, use of 
SOAP12HTTP_MTOM_BINDING is deprecated in JAX-WS 2.1.   Normally, you would 
just use: SOAP12HTTP_BINDING
and add an @MTOM annotation.    (Actually, there error looks like possibly an 
old version of wsdl4j.  Not really sure though.)

2) No idea on that one either.   I have no idea what the error means in Axis2.

3) We have the wsdl2java file/script in the bin directory of the distribution.   
There is also the wsdl2java goal in the codegen maven plugin.

Dan



On Wednesday 13 August 2008 7:31:27 am Ronald Pieterse wrote:
> I have a couple of questions and hope that someone will be able to answer
> them fairly quickly. I'm in a bit of a rush here...
>
> I have an MTOM enabled service (CXF 2.1.1) and want to use my client code
> to receive attachments. The service is implemented correctly I think, since
> the following code works just fine:
>
> 		JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
> 		factory.setServiceClass(PrototypeService.class);
> 		factory.setAddress("http://localhost:83/soap/PrototypeService");
> 		PrototypeService client = (PrototypeService) factory.create();
> 		com.tripolis.api.model.v15.Attachment reply = client.getFile();
>
> 		InputStream fileStream = (InputStream) reply.getData().getInputStream();
>
> 		...here we get the data from the stream (tested fine with 160MB)
>
> However this uses classes from the server since I have no client code
> generated here. You don't want to have your clients do this, right?
>
> My service is MTOM enabled through the WebService annotation like so:
>
> 	@BindingType(value = SOAPBinding.SOAP11HTTP_MTOM_BINDING)
>
> My questions:
>
> 1. Why does using SOAP12HTTP_MTOM_BINDING throw the following exception for
> me:
>
> 	WSDLException: faultCode=CONFIGURATION_ERROR: No Java extensionType found
> to represent a '{http://schemas.xmlsoap.org/wsdl/soap12/}binding' element
> in the context of a 'javax.wsdl.Binding'.:
> 		at javax.wsdl.extensions.ExtensionRegistry.createExtension(Unknown
> Source) at
> org.apache.cxf.tools.util.SOAPBindingUtil.createSoapBinding(SOAPBindingUtil
>.java:413) at
> org.apache.cxf.binding.soap.SoapBindingFactory.createSoapBinding(SoapBindin
>gFactory.java:186) at
> org.apache.cxf.binding.soap.SoapBindingFactory.createBindingInfo(SoapBindin
>gFactory.java:172) at
> org.apache.cxf.binding.AbstractBindingFactory.createBindingInfo(AbstractBin
>dingFactory.java:82) at
> org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createBindingInfo(
>AbstractWSDLBasedEndpointFactory.java:302) at
> org.apache.cxf.jaxws.JaxWsServerFactoryBean.createBindingInfo(JaxWsServerFa
>ctoryBean.java:154) at
> org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpointInfo
>(AbstractWSDLBasedEndpointFactory.java:178) at
> org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(Abs
>tractWSDLBasedEndpointFactory.java:102) at
> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:114
>) at
> org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.j
>ava:164) at
> org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:334) at
> org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:251) at
> org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:201) at
> org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:392) at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 		at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:3
>9) at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp
>l.java:25) at java.lang.reflect.Method.invoke(Method.java:585)
>
> 2. My Axis 1.4 client code does not work when I try to invoke the call.
> OCuld this be due to incompatibility between CXF 2.1.1 and Axis 1.4?
> It was generated just fine but invocation of the getFile method throws the
> following exception:
>
> 	2008-08-13 13:21:42,149 ERROR org.apache.axis.client.Call - Exception:
> 	org.xml.sax.SAXException: SimpleDeserializer encountered a child element,
> which is NOT expected, in something it was trying to deserialize.
> 		at
> org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeserial
>izer.java:145) at
> org.apache.axis.encoding.DeserializationContext.startElement(Deserializatio
>nContext.java:1035) at
> org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165
>) at
> org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java
>:1141) at
> org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236) at
> org.apache.axis.message.RPCElement.getParams(RPCElement.java:384) at
> org.apache.axis.client.Call.invoke(Call.java:2467)
> 		at org.apache.axis.client.Call.invoke(Call.java:2366)
> 		at org.apache.axis.client.Call.invoke(Call.java:1812)
> 		at
> com.tripolis.test.prototype.client.PrototypeServiceSoapBindingStub.getFile(
>PrototypeServiceSoapBindingStub.java:389) at
> com.tripolis.test.prototype.client.ClientTest.generatedClient(ClientTest.ja
>va:27) at
> com.tripolis.test.prototype.client.ClientTest.main(ClientTest.java:21)
> AxisFault
> 	 faultCode:
> {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
> faultSubcode:
> 	 faultString: org.xml.sax.SAXException: SimpleDeserializer encountered a
> child element, which is NOT expected, in something it was trying to
> deserialize.
> 	 faultActor:
> 	 faultNode:
> 	 faultDetail:
> 		{http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException:
> SimpleDeserializer encountered a child element, which is NOT expected, in
> something it was trying to deserialize.
> 		at
> org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeserial
>izer.java:145) at
> org.apache.axis.encoding.DeserializationContext.startElement(Deserializatio
>nContext.java:1035) at
> org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165
>) at
> org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java
>:1141) at
> org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236) at
> org.apache.axis.message.RPCElement.getParams(RPCElement.java:384) at
> org.apache.axis.client.Call.invoke(Call.java:2467)
> 		at org.apache.axis.client.Call.invoke(Call.java:2366)
> 		at org.apache.axis.client.Call.invoke(Call.java:1812)
> 		at
> com.tripolis.test.prototype.client.PrototypeServiceSoapBindingStub.getFile(
>PrototypeServiceSoapBindingStub.java:389) at
> com.tripolis.test.prototype.client.ClientTest.generatedClient(ClientTest.ja
>va:27) at
> com.tripolis.test.prototype.client.ClientTest.main(ClientTest.java:21)
>
> 		{http://xml.apache.org/axis/}hostname:HP-NX9420-01
>
> 3. How do I generate client code with CXF 2.1.1? I can't seem to find the
> WSDL2Java file anymore. I have the JAX-WS frontend stuff in my classpath
> (I use maven so it came in with CXF)
>
> Thnx.
> Ronald



-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog