[JBossWS] - Re: MTOM + WS Security = problem
by mrostan
Hi, we are also trying to use WS-Security + MTOM in JBossWS 2.0.1 and 2.0.3, we are sending big files so we need binary attachments instead of inline encoded data.
Here is the result of our tests:
- In JBossWS 2.0.1 you must change the configuration of the endpoint by adding ##SOAP11_HTTP_MTOM to the bindings protocol:
| <javaee:protocol-bindings>##SOAP11_HTTP ##SOAP11_HTTP_MTOM</javaee:protocol-bindings>
|
If ##SOAP11_HTTP_MTOM is not present, the handler is ignored, and the signature is not verified.
- In JBossWS 2.0.3 you don't need to add ##SOAP11_HTTP_MTOM, it seems to consider the handler anyway.
- In both versions we had problems sending the binary as an attachment (using SoapUI), we always receive: Signature is invalid
- Using a JBossWS client, we didn't find a way to send the binary data as an attachment, it is sent always encoded inline.
- If the binary data is sent inline the signature is verified (from the JBossWS client and also from SoapUI)
- So, we could not make MTOM + Attachments + WS-Security work together
Instead, we have moved to swaRef (simply annotating with @XmlAttachmentRef a DataHandler field) and everything works fine, you can remove the BindingType for MTOM.
- So, we have now swaRef + WS-Security working fine
There is some important difference between MTOM and swaRef? swaRef comes from ws-i, so I expect no interoperability problems.
Somebody has MTOM and WS-Security working?
Thanks,
Martin
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4131550#4131550
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4131550
16 years, 3 months
[JBossWS] - org.xml.sax.SAXParseException: Premature end of file ERROR
by rainwood
I use an EJB application deployed in Jboss 4.0.1 to call a web service, it got the following errors. But it workes when I use a stand alone program to call web service separately (not in EJB application and not deployed in jboss server).
Does anybody here can help me to solve this problem? Any hint is helpful.
Million appreciates,
Yi
xisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXParseException: Premature end of file.
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXParseException: Premature end of file.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at com.guidewire.bc.webservices.api.IDataObjectAPISoapBindingStub.findIds(IDataObjectAPISoapBindingStub.java:4315)
at com.ravello.compquick.integration.billing.CQNMGWBillingAdapter.getBillingPlan(CQNMGWBillingAdapter.java:305)
at com.ravello.compquick.integration.billing.CQNMGWBillingAdapter.doNewBusiness(CQNMGWBillingAdapter.java:234)
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:324)
at com.ravello.compquick.framework.service.ObjectUtil.invokeMethod(ObjectUtil.java:110)
at com.ravello.compquick.integration.billing.BillingIntegrator.invokeExternal(BillingIntegrator.java:44)
at com.ravello.compquick.ejb.integration.IntegrationInvocationManagerBean.process(IntegrationInvocationManagerBean.java:28)
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:324)
at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:214)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:113)
at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:105)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:313)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:146)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:123)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
at org.jboss.ejb.Container.invoke(Container.java:870)
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:324)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:155)
at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:104)
at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:115)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:101)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:97)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:91)
at $Proxy543.process(Unknown Source)
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:324)
at com.ravello.compquick.framework.service.ObjectUtil.invokeMethod(ObjectUtil.java:110)
at com.ravello.compquick.integration.CompquickMessageBean.invokeService(CompquickMessageBean.java:56)
at com.ravello.compquick.integration.CompquickMessageBean.onMessage(CompquickMessageBean.java:40)
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:324)
at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
at org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:475)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:87)
at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:105)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:313)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:146)
at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:94)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
at org.jboss.ejb.MessageDrivenContainer.internalInvoke(MessageDrivenContainer.java:389)
at org.jboss.ejb.Container.invoke(Container.java:870)
at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:962)
at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1248)
at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:256)
at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:904)
at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:159)
at org.jboss.mq.SpySession.run(SpySession.java:351)
at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:180)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)
at java.lang.Thread.run(Thread.java:534)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4131526#4131526
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4131526
16 years, 3 months
[JBossWS] - Re: My WS doesn't send any attachment... why?
by cdc08x
Ok, I tried and used the SwAref technique many times, and everything worked perfectly.
Sadly, a new problem: when I wanted to send back to the client a List of complex objects, each with a DataHandler field, to treat as an attachment, a problem came.
In detail, here's the webservice interface method signature (btw, I'm sorry if I did not translate names from Italian):
| ...
| @WebMethod(operationName="getDocumentiRichiestaAvvioPratica")
| @WebResult(name="documentiData")
| List<DocumentoData> getDocumentiRichiestaAvvioPratica(
| @WebParam(name="numeroIstanza") int numeroIstanza,
| @WebParam(name="settore") String settore,
| @WebParam(name="natura") String natura)
| throws IllegalArgumentException;
| ...
|
And here is the definition of DocumentoData
| @XmlRootElement(name="DocumentoData")
| public class DocumentoData {
| /**
| * Autore del documento.
| */
| @XmlAttribute(required=true)
| public String autore;
| /*
| many other fields here...
| */
| /**
| * Contenuto binario del documento (mappato come <em>SwAref</em>, allegato SOAP)
| */
| @XmlElement
| @XmlAttachmentRef
| public DataHandler data;
|
| protected DocumentoData() {}
|
| /**
| * Costruttore di istanze <code>DocumentoData</code>
| * @param autore Autore del documento
| * @param dataCreazione Data di creazione del documento
| * @param numeroDocumento Numero del documento
| * @param protocollo Protocollo del documento (può essere <code>null</code>)
| * @param nomeFile Nome del file
| * @param titolo Titolo del file
| * @param descrizione Descrizione del contenuto (può essere una stringa vuota)
| * @param data Handler dei dati fisici del file
| */
| public DocumentoData(String autore, Calendar dataCreazione,
| int numeroDocumento, Protocollo protocollo,
| String nomeFile, String titolo, String descrizione, DataHandler data) {
| this.autore = autore;
| this.dataCreazione = dataCreazione;
| this.numeroDocumento = numeroDocumento;
| this.protocollo = protocollo;
| this.nomeFile = nomeFile;
| this.titolo = titolo;
| this.descrizione = descrizione;
| this.data = data;
| }
| }
|
This is the outgoing SOAP message, when the method's invocated
| HTTP/1.1 200 OK
| Server: Apache-Coyote/1.1
| X-Powered-By: Servlet 2.4; JBoss-4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=200710221139)/Tomcat-5.5
| Content-Type: text/xml;charset=UTF-8
| Date: Fri, 22 Feb 2008 12:17:52 GMT
| Connection: close
|
| <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
| <env:Header>
| </env:Header>
| <env:Body>
| <ns2:getDocumentiRichiestaAvvioPraticaResponse xmlns:ns2="http://www.provincia.latina.it/servizi/ws/PraticaStartWS">
| <documentiData dataCreazione="2008-02-22T13:17:52.682+01:00" autore="Claudio Di Ciccio">
| <numeroDocumento>14</numeroDocumento>
| <nomeFile>RichiestaAvvio.13.A2.1244.pdf</nomeFile>
| <titolo>Richiesta avvio procedimento - Settore Vincolo Idrogeologico - Allargamento pista camionabile</titolo>
| <descrizione>Richiesta avvio procedimento</descrizione>
| <data>cid:0-1203682672701-305379@ws.jboss.org</data>
| </documentiData>
| <documentiData dataCreazione="2008-02-22T13:17:52.682+01:00" autore="Claudio Di Ciccio">
| <numeroDocumento>14</numeroDocumento>
| <nomeFile>RichiestaAvvio.13.A2.1244.pdf</nomeFile>
| <titolo>Richiesta avvio procedimento - Settore Vincolo Idrogeologico - Allargamento pista camionabile</titolo>
| <descrizione>Richiesta avvio procedimento</descrizione>
| <data>cid:1-1203682672702-32409330@ws.jboss.org</data>
| </documentiData>
| </ns2:getDocumentiRichiestaAvvioPraticaResponse>
| </env:Body>
| </env:Envelope>
|
That is: there's no attachment, just cids into the SOAP message.
Instead, if I send back just ONE DocumentoData object, everything works.
Could someone suggest me why?
Thank you very much, in advance
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4131376#4131376
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4131376
16 years, 3 months
[JBossWS] - Type mapping trouble with JAX-WS and EJB3
by JoPe
I'm trying to write my first own webservice using EJBs (V3) in a JBoss 4.2.2. Building and deploying the webservice bean works fine, but when I try to access a web method with no parameters and no return type like this:
package test.de.laliluna.library;
| import java.net.URL;
| import javax.xml.namespace.QName;
| import javax.xml.rpc.Service;
| import javax.xml.rpc.ServiceFactory;
| import de.laliluna.library.BookTestBean;
|
| public class WebServiceTestClient
| {
| public static void main(String[] args) throws Exception
| {
| URL url = new URL("http://localhost:8080/FirstEjb3Tutorial/BookTestBean?wsdl");
| QName qname = new QName("http://library.laliluna.de/", "BookTestBeanService");
| ServiceFactory factory = ServiceFactory.newInstance();
| Service service = factory.createService(url, qname);
|
| BookTestBean serviceEndpoint = (BookTestBean)service.getPort(BookTestBean.class);
| serviceEndpoint.test();
| }
| }
it throws this exception:
Exception in thread "main" org.jboss.ws.WSException: Cannot obtain java type mapping for: {http://library.laliluna.de/}test
| at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCMetaDataBuilder.processDocElement(JAXRPCMetaDataBuilder.java:627)
| ...
| at test.de.laliluna.library.WebServiceTestClient.main(WebServiceTestClient.java:18)
where the last line refers to "Service service = factory.createService(url, qname);"
My questions are:
1. I thought using JAX-WS and Annotations would take care of all the webservice-configuration-XML-SOAP stuff for me. Do I still need to manually specify a type mapping? How? Where?
2. The web method I try to access has neither parameters nor a return value. How can there be any types to map??
If you could make me friends with webservices again, they and I would really appreciate it.
>From here: Server code.
package de.laliluna.library;
| import java.rmi.Remote;
| import java.util.Iterator;
| import java.util.List;
| import javax.ejb.Stateless;
| import javax.jws.Oneway;
| import javax.jws.WebMethod;
| import javax.jws.WebService;
| import javax.persistence.EntityManager;
| import javax.persistence.PersistenceContext;
|
| @Stateless
| @WebService
| public class BookTestBean implements BookTestBeanLocal, BookTestBeanRemote, Remote
| {
| @PersistenceContext
| EntityManager em;
| public static final String RemoteJNDIName = BookTestBean.class.getSimpleName() + "/remote";
| public static final String LocalJNDIName = BookTestBean.class.getSimpleName() + "/local";
|
| @WebMethod
| @Oneway
| public void test()
| {
| Book book = new Book(null, "My first bean book", "Sebastian");
| em.persist(book);
| Book book2 = new Book(null, "another book", "Paul");
| em.persist(book2);
| Book book3 = new Book(null, "EJB 3 developer guide, comes soon", "Sebastian");
| em.persist(book3);
| System.out.println("list some books");
| List someBooks = em.createQuery("from Book b where b.author=:name").setParameter("name", "Sebastian")
| .getResultList();
| for(Iterator iter = someBooks.iterator(); iter.hasNext() ;)
| {
| Book element = (Book)iter.next();
| System.out.println(element);
| }
| System.out.println("List all books");
| List allBooks = em.createQuery("from Book").getResultList();
| for(Iterator iter = allBooks.iterator(); iter.hasNext() ;)
| {
| Book element = (Book)iter.next();
| System.out.println(element);
| }
| System.out.println("delete a book");
| em.remove(book2);
| System.out.println("List all books");
| allBooks = em.createQuery("from Book").getResultList();
| for(Iterator iter = allBooks.iterator(); iter.hasNext() ;)
| {
| Book element = (Book)iter.next();
| System.out.println(element);
| }
| }
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4131354#4131354
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4131354
16 years, 3 months