[jbossws-users] [JBossWS] - SWA / MTOM attachments

sirigiris do-not-reply at jboss.com
Mon May 28 08:28:22 EDT 2007


Hi All,
I've deployed the samples provided by jbossws 1.2.0 on Jboss4.0.4GA and while trying to execute the SWA example, I'm getting the following exception. I came to know through forums that I need to enable MTOM endpoint. The MTOM service is also deployed on the server. Now to get the attachments example working what should I do? 

- Call invocation failed with unkown Exception
org.jboss.ws.binding.BindingException: Mime type text/xml not allowed for parameter mimepart allowed types are [application/xml]
	at org.jboss.ws.binding.soap.SOAPBindingProvider.createAttachmentPart(SOAPBindingProvider.java:605)
	at org.jboss.ws.binding.soap.SOAPBindingProvider.bindRequestMessage(SOAPBindingProvider.java:118)
	at org.jboss.ws.binding.soap.SOAP11BindingProvider.bindRequestMessage(SOAP11BindingProvider.java:65)
	at org.jboss.ws.jaxrpc.CallImpl.invokeInternal(CallImpl.java:645)
	at org.jboss.ws.jaxrpc.CallImpl.invoke(CallImpl.java:404)
	at ws.jboss.org.samples.swa.AttachTest1.main(AttachTest1.java:108)
Exception in thread "main" java.rmi.RemoteException: Call invocation failed: Mime type text/xml not allowed for parameter mimepart allowed types are [application/xml]; nested exception is: 
	org.jboss.ws.binding.BindingException: Mime type text/xml not allowed for parameter mimepart allowed types are [application/xml]
	at org.jboss.ws.jaxrpc.CallImpl.invokeInternal(CallImpl.java:718)
	at org.jboss.ws.jaxrpc.CallImpl.invoke(CallImpl.java:404)
	at ws.jboss.org.samples.swa.AttachTest1.main(AttachTest1.java:108)

As of now I'm running a standalone java program.  Please find the code attached. Help is highly appreciated.

ServiceFactory factory = ServiceFactory.newInstance();
Service service = factory.createService(SERVICE_NAME);
Call call = service.createCall();	          
	          call.setOperationName(new QName(TARGET_NAMESPACE, rpcMethodName));
	          call.addParameter("message", new QName(Constants.NS_SCHEMA_XSD, "string"), ParameterMode.IN);
           if (contentType.equals("application/xml"))		              
	        	  call.addParameter("mimepart", Constants.TYPE_MIME_APPLICATION_XML, DataHandler.class, ParameterMode.IN);
	    call.setReturnType(new QName(Constants.NS_SCHEMA_XSD, "string"));
	          call.setTargetEndpointAddress(TARGET_ENDPOINT_ADDRESS);	          call.setTargetEndpointAddress(TARGET_ENDPOINT_ADDRESS);
		  URL temp = new File("resources/jaxrpc/samples/swa/attach.xml").toURL();

		  String strTempURL = temp.toString();
		  strTempURL = strTempURL.substring(strTempURL.lastIndexOf("/"),strTempURL.length());
		  URL url = new URL("http","10.2.154.75",8080,strTempURL);
		  String value = (String)call.invoke(new Object[] {"application/xml" , new DataHandler(url)});
		  System.out.println("Value ::"+ value);

Regards,
Sreedhar

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4049033#4049033

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4049033



More information about the jbossws-users mailing list