[JBossWS] - Re: file transfer via SOAP and RPC
by mendret
just for completeness, problem was that i used some wrong libs
now everything is working except an dii client, which still throws exceptions like this:
| org.jboss.xb.binding.JBossXBRuntimeException: Failed to find read method or field for property 'commandMap' in class javax.activation.DataHandler
| at org.jboss.xb.binding.introspection.ClassInfo.getFieldInfo(ClassInfo.java:82)
|
or if i specify the url to the WSDL
| org.jboss.ws.WSException: Cannot obtain java type mapping for: {http://server/}tns:documentPayload
| at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCMetaDataBuilder.buildInputParameter(JAXRPCMetaDataBuilder.java:264)
|
|
so it would be nice if someone is able to tell me what the problem is and what i should do to resolve it
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4204661#4204661
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4204661
15 years, 11 months
[JBossWS] - Re: file transfer via SOAP and RPC
by mendret
after managing the server side, which works without problems, i still get problems with the client side, i tried different approaches but got errors i wasn't able to resolve, maybe someone has an idea what i'm doing wrong.
first try was with the files that wsconsume generated:
| public class Client
| {
| protected FileTransferMTOMEndpoint mtomEndpoint;
|
| public Client(URL url) {
| FileTransferMTOMService mtomService = new FileTransferMTOMService(url,
| new QName("http://127.0.0.1:8080/news_test?wsdl",
| "FileTransferMTOMService"));
| mtomEndpoint = (FileTransferMTOMEndpoint)mtomService.getFileTransferMTOMPort();
| }
|
| public void run() throws IOException {
| ((SOAPBinding)(((BindingProvider)mtomEndpoint).getBinding())).setMTOMEnabled(true);
|
| System.out.println("Uploading test2.dat and downloading test.dat");
| EditionMTOM edition2 = new EditionMTOM();
| edition2.setId("test.dat");
| edition2.setContent(new DataHandler(new FileDataSource("/tmp/test2.dat")));
|
| EditionMTOM edition = mtomEndpoint.doSomething(edition2);
| System.out.println("Content: " + edition.getContent());
| InputStream is = edition.getContent().getInputStream();
| InputStreamReader isr = new InputStreamReader(is, "UTF-8");
|
| char[] buff = new char[20];
| isr.read(buff);
| isr.close();
| is.close();
| for (char b : buff) {
| System.out.print(b);
| }
| }
|
| public static void main(String[] args) {
| try {
| Client client = new Client(new URL("http://127.0.0.1:8080/news_test?wsdl"));
| client.run();
| }
| catch (Exception e) {
| e.printStackTrace();
| }
| }
| }
|
here i get the following error:
| Exception in thread "main" java.lang.NoSuchMethodError: method org.jboss.ws.core.utils.JBossWSEntityResolver.getEntityMap with signature ()Ljava.util.Map; was not found.
| at org.jboss.ws.tools.JavaToXSD.resolveNamespaceURI(JavaToXSD.java:224)
| at org.jboss.ws.tools.JavaToXSD.parseSchema(JavaToXSD.java:171)
| at org.jboss.ws.tools.wsdl.WSDL11Reader.processTypes(WSDL11Reader.java:402)
| at org.jboss.ws.tools.wsdl.WSDL11Reader.processDefinition(WSDL11Reader.java:179)
| at org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory.parse(WSDLDefinitionsFactory.java:126)
| at org.jboss.ws.metadata.umdm.ServiceMetaData.getWsdlDefinitions(ServiceMetaData.java:293)
| at org.jboss.ws.metadata.builder.jaxws.JAXWSClientMetaDataBuilder.buildMetaData(JAXWSClientMetaDataBuilder.java:84)
| at org.jboss.ws.core.jaxws.spi.ServiceDelegateImpl.<init>(ServiceDelegateImpl.java:136)
| at org.jboss.ws.core.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:62)
| at javax.xml.ws.Service.<init>(Service.java:79)
| at client.FileTransferMTOMService.<init>(FileTransferMTOMService.java:36)
| at client.Client.<init>(Client.java:19)
| at client.Client.main(Client.java:49)
|
the next try was a DII client, which looks like this:
| public class DII2Client {
|
| public static void main(String[] args) {
| try {
| QName serviceName = new QName(
| "http://127.0.0.1:8080/news_test?wsdl",
| "FileTransferMTOMService");
| ServiceFactory factory = ServiceFactory.newInstance();
| Service service = factory.createService(serviceName);
| QName operationName = new QName("http://127.0.0.1:8080/news_test?wsdl", "doSomething");
| QName operationPort = new QName("http://127.0.0.1:8080/news_test?wsdl", "FileTransferMTOMPort");
|
| Call call = service.createCall(operationPort);
| call.setOperationName(operationName);
| call.setProperty("BindingType", "http://schemas.xmlsoap.org/wsdl/soap/http?mtom=true");
| call.setTargetEndpointAddress("http://127.0.0.1:8080/news_test?wsdl");
|
| call.addParameter("arg0", new QName("http://127.0.0.1:8080/news_test?wsdl", "arg0"), EditionMTOM.class, ParameterMode.IN);
|
| EditionMTOM edition2 = new EditionMTOM();
| edition2.setId("test.dat");
| edition2.setContent(new DataHandler(new FileDataSource("/opt/cats/test.dat")));
|
| Object[] params = {edition2};
|
| SimpleDateFormat formatter = new SimpleDateFormat ("yyyy.MM.dd 'at' HH:mm:ss ");
|
| System.out.println("before call:" + formatter.format(new Date()));
| EditionMTOM result = (EditionMTOM)call.invoke(params);
| System.out.println("after call:" + formatter.format(new Date()));
| System.out.println(result);
| } catch (Exception ex) {
| ex.printStackTrace();
| }
| }
| }
|
as long as i call: factory.createService(serviceName);
I get the following error:
| java.rmi.RemoteException: Call invocation failed; nested exception is:
| java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage
| at org.jboss.ws.core.jaxrpc.client.CallImpl.invokeInternal(CallImpl.java:533)
| at org.jboss.ws.core.jaxrpc.client.CallImpl.invoke(CallImpl.java:274)
| at client.DII2Client.main(DII2Client.java:43)
| Caused by: java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage
| at javax.xml.soap.SOAPMessage.setProperty(SOAPMessage.java:441)
| at org.jboss.ws.core.soap.SOAPMessageImpl.<init>(SOAPMessageImpl.java:82)
| at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:169)
| at org.jboss.ws.core.CommonSOAP11Binding.createMessage(CommonSOAP11Binding.java:57)
| at org.jboss.ws.core.CommonSOAPBinding.bindRequestMessage(CommonSOAPBinding.java:156)
| at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:290)
| at org.jboss.ws.core.jaxrpc.client.CallImpl.invokeInternal(CallImpl.java:514)
| ... 2 more
|
if i try to run it with: Service service = factory.createService(new URL("http://127.0.0.1:8080/news_test?wsdl"),serviceName);
i get this error:
| Exception in thread "main" java.lang.NoSuchMethodError: org.jboss.ws.core.utils.JBossWSEntityResolver.getEntityMap()Ljava/util/Map;
| at org.jboss.ws.tools.JavaToXSD.resolveNamespaceURI(JavaToXSD.java:224)
| at org.jboss.ws.tools.JavaToXSD.parseSchema(JavaToXSD.java:171)
| at org.jboss.ws.tools.wsdl.WSDL11Reader.processTypes(WSDL11Reader.java:402)
| at org.jboss.ws.tools.wsdl.WSDL11Reader.processDefinition(WSDL11Reader.java:179)
| at org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory.parse(WSDLDefinitionsFactory.java:126)
| at org.jboss.ws.metadata.umdm.ServiceMetaData.getWsdlDefinitions(ServiceMetaData.java:293)
| at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCClientMetaDataBuilder.buildMetaData(JAXRPCClientMetaDataBuilder.java:114)
| at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCClientMetaDataBuilder.buildMetaData(JAXRPCClientMetaDataBuilder.java:85)
| at org.jboss.ws.core.jaxrpc.client.ServiceImpl.<init>(ServiceImpl.java:109)
| at org.jboss.ws.core.jaxrpc.client.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:155)
| at org.jboss.ws.core.jaxrpc.client.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:126)
| at client.DII2Client.main(DII2Client.java:23)
|
i found a post regarding the last error but it was never resolved:
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4063940#4063940
so it would be nice if someone has an idea what is causing these problems and how to resolve them
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4204239#4204239
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4204239
15 years, 11 months
[JBossWS] - Re: file transfer via SOAP and RPC
by mendret
ok, now I found a relativ good example at
http://jbossws.jboss.org/mediawiki/index.php?title=Security_and_attachmen...
and tried to convert it a bit into real file transfer and not only text, like it is in the example and I tried the following at server side:
| public EditionMTOM doSomething(EditionMTOM data)
| {
| try {
| System.out.println(data.getContent().getContentType());
| InputStream is = data.getContent().getInputStream();
| InputStreamReader isr = new InputStreamReader(is, "UTF-8");
| char[] buff = new char[10];
| isr.read(buff);
| isr.close();
| is.close();
| for (char b : buff) {
| System.out.print(b);
| }
| }
| catch (UnsupportedEncodingException e) {
| // TODO Auto-generated catch block
| e.printStackTrace();
| }
| catch (IOException e) {
| // TODO Auto-generated catch block
| e.printStackTrace();
| }
|
| EditionMTOM edition = new EditionMTOM();
| edition.setContent(new DataHandler(new FileDataSource("/opt/test2.dat"), "application/octet-stream"));
| edition.setDate(new Date());
| edition.setId("test2.dat");
| return edition;
| }
|
I get some warnings but at all it works until the server tries to send back data, then i get the following exception:
| org.jboss.ws.WSException: No ByteArrayConverter for class: javax.activation.FileDataSource
|
My question is now what can I do to make this work?
I'm grateful for every advise you can give me
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4203925#4203925
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4203925
15 years, 11 months
[JBossWS] - Abstract class as input Parameter in WebService
by vesposito
Hi, I've a problem to use abstract class in a Web Service like WebMethod input parameter. I'm using JBOSS-4.2.2.GA and JBOSSWS-NATIVE-3.0.3. Specifically, I've read a lot of documents and example about how to use @XmlSeeAlso annotation and there are two different kinds explained:
1) use it in WebService class reporting classes that extend Abstract class or
2) use it in Abstract class.
The first one doesn't generate stubs (using wsconsume) relative to real Classes, so it's not possible use them client-side, the second one instead generates them so client can create a class to use like parameter in WebMethod.
Supponing that the second way it's the correct one, i generate stubs to use them client side and this is code about service, abstract class and real class:
WakeRider.java
| @WebService(serviceName="WakeRider")
| @Stateless
|
| public class WakeRider {
|
| public String showItem(Item item) {
| try {
| if(item instanceof Tower)
| System.out.println("inside");
| return ((Tower)item).ItemName();
| } catch (Exception e) {
| e.printStackTrace();
| }
| return "";
| }
|
| }
|
Item.java
| @XmlSeeAlso({Tower.class})
| public abstract class Item implements Serializable {
|
| public abstract String ItemName();
|
| }
|
Tower.java
| @XmlType(name="Tower",propOrder={"itemName"})
| public class Tower extends Item {
|
| private String itemName;
|
| @Override
| public String ItemName() {
| // TODO Auto-generated method stub
| return itemName;
| }
| public String getItemName() {
| return itemName;
| }
| public void setItemName(String itemName) {
| this.itemName = itemName;
| }
| }
|
Generated WSDL is this:
| <definitions name="WakeRider" targetNamespace="http://wakerider/">
| -
| <types>
| -
| <xs:schema targetNamespace="http://wakerider/" version="1.0">
| <xs:element name="showItem" type="tns:showItem"/>
| <xs:element name="showItemResponse" type="tns:showItemResponse"/>
| -
| <xs:complexType name="showItem">
| -
| <xs:sequence>
| <xs:element minOccurs="0" name="arg0" type="tns:item"/>
| </xs:sequence>
| </xs:complexType>
| -
| <xs:complexType abstract="true" name="item">
| <xs:sequence/>
| </xs:complexType>
| -
| <xs:complexType name="Tower">
| -
| <xs:complexContent>
| -
| <xs:extension base="tns:item">
| -
| <xs:sequence>
| <xs:element minOccurs="0" name="itemName" type="xs:string"/>
| </xs:sequence>
| </xs:extension>
| </xs:complexContent>
| </xs:complexType>
| -
| <xs:complexType name="showItemResponse">
| -
| <xs:sequence>
| <xs:element minOccurs="0" name="return" type="xs:string"/>
| </xs:sequence>
| </xs:complexType>
| </xs:schema>
| </types>
| -
| <message name="WakeRider_showItemResponse">
| <part element="tns:showItemResponse" name="showItemResponse"/>
| </message>
| -
| <message name="WakeRider_showItem">
| <part element="tns:showItem" name="showItem"/>
| </message>
| -
| <portType name="WakeRider">
| -
| <operation name="showItem" parameterOrder="showItem">
| <input message="tns:WakeRider_showItem"/>
| <output message="tns:WakeRider_showItemResponse"/>
| </operation>
| </portType>
| -
| <binding name="WakeRiderBinding" type="tns:WakeRider">
| <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
| -
| <operation name="showItem">
| <soap:operation soapAction=""/>
| -
| <input>
| <soap:body use="literal"/>
| </input>
| -
| <output>
| <soap:body use="literal"/>
| </output>
| </operation>
| </binding>
| -
| <service name="WakeRider">
| -
| <port binding="tns:WakeRiderBinding" name="WakeRiderPort">
| <soap:address location="http://localhost:8080/AbstractTest/WakeRider"/>
| </port>
| </service>
| </definitions>
|
Using this WSDL I generate stubs to use client side. Client is defined below:
Client.java
| public class Client {
|
| public static void main(String[] args) {
| WakeRider_Service srv = new WakeRider_Service();
| WakeRider wr_srv = srv.getWakeRiderPort();
|
| Tower item=new Tower();
| item.setItemName("tower");
| System.out.println(wr_srv.showItem(item));
| }
|
| }
|
When I start this client i've this Exception server side:
| ERROR [SOAPFaultHelperJAXWS] SOAP request exception
| javax.xml.ws.WebServiceException: javax.xml.bind.UnmarshalException: Unable to create an instance of wakerider.inventory.Item
| - with linked exception:
| [java.lang.InstantiationException]
| at org.jboss.ws.core.jaxws.JAXBDeserializer.handleUnmarshallException(JAXBDeserializer.java:110)
| at org.jboss.ws.core.jaxws.JAXBDeserializer.deserialize(JAXBDeserializer.java:78)
| at org.jboss.ws.core.binding.DeserializerSupport.deserialize(DeserializerSupport.java:58)
| .....
|
Thanks for help.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4203905#4203905
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4203905
15 years, 11 months
[JBossWS] - jboss web service client
by francescots
Hi.
i'm using jbossws 2.0 and jboss AS 4.2.2. When accessing from my web application under seam to an web service i got the following exception
...UserName is not a valid property on class com.phi.ws.Test
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getElementPropertyAccessor(JAXBContextImpl.java:926)
org.jboss.ws.metadata.acessor.JAXBAccessor$1$1.create(JAXBAccessor.java:75)
org.jboss.ws.metadata.umdm.ParameterMetaData.eagerInitialize(ParameterMetaData.java:480)
org.jboss.ws.metadata.umdm.OperationMetaData.eagerInitialize(OperationMetaData.java:458)
org.jboss.ws.metadata.umdm.EndpointMetaData.eagerInitializeOperations(EndpointMetaData.java:533)
org.jboss.ws.metadata.umdm.EndpointMetaData.initializeInternal(EndpointMetaData.java:519)
org.jboss.ws.metadata.umdm.EndpointMetaData.eagerInitialize(EndpointMetaData.java:507)
org.jboss.ws.metadata.builder.jaxws.JAXWSClientMetaDataBuilder.rebuildEndpointMetaData(JAXWSClientMetaDataBuilder.java:308)
org.jboss.ws.core.jaxws.spi.ServiceDelegateImpl.getPortInternal(ServiceDelegateImpl.java:262)
org.jboss.ws.core.jaxws.spi.ServiceDelegateImpl.getPort(ServiceDelegateImpl.java:193)
javax.xml.ws.Service.getPort(Service.java:116)
com.phi.ws.tesan.mocmeasurements.MOCMeasurements.getMOCMeasurementsSoap(MOCMeasurements.java:50)
com.phi.ws.StubBeanMio.queryWSTesanMoc(StubBeanMio.java:52)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44)
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
org.jboss.seam.bpm.BusinessProcessInterceptor.aroundInvoke(BusinessProcessInterceptor.java:49)
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
org.jboss.seam.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:26)
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:27)
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:240)
org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:210)
org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:84)
$Proxy142.queryWSTesanMoc(Unknown Source)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
org.javassist.tmp.java.lang.Object_$$_javassist_19.queryWSTesanMoc(Object_$$_javassist_19.java)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:328)
org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:341)
org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
javax.faces.component.UICommand.broadcast(UICommand.java:383)
org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:55)
org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:317)
org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:292)
org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:249)
org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:462)
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:508)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:154)
org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:260)
org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:366)
org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:493)
org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
When i access to web service from a standalone java project i can connect and getting the right response.
Any Idea?
I supposed that one of the jar that i have in the jboss deploy directory makes a trouble.
Thank you for any response.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4203766#4203766
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4203766
15 years, 11 months
[JBossWS] - file transfer via SOAP and RPC
by mendret
hi folks,
I'm trying to write a webservice which is capable of receiving and sending files, for JBoss 5 GA.
So I'm quite new to webservices and jboss, thus I`ve got a few problems concerning this matter.
I`m quite sure that I need to use attachments to the soap message, but the question is how to do that?
I tried something using MTOM/SwaRef like it stand here:
http://jbossws.jboss.org/mediawiki/index.php/JAX-WS_User_Guide#Attachments
but the code fragments are a bit short, thus I wasn't able to see how I actually attach the files and retrieve them from the attachment
I tried the following:
Interface IFileTransfer:
| @WebService(targetNamespace = "http://server/")
| @SOAPBinding(style = SOAPBinding.Style.RPC, parameterStyle = SOAPBinding.ParameterStyle.BARE)
| @BindingType(value="http://schemas.xmlsoap.org/wsdl/soap/http?mtom=true")
| public interface IFileTransfer extends java.rmi.Remote {
|
| @WebMethod
| DocumentPayload beanAnnotation(DocumentPayload payload) ;
| }
|
Implementation FileTransfer:
| @WebService(name = "FileTransfer",
| serviceName = "FileTransferService",
| portName = "FileTransfer",
| endpointInterface = "remote.IFileTransfer")
| @SOAPBinding(style = SOAPBinding.Style.RPC)
| public class FileTransfer implements IFileTransfer {
|
| @WebMethod
| public DocumentPayload beanAnnotation(DocumentPayload payload) {
|
| System.out.println(payload.getData().getContentType());
| //do something cool with the data
| return payload;
| }
| }
|
DocumentPayload:
| package remote;
|
| import javax.activation.DataHandler;
| import javax.xml.bind.annotation.XmlAttachmentRef;
| import javax.xml.bind.annotation.XmlElement;
| import javax.xml.bind.annotation.XmlRootElement;
|
| @XmlRootElement
| public class DocumentPayload
| {
| private DataHandler data;
|
| public DocumentPayload()
| {
| }
|
| public DocumentPayload(DataHandler data)
| {
| this.data = data;
| }
|
| @XmlElement
| @XmlAttachmentRef
| public DataHandler getData()
| {
| return data;
| }
|
| public void setData(DataHandler data)
| {
| this.data = data;
| }
| }
|
and on client side:
| QName serviceName = new QName("http://server/", "FileTransferService");
| Service service = Service.create(new URL("http://127.0.0.1:8080/SOAP-test?wsdl"), serviceName);
| IFileTransfer port = service.getPort(IFileTransfer.class);
|
| // enable MTOM
| SOAPBinding binding = (SOAPBinding)((BindingProvider)port).getBinding();
| binding.setMTOMEnabled(true);
| DataHandler data = new DataHandler(new File("/opt/test.dat").toURI().toURL());
| DocumentPayload dp = (DocumentPayload)port.beanAnnotation(new DocumentPayload(data));
|
hopefully you understand my problem and can give some good advices
mendret
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4203697#4203697
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4203697
15 years, 11 months