[Montag-users] Dynamic Invocation example
Status: Beta
Brought to you by:
sbtourist
|
From: Java D. <ja...@wi...> - 2005-11-19 02:14:24
|
I'm going nuts trying to get a dynamic example working, any
suggestions?:
<cite>
/* create a new service call */
javax.xml.rpc.ServiceFactory sf =
org.apache.axis.client.ServiceFactory.newInstance();
java.net.URL wsdlURL = new java.net.URL("http://localhost:8080/
montag/services/GetDocument?wsdl");
javax.xml.namespace.QName serviceQname = new
javax.xml.namespace.QName("http://montag.sourceforge.net/ns/wsdl/
local", "GetDocumentService");
javax.xml.rpc.Service service = sf.createService(wsdlURL,
serviceQname);
javax.xml.namespace.QName portQname = new javax.xml.namespace.QName
("http://localhost:8080/montag/services/GetDocument", "getDocument");
javax.xml.rpc.Call call = service.createCall(portQname);
/* set the endpoint address */
call.setTargetEndpointAddress("http://localhost:8080/montag/
services/GetDocument");
call.setProperty("javax.xml.rpc.encodingstyle.namespace.uri", "");
/* set parameters */
call.addParameter( "reports", XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter( "402880e405f4591f0105f55cf0000007.xml",
XMLType.XSD_STRING, ParameterMode.IN);
/* set the return type */
call.setReturnType(org.apache.axis.Constants.XSD_STRING);
Object[] params = {"reports","402880e405f4591f0105f55cf0000007.xml"};
/* invoke the web service call */
try {
result = (String) call.invoke(params);
}
catch (org.apache.axis.AxisFault f) {
System.out.println("Axis Fault:"+f.toString());
}
catch (Exception e) {
System.out.println("Exception:"+e.toString());
}
</cite>
Exception at "javax.xml.rpc.Service service = sf.createService
(wsdlURL, serviceQname);":
<cite>
2005-11-18 17:03:40,972 INFO [TimeLogger] URL: http://localhost:8080/
montag/services/GetDocument - Elaboration Time: 7ms
2005-11-18 17:03:40,990 ERROR [org.apache.axis.client.Service] Error
processing WSDL document:
javax.xml.rpc.ServiceException: Cannot find service: {http://
montag.sourceforge.net/ns/wsdl/local}GetDocumentService
javax.xml.rpc.ServiceException: Error processing WSDL document:
javax.xml.rpc.ServiceException: Cannot find service: {http://
montag.sourceforge.net/ns/wsdl/local}GetDocumentService
at org.apache.axis.client.Service.initService(Service.java:357)
at org.apache.axis.client.Service.initService(Service.java:287)
at org.apache.axis.client.Service.<init>(Service.java:194)
at org.jboss.webservice.client.ServiceImpl.<init>
(ServiceImpl.java:104)
at
org.jboss.webservice.client.ServiceFactoryImpl.createService
(ServiceFactoryImpl.java:112)
</cite>
For various reasons I prefer not to use the WSDL2Java stubs at this
point.
--Paul
|