You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Barlotta, Michael [USA]" <ba...@bah.com> on 2007/11/02 17:33:29 UTC

RE: CXF Mtom service and Axis2 Axiom client (FIX)

FYI:
 
I finally got it working. turns out it is a classpath issue.
I have CXF and Axis2 in the same eclipse project and Java WS clients
written with both frameworks.
 
I moved the Axis2 WS Client to its own project and now it works. 
 
I am not sure why when the CXF and JAR dependencies and Axis2 and JAR
dependencies are in the classpath that the behavior results in "hanging"
the Axis2 client but that seemed to be the case. 
 
Mike Barlotta
Associate
Booz | Allen | Hamilton
 

________________________________

From: Walker, Jeff [mailto:Jeff.Walker@fmr.com] 
Sent: Friday, November 02, 2007 12:03 PM
To: axis-user@ws.apache.org
Subject: RE: CXF Mtom service and Axis2 Axiom client


Then I leave you with the problem Mike, since I am not an Axis2 guru.
Final suggestions: 
1. Build a CXF client. Does the problem still exist? (I'd do this first
to prove the CXF service is behaving properly as an MTOM server).
2. Then debug the Axis2 client src to see if it behaves the same way as
the CXF client.
3. There is a CXF mailing list. They might be able to help.
Regards,
-jeff


________________________________

	From: Barlotta, Michael [USA] [mailto:barlotta_michael@bah.com] 
	Sent: Friday, November 02, 2007 11:28 AM
	To: axis-user@ws.apache.org
	Subject: RE: CXF Mtom service and Axis2 Axiom client
	
	
	Thanks Jeff, the problem occurs with & w/o tcpmon... I am just
using that to debug. 
	I have used the image (2kb) with CXF client through tcpmon w/o
issues. 
	 
	I am using the tcpmon that comes with Axis1 version 1.4
	 
	Mike Barlotta
	Associate
	Booz | Allen | Hamilton
	 

________________________________

	From: Walker, Jeff [mailto:Jeff.Walker@fmr.com] 
	Sent: Friday, November 02, 2007 11:13 AM
	To: axis-user@ws.apache.org
	Subject: RE: CXF Mtom service and Axis2 Axiom client
	
	
	I don't know the exact answer to your question,
	but a previous poster ( few days back) hinted at the fact that
