7 Replies Latest reply on Jun 24, 2008 5:02 AM by kconner

    Issue in using responseXStreamConfig with SOAPClient respons

    evanyang

      I have a program that use jBossESB to hide 3 external web services with SOAPClient actions, jBossESB provides the CBR/transformation etc. while a client program simply sending a serialized Java message to the esb.
      Initially I use the responseAsOgnlMap=true on the SOAPClient which then I search for the value from the map and update the java object in the response actions (btw, is there a tutorial of how to use OGNL to reconstruct data object?), so the client will receive updated info in the end.

      But then I want to try the responseXStreamConfig, so I used the Sun's schemagen to create a xsd for my data objects, and deployed with the war that contains all the web services to jBossAS. The following is the example in the jboss-esb.xml

      <property name="responseXStreamConfig">
       <alias name="user" class="com.j2.soa.signup.data.User"
       namespace="http://127.0.0.1:8080/signupWAR-1.0-SNAPSHOT/SignupDataSchema.xsd" />
       <alias name="paymentMethod" class="com.j2.soa.signup.data.PaymentMethod"
       namespace="http://127.0.0.1:8080/signupWAR-1.0-SNAPSHOT/SignupDataSchema.xsd" />
       <alias name="service" class="com.j2.soa.signup.data.Service"
       namespace="http://127.0.0.1:8080/signupWAR-1.0-SNAPSHOT/SignupDataSchema.xsd" />
       <alias name="contactInfo" class="com.j2.soa.signup.data.ContactInfo"
       namespace="http://127.0.0.1:8080/signupWAR-1.0-SNAPSHOT/SignupDataSchema.xsd" />
      </property>
      


      How ever, the wsdl wrap the return data of the web service in a response, something like:
      <message name="SignupProcessor_allocatServiceResponse">
      <part name="return" type="tns:user"/>
      </message>
      


      And I got this exception in jBossESB:

      com.thoughtworks.xstream.mapper.CannotResolveClassException: allocatServiceResponse : No ClassLoaders found for: allocatServiceResponse
      at com.thoughtworks.xstream.mapper.DefaultMapper.realClass(DefaultMapper
      .java:49)
      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper
      .java:26)
      at com.thoughtworks.xstream.mapper.ClassAliasingMapper.realClass(ClassAl
      iasingMapper.java:76)
      ....

      So am I using it correctly? or do I need to provide an alias for the allocatServiceResponse? but where I can get it, since I no longer need a true web service client.
      Please help.



        • 1. Re: Issue in using responseXStreamConfig with SOAPClient res
          kconner

          Yes, you should include the response wrapper within your aliases as the mapper currently works on the full response body.

          • 2. Re: Issue in using responseXStreamConfig with SOAPClient res
            evanyang

             


            Yes, you should include the response wrapper within your aliases as the mapper currently works on the full response body.


            But how do I define this alias, the allocatServiceResponse was never an object, simply the message definition in the wsdl, no way this can be generated as a java object by any web service client wizard, so what is the class to be used? and how/where the xstream can find the actual class to load?



            • 3. Re: Issue in using responseXStreamConfig with SOAPClient res
              evanyang

              Sorry, do you mean I should make up a fake one? just s the xsteram can use it?

              • 4. Re: Issue in using responseXStreamConfig with SOAPClient res
                evanyang

                I created a fake AllocatServiceResponse object, and regenerated the xsd, changed the jboss-esb.xml with this alise:

                <alias name="allocatServiceResponse" class="com.j2.soa.signup.esb.data.AllocatServiceResponse"
                 namespace="http://127.0.0.1:8080/signupWAR-1.0-SNAPSHOT/SignupDataSchema.xsd" />
                


                but still getting the same exception, makes me wander it is not the alias configuration, this is something else.

                I may have to download the jboss esb source and see what the SOAPClient is doing with the responseXStreamConfig.

                I can't believe i need to create a fake class, even it worked, this is not right! Just wandering has any one out there have done the similar, and there was no problem? how about the test case from the jboss esb team? how was this done?

                • 5. Re: Issue in using responseXStreamConfig with SOAPClient res
                  kconner

                   

                  "evanyang" wrote:
                  I may have to download the jboss esb source and see what the SOAPClient is doing with the responseXStreamConfig.

                  We are doing nothing special with this, please check your WSDL to determine the correct element to map.

                  "evanyang" wrote:
                  I can't believe i need to create a fake class, even it worked, this is not right!

                  The SOAPClient is not doing anything fancy, just providing your action with access to the complete response body. If that response is wrapped then it has to be dealt with.

                  We agree that the current situation is not ideal, even though it does work, and are looking into alternatives.

                  "evanyang" wrote:
                  Just wandering has any one out there have done the similar, and there was no problem? how about the test case from the jboss esb team? how was this done?

                  Yes, it has been done before. (http://jira.jboss.com/jira/browse/JBESB-1334)

                  If you are still having no luck then please send me the WSDL for your service or, if possible, an simple testcase showing the issue.

                  • 6. Re: Issue in using responseXStreamConfig with SOAPClient res
                    evanyang

                    Thanks for the response, I have checked the JBESB-1334 and downloaded the attached quickstart programs. When I run the one "webservice_drools_intg" (the name of the tar is webservice_drools_intg-UPDATED.tar), I got the same exception:

                    No ClassLoader found for: getCustomerResponse

                    if I changed the alias name from "return" to "getCustomerResponse", then I will get this exception instead:

                    No ClassLoader found for: return

                    I am using jBoss-4.2.2.GA and jBossesb-4.3.GA. I don't think this has been fixed in the version I am using. Please verify.

                    • 7. Re: Issue in using responseXStreamConfig with SOAPClient res
                      kconner

                      The quickstarts attached to that issue do not work as they are, they demonstrated the original issue.

                      There were two modifications required to get that example to work
                      - configure the serialisation of the wrapping element
                      - allow field aliases to map 'return'

                      The first was a modification to the quickstart whereas the second also involved code changes to the ESB core.

                      Please send me your .esb file and I will fix it up for you.