0 Replies Latest reply on Jun 27, 2011 7:00 AM by wueth_ ria

    Parsing the wsdl structure of a soap proxy?

    wueth_ ria Newbie

      In the "Webservice_proxy_versioning", there is a smooks file which transforms the wsdl inside the "soap proxy action". An element "processDate" is removed from the wsdl like this:

       

      WsdlTransform.xml:

       

      <?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' == 'processDate') {

                          DomUtils.removeElement(element, false);

                      }

                  }

                  -->

              </g:script>

          </g:groovy>

       

      </smooks-resource-list>

       

       

      Now I would like to  parse the wsdl in the following example but don't know how to assign the wsdl-tree to a variable:

       

      WsdlTransform.xml:

       

      <?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="complexType">

              <g:script>

             

              <!--   

                  use(DOMCategory) {

                  def xml = new XmlSlurper().parseText(element).declareNamespace(xs:'http://www.w3.org/2001/XMLSchema')

                  println xml.'xs:element'.name()

                  }

              -->

             

              </g:script>

          </g:groovy>

       

      </smooks-resource-list>

       

      This produces the error:

       

      Caused by: org.milyn.SmooksException: Failed to apply processing unit [org.milyn.smooks.scripting.groovy.SmooksVisitor_816196_1] to [org:milyn:smooks:unknowndoc:/definitions/types/xs:schema].

          at org.milyn.delivery.dom.SmooksDOMFilter.processVisitorException(SmooksDOMFilter.java:830)

          ... 35 more

       

      Caused by: groovy.lang.MissingMethodException: No signature of method: groovy.util.XmlSlurper.parseText() is applicable for argument types: (org.apache.xerces.dom.ElementNSImpl) values:

      {<?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="zupazu" version="1.0">

         <xs:complexType name="UserData">

          <xs:sequence>

           <xs:element name="username" type="xs:string"/>

           <xs:element name="password" type="xs:string"/>

          </xs:sequence>

         </xs:complexType>

         <xs:complexType name="PersonFilter">

          <xs:sequence>

           <xs:element minOccurs="0" name="personalnummer" type="xs:string"/>

           <xs:element minOccurs="0" name="vorname" type="xs:string"/>

           <xs:element minOccurs="0" name="nachname" type="xs:string"/>

           <xs:element minOccurs="0" name="inselVst" type="xs:string"/>

          </xs:sequence>

         </xs:complexType>

         <xs:complexType name="Personendaten">

          <xs:sequence>

           <xs:element minOccurs="0" name="personalnummer" type="xs:string"/>

           <xs:element minOccurs="0" name="titel" type="xs:string"/>

           <xs:element minOccurs="0" name="anrede" type="xs:string"/>

           <xs:element minOccurs="0" name="vorname" type="xs:string"/>

           <xs:element minOccurs="0" name="nachname" type="xs:string"/>

           <xs:element minOccurs="0" name="geschlecht" type="xs:int"/>

           <xs:element minOccurs="0" name="geburtsdatum" type="xs:dateTime"/>

           <xs:element minOccurs="0" name="adressePrivat" type="xs:string"/>

           <xs:element minOccurs="0" name="plzPrivat" type="xs:string"/>

           <xs:element minOccurs="0" name="ortPrivat" type="xs:string"/>

           <xs:element minOccurs="0" name="telefonPrivat" type="xs:string"/>

           <xs:element minOccurs="0" name="mobilePrivat" type="xs:string"/>

           <xs:element minOccurs="0" name="emailPrivat" type="xs:string"/>

           <xs:element minOccurs="0" name="emailGeschaeft" type="xs:string"/>

           <xs:element minOccurs="0" name="inselVst" type="xs:string"/>

           <xs:element minOccurs="0" name="eintrittsdatum" type="xs:dateTime"/>

           <xs:element minOccurs="0" name="austrittsdatum" type="xs:dateTime"/>

           <xs:element minOccurs="0" name="coAdresse" type="xs:string"/>

          </xs:sequence>

         </xs:complexType>

        </xs:schema>

      }

          at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:54)

          at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:169)

      ... 40 more

       

      Any idea how this can be done?