Apache's older tcpmon is not always an effective tool to use to debug an
MTOM service. I think it was because tcpmon has limited buffering
capabilities. (It might not be passing the complete stream back to your
Axis2 client). Suggest if you wish to continue using tcpmon with MTOM,
make the attachment very small to help out tcpmon.
	 
	(Where did you get tcpmon from? I use the older Axis 1.4 and
that has tcpmon, but I don't think Axis2 has tcpmon in its distribution,
does it? Try using Axis2's soapmonitor, you might have better luck).
	-jeff
	 
________________________________

	From: Barlotta, Michael [USA] [mailto:barlotta_michael@bah.com] 
	Sent: Friday, November 02, 2007 10:31 AM
	To: axis-user@ws.apache.org
	Subject: CXF Mtom service and Axis2 Axiom client
	
	

		I have written a simple CXF WebService using MTOM as a
proof of concept for future work.
		I have successfully written a CXF WS client, however I
am now writing an Axis2 WS client and am having some trouble and was
hoping someone could give some pointers. I am using Java 1.5, Axis2 1.3,
and CXF 2.0.2
		 
		I am using TCPMON to watch the SOAP requests and
responses 
		Axis2 --> TCPMON --> CXF Service
		 
		and here is what seems to be happening...
		The request and response are successfully made (I see
them both in TCPMON and both are using MIME/MTOM).
		The Axis2 client (running as a Junit test in eclipse)
hangs and CPU spikes to 100%
		The State in TCPMON is Req and does not get set to Done
		 
		Let me know if any other information would be helpful
		 
		Here is my Axis2 client
		 
		
		protected OMElement createPayload_SayHello(String
nameText) throws IOException{

			OMFactory factory =
OMAbstractFactory.getOMFactory();
			OMNamespace namespace =
factory.createOMNamespace("http://hello.bah.com/", "ns1");
			OMElement root =
factory.createOMElement("sayHello", namespace);
			 
			OMElement arg0 = factory.createOMElement("arg0",
null);
			root.addChild(arg0);
			 
			OMElement name = factory.createOMElement("name",
null);
			name.setText(nameText);
			arg0.addChild(name);
			 
			InputStream is =
IOHelper.getStreamFromClassPathFile("com/bah/hello/PensiveDuke.gif");
			ByteArrayOutputStream baos = new
ByteArrayOutputStream();
			IOHelper.inputToOutput(is, baos);
			DataSource ds = new
ByteArrayDataSource(baos.toByteArray(),"content/type");
			DataHandler dh = new DataHandler(ds);
			OMText binaryData = factory.createOMText(dh,
true);
			 
			OMElement bd =
factory.createOMElement("binaryData", null);
			bd.addChild(binaryData);
			arg0.addChild(bd);
			return root;

		}
		 
		
		public void test_WS_sayHello(){

			try {
			ServiceClient sc = new ServiceClient();
			Options opts = new Options();
			opts.setTo(new
EndpointReference(SERVICE_ADDRESS));
	
opts.setProperty(Constants.Configuration.ENABLE_MTOM,
Constants.VALUE_TRUE);
			sc.setOptions(opts);
			 
			OMElement requestElement =
this.createPayload_SayHello("Axis2");
			OMElement responseElement =
sc.sendReceive(requestElement);
			System.out.println("Response: " +
responseElement);
			 
			assertNotNull(responseElement);
	
assertEquals("sayHelloResponse",responseElement.getLocalName());
			OMElement returnElement =
responseElement.getFirstElement();
			assertNotNull(returnElement);
	
assertEquals("return",returnElement.getLocalName());
			 
			String responseXml = returnElement.getText();
			assertNotNull(responseXml);
			assertEquals("Hello Axis2",responseXml);
			} 
			catch (AxisFault e) {
			System.out.println(e.getMessage());
			fail("Unexpected AxisFault");
			}
			catch (IOException e) {
			System.out.println(e.getMessage());
			fail("Unexpected IOException");
			}
			}

		}
		 
		TIA
		 
		Mike Barlotta
		Associate
		Booz | Allen | Hamilton
		 


RE: CXF Mtom service and Axis2 Axiom client (FIX)

Posted by "Barlotta, Michael [USA]" <ba...@bah.com>.
I did not move to (or from) any of the frameworks. 
I built my MTOM service using CXF. 
I wanted to test interop with CXF client, Axis2 client, and Axis1 client
(still in progress...)
 
Mike Barlotta
Associate
Booz | Allen | Hamilton
 

________________________________

From: Walker, Jeff [mailto:Jeff.Walker@fmr.com] 
Sent: Friday, November 02, 2007 1:07 PM
To: axis-user@ws.apache.org
Subject: RE: CXF Mtom service and Axis2 Axiom client (FIX)


Hey Mike,
what is the compelling reason that impelled you to move to CXF
(presumably from Axis2, or XFire)?
-jeff


________________________________

	From: Barlotta, Michael [USA] [mailto:barlotta_michael@bah.com] 
	Sent: Friday, November 02, 2007 12:33 PM
	To: axis-user@ws.apache.org
	Subject: RE: CXF Mtom service and Axis2 Axiom client (FIX)
	
	
	FYI:
	 
	I finally got it working. turns out it is a classpath issue.
	I have CXF and Axis2 in the same eclipse project and Java WS
clients written with both frameworks.
	 
	I moved the Axis2 WS Client to its own project and now it works.

	 
	I am not sure why when the CXF and JAR dependencies and Axis2
and JAR dependencies are in the classpath that the behavior results in
"hanging" the Axis2 client but that seemed to be the case. 
	 
	Mike Barlotta
	Associate
	Booz | Allen | Hamilton
	 

________________________________

	From: Walker, Jeff [mailto:Jeff.Walker@fmr.com] 
	Sent: Friday, November 02, 2007 12:03 PM
	To: axis-user@ws.apache.org
	Subject: RE: CXF Mtom service and Axis2 Axiom client
	
	
	Then I leave you with the problem Mike, since I am not an Axis2
