When an module invokes a component that has a Web Service Descriptor Language (WSDL) port type interface, the module must invoke the component dynamically using the invoke() method.
Service service = (Service)serviceManager.locateService("multiParamInf"); Reference reference = service.getReference(); OperationType methodMultiType = reference.getOperationType("methodWithMultiParameter"); Type t = methodMultiType.getInputType(); BOFactory boFactory = (BOFactory)serviceManager.locateService ("com/ibm/websphere/bo/BOFactory"); DataObject paramObject = boFactory.createbyType(t); paramObject.set(0,"input1") paramObject.set(1,"input2") paramObject.set(2,"input3") service.invoke("methodMultiParamater",paramObject);
The following example uses the invoke method with a WSDL port type interface as the target.
Service serviceOne = (Service)serviceManager.locateService("multiParamInfWSDL"); DataObject dob = factory.create("http://MultiCallWSServerOne/bos", "SameBO"); dob.setString("attribute1", stringArg); DataObject wrapBo = factory.createByElement ("http://MultiCallWSServerOne/wsdl/ServerOneInf", "methodOne"); wrapBo.set("input1", dob); //wrapBo encapsulates all the parameters of methodOne wrapBo.set("input2", "XXXX"); wrapBo.set("input3", "yyyy"); DataObject resBo= (DataObject)serviceOne.invoke("methodOne", wrapBo);