DII with Document/Literal remote WS from JBoss?
tachoknight Aug 19, 2010 5:44 PMHi all-
I'm trying to work with a document/literal-style web service from my program deployed on 4.2.3, and I keep getting a wsexception error "cannot obtain java mapping for:...". I'm more familar with RPC-style web services, so I'm a little confused about what I have to do to invoke this document-based web service using DII; generating stubs won't work because I'd have to create a new stub/redeploy for each remote service the program works with.
Here is the code I originally wrote and works with RPC-style web services. I've modified it in my attempt to make it work with the document type, but I keep getting the error I mentioned:
URL url = new URL(remoteInfo.getRemoteURL());
String nameSpace = remoteInfo.getRemoteWSNamespace();
QName qname = new QName(nameSpace,
remoteInfo.getRemoteWSServiceName());
QName port = new QName( nameSpace,
remoteInfo.getRemoteWSServicePort());
QName operation = new QName(nameSpace,
remoteInfo.getRemoteWSOperation());
ServiceFactory factory = ServiceFactory.newInstance();
Service service = factory.createService(url, qname);
Call call = service.createCall(port, operation);
call.addParameter("string", javax.xml.rpc.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
call.setReturnType(javax.xml.rpc.encoding.XMLType.XSD_STRING);
call.setProperty(Call.OPERATION_STYLE_PROPERTY, "document");
call.setProperty(Call.SOAPACTION_USE_PROPERTY, "true");
call.setProperty(Call.SOAPACTION_URI_PROPERTY, "");
String realUrl = remoteInfo.getRemoteURL();
call.setProperty(Call.SOAPACTION_URI_PROPERTY, realUrl.substring(0, realUrl.indexOf('?')));
/* Now we actually call the web service */
Object result = call.invoke(new Object[] { dataToDeliver.getDataToSend() });
Thanks for any info!