guru.
	Final suggestions: 
	1. Build a CXF client. Does the problem still exist? (I'd do
this first to prove the CXF service is behaving properly as an MTOM
server).
	2. Then debug the Axis2 client src to see if it behaves the same
way as the CXF client.
	
	3. There is a CXF mailing list. They might be able to help.
	Regards,
	-jeff


________________________________

		From: Barlotta, Michael [USA]
[mailto:barlotta_michael@bah.com] 
		Sent: Friday, November 02, 2007 11:28 AM
		To: axis-user@ws.apache.org
		Subject: RE: CXF Mtom service and Axis2 Axiom client
		
		
		Thanks Jeff, the problem occurs with & w/o tcpmon... I
am just using that to debug. 
		I have used the image (2kb) with CXF client through
tcpmon w/o issues. 
		 
		I am using the tcpmon that comes with Axis1 version 1.4
		 
		Mike Barlotta
		Associate
		Booz | Allen | Hamilton
		 

________________________________

		From: Walker, Jeff [mailto:Jeff.Walker@fmr.com] 
		Sent: Friday, November 02, 2007 11:13 AM
		To: axis-user@ws.apache.org
		Subject: RE: CXF Mtom service and Axis2 Axiom client
		
		
		I don't know the exact answer to your question,
		but a previous poster ( few days back) hinted at the
fact that Apache's older tcpmon is not always an effective tool to use
to debug an MTOM service. I think it was because tcpmon has limited
buffering capabilities. (It might not be passing the complete stream
back to your Axis2 client). Suggest if you wish to continue using tcpmon
with MTOM, make the attachment very small to help out tcpmon.
		 
		(Where did you get tcpmon from? I use the older Axis 1.4
and that has tcpmon, but I don't think Axis2 has tcpmon in its
distribution, does it? Try using Axis2's soapmonitor, you might have
better luck).
		-jeff
		 
________________________________

		From: Barlotta, Michael [USA]
[mailto:barlotta_michael@bah.com] 
		Sent: Friday, November 02, 2007 10:31 AM
		To: axis-user@ws.apache.org
		Subject: CXF Mtom service and Axis2 Axiom client
		
		

			I have written a simple CXF WebService using
MTOM as a proof of concept for future work.
			I have successfully written a CXF WS client,
however I am now writing an Axis2 WS client and am having some trouble
and was hoping someone could give some pointers. I am using Java 1.5,
Axis2 1.3, and CXF 2.0.2
			 
			I am using TCPMON to watch the SOAP requests and
responses 
			Axis2 --> TCPMON --> CXF Service
			 
			and here is what seems to be happening...
			The request and response are successfully made
(I see them both in TCPMON and both are using MIME/MTOM).
			The Axis2 client (running as a Junit test in
eclipse) hangs and CPU spikes to 100%
			The State in TCPMON is Req and does not get set
to Done
			 
			Let me know if any other information would be
helpful
			 
			Here is my Axis2 client
			 
			
			protected OMElement
