1 Reply Latest reply on Dec 20, 2005 12:34 PM by Alejandro Guizar

    Different target namespaces in bpel & wsdl file

    Martin Steinle Newbie

      Hi,

      I tried to use different target namespaces in the wsdl file and the bpel file. I took the helloWorld example and modified the wsdl file to have a different targetnamespace and the bpel file to reference portTpyes, messages etc. in the correct namespace. When I start the generate-service ant task, I end up with the following exception:

      [servicegen] 11:30:08,453 ERROR ProblemCollector : could not write service wsdl: service.wsdl
      [servicegen] WSDLException: faultCode=OTHER_ERROR: Can't find prefix for 'http://jbpm.org/examples/hello/wsdl'. Namespace prefixes must be set on the Definition object using the addNamespace(...) method.:
      [servicegen] at com.ibm.wsdl.util.xml.DOMUtils.getPrefix(Unknown Source)
      [servicegen] at com.ibm.wsdl.util.xml.DOMUtils.getQualifiedValue(Unknown Source)
      [servicegen] at com.ibm.wsdl.util.xml.DOMUtils.printQualifiedAttribute(Unknown Source)
      [servicegen] at com.ibm.wsdl.xml.WSDLWriterImpl.printPorts(Unknown Source)
      [servicegen] at com.ibm.wsdl.xml.WSDLWriterImpl.printServices(Unknown Source)
      [servicegen] at com.ibm.wsdl.xml.WSDLWriterImpl.printDefinition(Unknown Source)
      [servicegen] at com.ibm.wsdl.xml.WSDLWriterImpl.writeWSDL(Unknown Source)
      [servicegen] at org.jbpm.bpel.wsdl.util.WsdlUtil.writeFile(WsdlUtil.java:85)
      [servicegen] at org.jbpm.bpel.wsdl.util.ServiceGenerator.generatePortComponents(ServiceGenerator.java:150)
      [servicegen] at org.jbpm.bpel.ant.ServiceGeneratorTask.execute(ServiceGeneratorTask.java:42)
      [servicegen] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
      [servicegen] at org.apache.tools.ant.Task.perform(Task.java:364)
      [servicegen] at org.apache.tools.ant.Target.execute(Target.java:341)
      [servicegen] at org.apache.tools.ant.Target.performTasks(Target.java:369)
      [servicegen] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
      [servicegen] at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
      [servicegen] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
      [servicegen] at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
      [servicegen] at org.apache.tools.ant.Main.runBuild(Main.java:668)
      [servicegen] at org.apache.tools.ant.Main.startAnt(Main.java:187)
      [servicegen] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
      [servicegen] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)


      Here is my hello.bpel:
      <?xml version="1.0" encoding="UTF-8"?>
      <process name="helloWorld" targetNamespace="http://jbpm.org/examples/hello"
       xmlns:tns="http://jbpm.org/examples/hello"
       xmlns:wsdl="http://jbpm.org/examples/hello/wsdl"
       xmlns:bpel="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://schemas.xmlsoap.org/ws/2003/03/business-process/
       http://schemas.xmlsoap.org/ws/2003/03/business-process/"
       xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
      
       <partnerLinks>
       <!-- realizes the abstract relationship with the caller -->
       <partnerLink name="caller" partnerLinkType="wsdl:helloPLT" myRole="service"/>
       </partnerLinks>
      
       <variables>
       <!-- holds the incoming message -->
       <variable name="request" messageType="wsdl:nameMessage"/>
       <!-- holds the outgoing message -->
       <variable name="response" messageType="wsdl:greetingMessage"/>
       </variables>
      
       <sequence>
       <!-- receive a message carrying the name of a person -->
       <receive operation="sayHello" partnerLink="caller" portType="wsdl:helloPT"
       variable="request" createInstance="yes"/>
       <!-- compose a greeting phrase containing the name -->
       <assign>
       <copy>
       <from expression="concat('Hello, ',
       bpel:getVariableData('request', 'name'), '!')"/>
       <to variable="response" part="greeting"/>
       </copy>
       </assign>
       <!-- reply with a message carrying the greeting -->
       <reply operation="sayHello" partnerLink="caller" portType="wsdl:helloPT"
       variable="response"/>
       </sequence>
      
      </process>


      My hello.wsdl:
      <?xml version="1.0" encoding="UTF-8"?>
      <definitions targetNamespace="http://jbpm.org/examples/hello/wsdl"
       xmlns:tns="http://jbpm.org/examples/hello/wsdl"
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
       xmlns:plt="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://schemas.xmlsoap.org/wsdl/
       http://schemas.xmlsoap.org/wsdl/
       http://schemas.xmlsoap.org/ws/2003/05/partner-link/
       http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
       xmlns="http://schemas.xmlsoap.org/wsdl/">
      
       <!-- characterizes the relationship between the process and its caller -->
       <plt:partnerLinkType name="helloPLT">
       <plt:role name="service">
       <plt:portType name="tns:helloPT"/>
       </plt:role>
       </plt:partnerLinkType>
      
       <!-- carries the name of a person -->
       <message name="nameMessage">
       <part name="name" type="xsd:string"/>
       </message>
      
       <!-- carries the greeting -->
       <message name="greetingMessage">
       <part name="greeting" type="xsd:string"/>
       </message>
      
       <!-- describes the interface presented to callers -->
       <portType name="helloPT">
       <operation name="sayHello">
       <input message="tns:nameMessage"/>
       <output message="tns:greetingMessage"/>
       </operation>
       </portType>
      
      </definitions>


      and the bpel-definition.xml:
      <?xml version="1.0" encoding="UTF-8"?>
      <!-- specifies the location of the process definition -->
      <bpelDefinition location="hello.bpel"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://jbpm.org/bpel
       http://jbpm.org/bpel/bpel_definition_1_0.xsd"
       xmlns="http://jbpm.org/bpel" >
      
       <!-- makes WSDL interface elements available to the process -->
       <imports>
       <wsdl namespace="http://jbpm.org/examples/hello/wsdl" location="hello.wsdl"/>
       </imports>
      
      </bpelDefinition>


      Looking at the code, I found that only the target namespace of the bpel file is added to the Definition object from which the service.wsdl is generated. Could this be a bug?

      Regards,
      stone_42