FYI those were changes I made for DynamicService.java

2009/10/29 Pascal Aho <[email protected]>:
> Hi Rafal,
>
> I now fix the bug in my version of ODE and can work without error with 
> complex type.
>
> Thank you again for your help. It was important.
>
> Cheers,
>
> Pascal.
>
>
>
> -------- Original-Nachricht --------
>> Datum: Thu, 29 Oct 2009 15:19:32 +0100
>> Von: Rafal Rusin <[email protected]>
>> An: [email protected]
>> Betreff: Re: complex type
>
>> As I remember, there was a small bug in ODE, which caused that.
>> Instead of looking for
>> org.apache.ode.bpel.pmapi.PolicyDocument.Factory, it should look for
>> org.apache.ode.bpel.pmapi.PolicyDocument$Factory
>> I fixed it to get replayer working. So you can check out latest ODE
>> 1.X to have it working.
>> Additionally you can check out ReplayerJbiTest in jbi package to have
>> an example of complex type invocations via management api (replay
>> operation).
>>
>> 2009/10/29 Pascal Aho <[email protected]>:
>> > Hello everybody,
>> >
>> > I create a complex Type and use it as type for an input of a web service
>> method.
>> >
>> > xmlBean creates automatically the corresponding classes.
>> >
>> > I can build the project without error.
>> > But when I try to call the method of the web service I get an error.
>> >
>> > The class created by xmlBean contains a subclass Factory, which reflect
>> class should be automatically created when the class corresponding to the
>> complex type is created. Following is the error I get
>> >
>> > <soapenv:Envelope
>> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
>> >   <soapenv:Body>
>> >      <soapenv:Fault>
>> >         <faultcode>soapenv:Server</faultcode>
>> >         <faultstring>java.lang.RuntimeException: Couldn't find class
>> org.apache.ode.bpel.pmapi.PolicyDocument.Factory to instantiate xml
>> bean</faultstring>
>> >         <detail>
>> >            <axis2ns1:RuntimeException
>> xmlns:axis2ns1="http://www.apache.org/ode/pmapi";>java.lang.RuntimeException: 
>> Couldn't find class
>> org.apache.ode.bpel.pmapi.PolicyDocument.Factory to instantiate xml bean
>> >        at
>> org.apache.ode.il.DynamicService.convertFromOM(DynamicService.java:137)
>> >        at
>> org.apache.ode.il.DynamicService.extractParams(DynamicService.java:98)
>> >        at
>> org.apache.ode.il.DynamicService.invoke(DynamicService.java:69)
>> >        at
>> org.apache.ode.axis2.service.SubscriptionService$SubscriptionMessageReceiver.invokeBusinessLogic(SubscriptionService.java:124)
>> >        at
>> org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:96)
>> >        at
>> org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:145)
>> >        at
>> org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
>> >        at
>> org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:120)
>> >        at
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
>> >        at
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>> >        at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
>> >        at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>> >        at
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>> >        at
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>> >        at
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>> >        at
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>> >        at
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>> >        at
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
>> >        at
>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
>> >        at
>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>> >        at
>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
>> >        at java.lang.Thread.run(Thread.java:595)
>> > Caused by: java.lang.ClassNotFoundException:
>> org.apache.ode.bpel.pmapi.PolicyDocument.Factory
>> >        at
>> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
>> >        at
>> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
>> >        at
>> java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
>> >        at java.lang.Class.forName0(Native Method)
>> >        at java.lang.Class.forName(Class.java:164)
>> >        at
>> org.apache.ode.il.DynamicService.convertFromOM(DynamicService.java:133)
>> >        ... 21 more</axis2ns1:RuntimeException>
>> >         </detail>
>> >      </soapenv:Fault>
>> >   </soapenv:Body>
>> > </soapenv:Envelope>
>> >
>> >
>> > Thanks,
>> >
>> > Pascal.
>> > --
>> > Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox
>> 3.5 -
>> > sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser
>> >
>>
>>
>> Regards,
>> --
>> Rafał Rusin
>> http://www.touk.pl
>> http://top.touk.pl
>> http://people.apache.org/~rr/
>
> --
> Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 -
> sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser
>



-- 
Rafał Rusin
http://www.touk.pl
http://top.touk.pl
http://people.apache.org/~rr/
commit b8541de13b47b7df4cf317d4b9af5d6d522412c3
Author: Rafal Konrad Rusin <[email protected]>
Date:   Tue Sep 8 19:15:39 2009 +0000

    ODE-483: Instance replayer + test case + some code formatting
    
    git-svn-id: https://svn.apache.org/repos/asf/ode/branches/apache_ode_...@812654 13f79535-47bb-0310-9956-ffa450edef68

diff --git a/bpel-epr/src/main/java/org/apache/ode/il/DynamicService.java b/bpel-epr/src/main/java/org/apache/ode/il/DynamicService.java
index ab1b1b2..a2d384d 100644
--- a/bpel-epr/src/main/java/org/apache/ode/il/DynamicService.java
+++ b/bpel-epr/src/main/java/org/apache/ode/il/DynamicService.java
@@ -33,7 +33,9 @@ import javax.xml.stream.XMLStreamReader;
 import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.impl.dom.NamespaceImpl;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.ode.bpel.pmapi.ProcessInfoCustomizer;
@@ -69,7 +71,10 @@ public class DynamicService<T> {
             Object result = invokedMethod.invoke(_service, params);
             OMElement response = null;
             if (result != null) {
-                response = OM.createOMElement(new QName(payload.getNamespace().getNamespaceURI(), methodName+"Response"));
+                if (__log.isDebugEnabled())
+                    __log.debug("Invoke: operation "+operation+" on "+_clazz + ":\n" + payload + "\nOM:" + OM + " namespace:" + payload.getNamespace());
+                response = OM.createOMElement(new QName((payload.getNamespace() == null ? "" : payload.getNamespace().getNamespaceURI()), methodName+"Response"));
+
                 OMElement parts = convertToOM(result);
                 parts = stripNamespace(parts);
                 response.addChild(parts);
@@ -128,9 +133,11 @@ public class DynamicService<T> {
             return alist.toArray((Object[]) Array.newInstance(targetClazz, alist.size()));
         } else if (XmlObject.class.isAssignableFrom(clazz)) {
             try {
-                Class beanFactory = Class.forName(clazz.getCanonicalName() + ".Factory");
+                Class beanFactory = clazz.forName(clazz.getCanonicalName() + "$Factory");
+                elmt.setNamespace(new NamespaceImpl(""));
+                elmt.setLocalName("xml-fragment");
                 return beanFactory.getMethod("parse", XMLStreamReader.class)
-                        .invoke(elmt.getXMLStreamReaderWithoutCaching());
+                        .invoke(null, elmt.getXMLStreamReaderWithoutCaching());
             } catch (ClassNotFoundException e) {
                 throw new RuntimeException("Couldn't find class " + clazz.getCanonicalName() + ".Factory to instantiate xml bean", e);
             } catch (IllegalAccessException e) {

Reply via email to