createPayload_SayHello(String nameText) throws IOException{

				OMFactory factory =
OMAbstractFactory.getOMFactory();
				OMNamespace namespace =
factory.createOMNamespace("http://hello.bah.com/", "ns1");
				OMElement root =
factory.createOMElement("sayHello", namespace);
				 
				OMElement arg0 =
factory.createOMElement("arg0", null);
				root.addChild(arg0);
				 
				OMElement name =
factory.createOMElement("name", null);
				name.setText(nameText);
				arg0.addChild(name);
				 
				InputStream is =
IOHelper.getStreamFromClassPathFile("com/bah/hello/PensiveDuke.gif");
				ByteArrayOutputStream baos = new
ByteArrayOutputStream();
				IOHelper.inputToOutput(is, baos);
				DataSource ds = new
ByteArrayDataSource(baos.toByteArray(),"content/type");
				DataHandler dh = new DataHandler(ds);
				OMText binaryData =
factory.createOMText(dh, true);
				 
				OMElement bd =
factory.createOMElement("binaryData", null);
				bd.addChild(binaryData);
				arg0.addChild(bd);
				return root;

			}
			 
			
			public void test_WS_sayHello(){

				try {
				ServiceClient sc = new ServiceClient();
				Options opts = new Options();
				opts.setTo(new
EndpointReference(SERVICE_ADDRESS));
	
opts.setProperty(Constants.Configuration.ENABLE_MTOM,
Constants.VALUE_TRUE);
				sc.setOptions(opts);
				 
				OMElement requestElement =
this.createPayload_SayHello("Axis2");
				OMElement responseElement =
sc.sendReceive(requestElement);
				System.out.println("Response: " +
responseElement);
				 
				assertNotNull(responseElement);
	
assertEquals("sayHelloResponse",responseElement.getLocalName());
				OMElement returnElement =
responseElement.getFirstElement();
				assertNotNull(returnElement);
	
assertEquals("return",returnElement.getLocalName());
				 
				String responseXml =
returnElement.getText();
				assertNotNull(responseXml);
				assertEquals("Hello Axis2",responseXml);
				} 
				catch (AxisFault e) {
				System.out.println(e.getMessage());
				fail("Unexpected AxisFault");
				}
				catch (IOException e) {
				System.out.println(e.getMessage());
				fail("Unexpected IOException");
				}
				}

			}
			 
			TIA
			 
			Mike Barlotta
			Associate
			Booz | Allen | Hamilton
			 


RE: CXF Mtom service and Axis2 Axiom client (FIX)

Posted by "Walker, Jeff" <Je...@fmr.com>.
Hey Mike,
what is the compelling reason that impelled you to move to CXF
(presumably from Axis2, or XFire)?
-jeff


  _____  

	From: Barlotta, Michael [USA] [mailto:barlotta_michael@bah.com] 
	Sent: Friday, November 02, 2007 12:33 PM
	To: axis-user@ws.apache.org
	Subject: RE: CXF Mtom service and Axis2 Axiom client (FIX)
	
	
	FYI:
	 
	I finally got it working. turns out it is a classpath issue.
	I have CXF and Axis2 in the same eclipse project and Java WS
clients written with both frameworks.
	 
	I moved the Axis2 WS Client to its own project and now it works.

	 
	I am not sure why when the CXF and JAR dependencies and Axis2
and JAR dependencies are in the classpath that the behavior results in
"hanging" the Axis2 client but that seemed to be the case. 
	 
	Mike Barlotta
	Associate
	Booz | Allen | Hamilton
	 

  _____  

	From: Walker, Jeff [mailto:Jeff.Walker@fmr.com] 
	Sent: Friday, November 02, 2007 12:03 PM
	To: axis-user@ws.apache.org
	Subject: RE: CXF Mtom service and Axis2 Axiom client
	
	
	Then I leave you with the problem Mike, since I am not an Axis2
guru.
	Final suggestions: 
	1. Build a CXF client. Does the problem still exist? (I'd do
this first to prove the CXF service is behaving properly as an MTOM
server).
	2. Then debug the Axis2 client src to see if it behaves the same
way as the CXF client.
	
	3. There is a CXF mailing list. They might be able to help.
	Regards,
	-jeff


  _____  

		From: Barlotta, Michael [USA]
[mailto:barlotta_michael@bah.com] 
		Sent: Friday, November 02, 2007 11:28 AM
		To: axis-user@ws.apache.org
		Subject: RE: CXF Mtom service and Axis2 Axiom client
		
		
		Thanks Jeff, the problem occurs with & w/o tcpmon... I
am just using that to debug. 
		I have used the image (2kb) with CXF client through
tcpmon w/o issues. 
		 
		I am using the tcpmon that comes with Axis1 version 1.4
		 
		Mike Barlotta
		Associate
		Booz | Allen | Hamilton
		 

  _____  

		From: Walker, Jeff [mailto:Jeff.Walker@fmr.com] 
		Sent: Friday, November 02, 2007 11:13 AM
		To: axis-user@ws.apache.org
		Subject: RE: CXF Mtom service and Axis2 Axiom client
		
		
		I don't know the exact answer to your question,
		but a previous poster ( few days back) hinted at the
