0 Replies Latest reply on Nov 1, 2006 7:57 AM by miket

    Assigning to one of many elements (maxOccurs="unbounded")

    miket

      I've just started to investigating the JBoss jBPM/BPEL piece (so please excuse me if my use of the terminology is a little flaky) and I'm trying to adapt it to work with the following complex message type (SWMSubmission):

       <types>
      
       <schema targetNamespace="urn:samples:swmessage" xmlns="http://www.w3.org/2001/XMLSchema">
      
       <complexType name="SWMKeyValuePair">
       <sequence>
       <element name="swmName" type="xsd:string" minOccurs="1" maxOccurs="1"/>
       <element name="swmValue" type="xsd:string" minOccurs="1" maxOccurs="1"/>
       </sequence>
       </complexType>
      
       <complexType name="SWMSubmission">
       <sequence>
       <element name="swmEventName" type="xsd:string" minOccurs="1" maxOccurs="1"/>
       <element name="swmEventData" type="typ:SWMKeyValuePair" minOccurs="1" maxOccurs="unbounded"/>
       </sequence>
       </complexType>
      
       </schema>
      
       </types>
      


      In my bpel process document I declare a variable:

       <variable name="swmSubmission" messageType="swm:swmSubmission" />
      


      and attempt to assign values to it:

       <assign name="fillSWMessage">
       <copy>
       <from variable="balanceChange" part="customerName" />
       <to variable="swmSubmission" part="body"
       query="/body/swmEventName" />
       </copy>
       <copy>
       <from variable="balanceChange" part="customerName"/>
       <to variable="swmSubmission" part="body"
       query="/body/swmEventData[1]/swmName" />
       </copy>
       <copy>
       <from variable="balanceChange" part="customerName" />
       <to variable="swmSubmission" part="body"
       query="/body/swmEventData[1]/swmValue" />
       </copy>
       </assign>
      


      When fully deployed and the service invoked I get an error. If I remove the parts of the 'assign' that access the (possible) multiple elements then everything works:

       <assign name="fillSWMessage">
       <copy>
       <from variable="balanceChange" part="customerName" />
       <to variable="swmSubmission" part="body"
       query="/body/swmEventName" />
       </copy>
       </assign>
      


      so I'm assuming I've made some basic error in my use of this complex type somewhere. The error I get is shown below:

      2006-11-01 10:47:00,462 DEBUG [org.jboss.ws.server.ServiceEndpoint] Outgoing SOAPMessage
      <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
       <env:Header/>
       <env:Body>
       <env:Fault>
       <faultcode>env:Server</faultcode>
       <faultstring>The service is not in an appropiate state for the requested operation</faultstring>
       </env:Fault>
       </env:Body>
      </env:Envelope>
      2006-11-01 10:47:00,462 ERROR [org.jboss.ws.server.ServiceEndpoint] Cannot process metrics
      java.lang.ClassCastException: org.jboss.ws.soap.SOAPBodyElementDoc
       at org.jboss.ws.soap.SOAPBodyImpl.getFault(SOAPBodyImpl.java:121)
       at org.jboss.ws.server.ServiceEndpoint.handleRequest(ServiceEndpoint.java:262)
       at org.jboss.ws.server.ServiceEndpointServlet.doPost(ServiceEndpointServlet.java:120)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Thread.java:595)
      
      


      but this seems to be the response to any kind of problem (in fact I get this error intermittently using the tutorial as boxed).

      I wasn't sure whether indexing of swmEventData should start at 0 or 1 so I tried them both with no joy. Is there some sort of intialisation I should be doing? Any help would be appreciated.