2 Replies Latest reply on Jun 24, 2011 3:44 AM by wueth_ ria

    How to transform am SOAP proxy

    wueth_ ria Newbie

      We have a soap proxy action which routes an external Webservice trough the ESB.  A smooks action transforms the soap response to a string.  Now we would like to add the string from smooks transformation to our soap proxy service so that the string is returned inside the soap response.

       

      We tried to add the string as additional element via the "wsdlTransform" property inside the soap proxy which does not really function so far.

       

      The first problem we have is to just add the additional field to the wsd with the following smooks-file as wsdlTransform property:

       

      <?xml version="1.0"?>

      <smooks-resource-list

          xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"

          xmlns:g="http://www.milyn.org/xsd/smooks/groovy-1.1.xsd">

       

          <g:groovy executeOnElement="element">

              <g:script>

                  <!--

                  use(DOMCategory) {

                  if (element.'@name' == 'username') {

                          DomUtils.insertBefore("testelement", "username");

                      }

                  }

                  -->

              </g:script>

          </g:groovy>

       

      </smooks-resource-list>

       

      The wsdl can't be loeaded inside the browser anymore:

       

      Failed to load WSDL contract information from address 'http://localhost:8080/testwebservice?wsdl': Unable to filter InputStream for target profile [org.milyn.profile.Profile#default_profile].

       

      We don't really see, where the problem is.. do we have to transform the soap request?

        • 1. Re: How to transform am SOAP proxy
          Tom Cunningham Master

          Can you post your jboss-esb.xml?

          • 2. Re: How to transform am SOAP proxy
            wueth_ ria Newbie

            We managed now to simply add a additional tag to the soap message (request an answer). We also were able to remove an xml-element from the wsdl: when we call the endpoint url (http://......./testwebservice?wsdl), the tag is not visible anymore. What we still aren't able to do ist to ADD an xml-element to the transformed wsdl. To which we would like to write the string from the smooks transformation to the added element (this smooks transformation ist not included in the jboss-esb.xml yet).

             

            Here the jboss-esb.xml:

             

            <?xml version="1.0"?>

            <jbossesb parameterReloadSecs="5"

                xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd"

                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                xsi:schemaLocation="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd

                     http://anonsvn.jboss.org/repos/labs/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd">

                <providers>

                    <http-provider name="HTTP-PROVIDER">

                        <http-bus busid="HTTP-BUS" />

                    </http-provider>

                </providers>

                <services>

                    <service category="pariswebservice" description="ZupazuCSV" invmScope="GLOBAL"

                       name="pariswebservice">

                        <listeners>

                            <http-gateway busidref="HTTP-BUS" name="MySoapProxyServiceGwListener2"

                              urlPattern="/testwebservice" />

                        </listeners>

                        <actions mep="RequestResponse">

                            <action class="org.jboss.soa.esb.actions.SystemPrintln" name="println: Incoming Request">

                                <property name="message" value="Incoming Request" />

                            </action>

                            <action class="org.jboss.soa.esb.smooks.SmooksAction" name="testTransformation">

                                <!-- Add an xml element to the soap request -->

                                <property name="smooksConfig" value="/SoapRequestTransform.xml" />

                            </action>

                            <action class="org.jboss.soa.esb.actions.SystemPrintln" name="println: Outgoing Request">

                                <property name="message" value="Outgoing Reques" />

                            </action>

                            <action class="org.jboss.soa.esb.actions.soap.proxy.SOAPProxy" name="proxy">

                                <property name="wsdl" value="http://externalWebservice?wsdl" />

                                <property name="wsdlTransform" value="/WsdlTransform.xml" />

                            </action>

                            <action class="org.jboss.soa.esb.actions.SystemPrintln" name="println: Incoming Response">

                                <property name="message" value="Incoming Response" />

                            </action>

                            <action class="org.jboss.soa.esb.smooks.SmooksAction" name="transform">

                                <!-- Add an xml element to the soap response -->

                                <property name="smooksConfig" value="/SoapResponseTransform.xml" />

                                <property name="resultType" value="STRING" />

                            </action>

                            <action class="org.jboss.soa.esb.actions.SystemPrintln" name="println: Outgoing Response">

                                <property name="message" value="Outgoing Response" />

                            </action>

                        </actions>

                    </service>

                </services>

            </jbossesb>