Author: gnodet Date: Sat Feb 10 15:15:55 2007 New Revision: 505789 URL: http://svn.apache.org/viewvc?view=rev&rev=505789 Log: Fix wsdl description load for jbi endpoints
Modified: incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeContext.java incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/util/WSDLFlattener.java Modified: incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeContext.java URL: http://svn.apache.org/viewvc/incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeContext.java?view=diff&rev=505789&r1=505788&r2=505789 ============================================================================== --- incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeContext.java (original) +++ incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeContext.java Sat Feb 10 15:15:55 2007 @@ -24,6 +24,9 @@ import org.apache.ode.bpel.engine.BpelServerImpl; import org.apache.ode.bpel.iapi.Endpoint; import org.apache.ode.bpel.iapi.ProcessConf; +import org.apache.ode.bpel.o.OPartnerLink; +import org.apache.ode.bpel.o.OProcess; +import org.apache.ode.bpel.o.Serializer; import org.apache.ode.bpel.scheduler.quartz.QuartzSchedulerImpl; import org.apache.ode.jbi.msgmap.Mapper; import org.apache.ode.jbi.util.WSDLFlattener; @@ -167,10 +170,26 @@ OdeService service = new OdeService(this, endpoint); try { ProcessConf pc = _store.getProcessConfiguration(pid); - Definition def = pc.getDefinitionForService(endpoint.serviceName); - def = new WSDLFlattener(def).getDefinition(endpoint); - Document doc = WSDLFactory.newInstance().newWSDLWriter().getDocument(def); - addEndpointDoc(endpoint.serviceName, doc); + Serializer ofh = new Serializer(pc.getCBPInputStream()); + OProcess compiledProcess = ofh.readOProcess(); + QName portType = null; + for (Map.Entry<String, Endpoint> provide : pc.getProvideEndpoints().entrySet()) { + if (provide.getValue().equals(endpoint)) { + OPartnerLink plink = compiledProcess.getPartnerLink(provide.getKey()); + portType = plink.myRolePortType.getQName(); + break; + } + } + if (portType == null) { + if (__log.isDebugEnabled()) { + __log.debug("Could not find PortType for endpoint"); + } + } else { + Definition def = pc.getDefinitionForService(endpoint.serviceName); + def = new WSDLFlattener(def).getDefinition(portType); + Document doc = WSDLFactory.newInstance().newWSDLWriter().getDocument(def); + addEndpointDoc(endpoint.serviceName, doc); + } } catch (Exception e) { __log.warn("Exception during endpoint activation", e); } Modified: incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/util/WSDLFlattener.java URL: http://svn.apache.org/viewvc/incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/util/WSDLFlattener.java?view=diff&rev=505789&r1=505788&r2=505789 ============================================================================== --- incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/util/WSDLFlattener.java (original) +++ incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/util/WSDLFlattener.java Sat Feb 10 15:15:55 2007 @@ -19,7 +19,6 @@ import com.ibm.wsdl.extensions.schema.SchemaImpl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.ode.bpel.iapi.Endpoint; import javax.wsdl.*; import javax.wsdl.extensions.ExtensibilityElement; @@ -35,7 +34,7 @@ private Definition definition; private SchemaCollection schemas; - private Map<Endpoint,Definition> flattened; + private Map<QName, Definition> flattened; private boolean initialized; public WSDLFlattener() { @@ -68,16 +67,15 @@ /** * Retrieve a flattened definition for a given port type name. - * @param endpoint the port type to create a flat definition for + * @param portType the port type to create a flat definition for * @return a flat definition for the port type * @throws Exception if an error occurs */ - public Definition getDefinition(Endpoint endpoint) throws Exception { - Definition def = (Definition) flattened.get(endpoint); + public Definition getDefinition(QName portType) throws Exception { + Definition def = (Definition) flattened.get(portType); if (def == null) { - PortType pt = def.getService(endpoint.serviceName).getPort(endpoint.portName).getBinding().getPortType(); - def = flattenDefinition(pt.getQName()); - flattened.put(endpoint, def); + def = flattenDefinition(portType); + flattened.put(portType, def); } return def; }