fact that Apache's older tcpmon is not always an effective tool to use
to debug an MTOM service. I think it was because tcpmon has limited
buffering capabilities. (It might not be passing the complete stream
back to your Axis2 client). Suggest if you wish to continue using tcpmon
with MTOM, make the attachment very small to help out tcpmon.
		 
		(Where did you get tcpmon from? I use the older Axis 1.4
and that has tcpmon, but I don't think Axis2 has tcpmon in its
distribution, does it? Try using Axis2's soapmonitor, you might have
better luck).
		-jeff
		 
  _____  

		From: Barlotta, Michael [USA]
[mailto:barlotta_michael@bah.com] 
		Sent: Friday, November 02, 2007 10:31 AM
		To: axis-user@ws.apache.org
		Subject: CXF Mtom service and Axis2 Axiom client
		
		

			I have written a simple CXF WebService using
MTOM as a proof of concept for future work.
			I have successfully written a CXF WS client,
however I am now writing an Axis2 WS client and am having some trouble
and was hoping someone could give some pointers. I am using Java 1.5,
Axis2 1.3, and CXF 2.0.2
			 
			I am using TCPMON to watch the SOAP requests and
responses 
			Axis2 --> TCPMON --> CXF Service
			 
			and here is what seems to be happening...
			The request and response are successfully made
(I see them both in TCPMON and both are using MIME/MTOM).
			The Axis2 client (running as a Junit test in
eclipse) hangs and CPU spikes to 100%
			The State in TCPMON is Req and does not get set
to Done
			 
			Let me know if any other information would be
helpful
			 
			Here is my Axis2 client
			 
			
			protected OMElement
createPayload_SayHello(String nameText) throws IOException{

				OMFactory factory =
OMAbstractFactory.getOMFactory();
				OMNamespace namespace =
factory.createOMNamespace("http://hello.bah.com/", "ns1");
				OMElement root =
factory.createOMElement("sayHello", namespace);
				 
				OMElement arg0 =
factory.createOMElement("arg0", null);
				root.addChild(arg0);
				 
				OMElement name =
factory.createOMElement("name", null);
				name.setText(nameText);
				arg0.addChild(name);
				 
				InputStream is =
IOHelper.getStreamFromClassPathFile("com/bah/hello/PensiveDuke.gif");
				ByteArrayOutputStream baos = new
ByteArrayOutputStream();
				IOHelper.inputToOutput(is, baos);
				DataSource ds = new
ByteArrayDataSource(baos.toByteArray(),"content/type");
				DataHandler dh = new DataHandler(ds);
				OMText binaryData =
factory.createOMText(dh, true);
				 
				OMElement bd =
factory.createOMElement("binaryData", null);
				bd.addChild(binaryData);
				arg0.addChild(bd);
				return root;

			}
			 
			
			public void test_WS_sayHello(){

				try {
				ServiceClient sc = new ServiceClient();
				Options opts = new Options();
				opts.setTo(new
EndpointReference(SERVICE_ADDRESS));
	
opts.setProperty(Constants.Configuration.ENABLE_MTOM,
Constants.VALUE_TRUE);
				sc.setOptions(opts);
				 
				OMElement requestElement =
this.createPayload_SayHello("Axis2");
				OMElement responseElement =
sc.sendReceive(requestElement);
				System.out.println("Response: " +
responseElement);
				 
				assertNotNull(responseElement);
	
assertEquals("sayHelloResponse",responseElement.getLocalName());
				OMElement returnElement =
responseElement.getFirstElement();
				assertNotNull(returnElement);
	
assertEquals("return",returnElement.getLocalName());
				 
				String responseXml =
returnElement.getText();
				assertNotNull(responseXml);
				assertEquals("Hello Axis2",responseXml);
				} 
				catch (AxisFault e) {
				System.out.println(e.getMessage());
				fail("Unexpected AxisFault");
				}
				catch (IOException e) {
				System.out.println(e.getMessage());
				fail("Unexpected IOException");
				}
				}

			}
			 
			TIA
			 
			Mike Barlotta
			Associate
			Booz | Allen | Hamilton