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#...
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#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...