3 Replies Latest reply on Oct 9, 2012 7:33 AM by kcbabo

    WSDL format error from WSDLReader

    tangblack

      wsdl error.png

      I write a BPM process to call webservice but get the exception when jBoss 7 tries to inital switchyard service (0.6.0-snapshot).

       

      console

      Caused by: org.switchyard.extensions.wsdl.WSDLReaderException: Service operations on a WSDL interface must have exactly one parameter.
                at org.switchyard.extensions.wsdl.WSDLReader.getParts(WSDLReader.java:182)
                at org.switchyard.extensions.wsdl.WSDLReader.readWSDL(WSDLReader.java:96)
                at org.switchyard.extensions.wsdl.WSDLService.fromWSDL(WSDLService.java:99)
                at org.switchyard.extensions.wsdl.WSDLService.fromWSDL(WSDLService.java:82)
                at org.switchyard.deploy.internal.Deployment.loadServiceInterface(Deployment.java:363)
                ... 10 more
      

       

       

      In my wsdl file (you can check the attached file), there are three parts under a message like below.

       

      EDI_Import_Ethan_SPort.wsdl

      <?xml version='1.0' encoding='UTF-8'?>
      <WL5G3N0:definitions name="EDI_Import_Ethan_S" targetNamespace="http://ct01/EDI_Import_Ethan_S.wsdl" xmlns="" xmlns:WL5G3N0="http://schemas.xmlsoap.org/wsdl/" xmlns:WL5G3N1="http://www.w3.org/2001/XMLSchema" xmlns:WL5G3N2="http://ct01/EDI_Import_Ethan_S.wsdl" xmlns:WL5G3N3="http://schemas.xmlsoap.org/wsdl/soap/">
        <WL5G3N0:types/>
        <WL5G3N0:message name="EDI_Import_Ethan_S_ctcEcProSoImportAll">
          <WL5G3N0:part name="pWfId" type="WL5G3N1:decimal"/>
          <WL5G3N0:part name="pOut_out" type="WL5G3N1:string"/>
          <WL5G3N0:part name="pRef_out" type="WL5G3N1:string"/>
        </WL5G3N0:message>
      ...
      

       

       

      WSDLReader only allows one part under one message so that's why I get the WSDLReaderException.

       

      WSDLReader.java

      https://github.com/jboss-switchyard/core/blob/master/extensions/wsdl/src/main/java/org/switchyard/extensions/wsdl/WSDLReader.java

          /**
           * Parse a definition element and return all message parts defined in it.
           *
           * @param defEl the definition element.
           * @param namespaces a map of namespaceURIs
           * @return a map of message parts.
           * @throws WSDLReaderException if the wsdl operation is improper
           */
          private Map<QName, QName> getParts(final Element defEl, final Map<String, String> namespaces) throws WSDLReaderException {
              NodeList messages = defEl.getElementsByTagNameNS(MESSAGE.getNamespaceURI(), MESSAGE.getLocalPart());
              int msgSize = messages.getLength();
              Map<QName, QName> parts = new HashMap<QName, QName>();
              for (int i = 0; i < msgSize; i++) {
                  Element msgEl = (Element) messages.item(i);
                  NodeList partEls = msgEl.getElementsByTagNameNS(PART.getNamespaceURI(), PART.getLocalPart());
                  if (partEls.getLength() != 1) { // !! There are 3 parts under the message tag !!
                      throw new WSDLReaderException("Service operations on a WSDL interface must have exactly one parameter.");
                  }
                  Element partEl = (Element) partEls.item(0);
                  parts.put(getQName(msgEl.getAttribute(ATTR_NAME), namespaces), getQName(partEl.getAttribute(ATTR_ELEMENT), namespaces));
              }
              return parts;
          }
      

       

       

      I check http://www.w3.org/TR/wsdl , multiple parts under the message should be proper in WSDL 1.1 .

       

      Example from http://www.w3.org/TR/wsdl

      <message name="GetTradePriceInput">
        <part name="tickerSymbol" element="xsd:string"/>
        <part name="time" element="xsd:timeInstant"/>
      </message>
      

       

       

      Could you explain why WSDLReader does this limit?

      Because this wsdl file is generated by other provider, how could I parse this wsdl without changing it?

       

      Thanks in advance!

        • 1. Re: WSDL format error from WSDLReader
          kcbabo

          This limit is in place for document/literal soap bindings and is consistent with the WS-I Basic Profile:

          http://ws-i.org/profiles/basicprofile-1.2-2010-11-09.html#Bindings_and_Parts

           

          In this case, you're actually using RPC literal, which is not supported in the SOAP gateway at this point.  It's currently in scope for 0.7, so you will likely be able to grab a SNAPSHOT version in about 3-4 weeks which will include support:

          https://issues.jboss.org/browse/SWITCHYARD-627

           

          Any chance you can use document/literal in the meantime?

          • 2. Re: WSDL format error from WSDLReader
            tangblack

            Any chance you can use document/literal in the meantime?

            You mean document/literal wrapped right?

            Bucause I find the sample code below (http://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/) and document/literal still has the same format that SwtichYard 0.6 doesn't support now.

             

            Listing 6. Document/literal WSDL for myMethod

             

            <types>
                <schema>
                    <element name="xElement" type="xsd:int"/>
                    <element name="yElement" type="xsd:float"/>
                </schema>
            </types>
            
             <message name="myMethodRequest"> <!-- There are 2 parts under the message tag !! -->
                <part name="x" element="xElement"/>
                <part name="y" element="yElement"/>
            </message>
            <message name="empty"/>
            
            <portType name="PT">
                <operation name="myMethod">
                    <input message="myMethodRequest"/>
                    <output message="empty"/>
                </operation>
            </portType>
            
            <binding .../> 
            <!-- I won't bother with the details, just assume it's document/literal. -->
            

            It's currently in scope for 0.7, so you will likely be able to grab a SNAPSHOT version in about 3-4 weeks

             

            These wsdl files are provided by legacy systems which only have RPC option.

            I think other users should face the same problem like this.

             

            I will look forward to 7.0!

            Thanks!

            • 3. Re: WSDL format error from WSDLReader
              kcbabo

              We support document literal consistent with WS-I Basic Profile.  That means a single message part.  An example of that is doc/lit wrapped, but it doesn't have to be.  Doc/lit wrapped is merely a strategy for wrapping RPC-style parameters inside a single part using a "wrapper" element.  Basically, any doc/lit binding which contains a single part will work with SwitchYard.

               

              In terms of RPC/literal, I hear you about legacy systems.  We'll get this sorted ASAP and look forward to your feedback.

              1 of 1 people found this helpful