1 Reply Latest reply on Mar 21, 2013 12:58 PM by ldimaggio

    Problem in 0.7? SOAP Binding - Request as Received by Transformer Corrupt?

    ldimaggio

      Hey everyone,

       

      I was updating this post from 2012 - https://community.jboss.org/en/switchyard/blog/2012/06/22/an-impatient-newbie-user-s-introduction-to-switchyard (where the reader is walked through creating a minimal SwitchYard project from scratch) when I encountered an odd problem. It looks like a request, when passed to a transformer, is corrupted.

       

      Some background, the original post created an 'helloworld' style project that performed some string concatenation. The project requires to/from transformers to convert elements to string and then back again. (The code for the transformer was actually copied from a 2012 demo program.  ;-)

       

      What I am seeing today, after having created a new version of the project - by the way - the editor (I'm working with 0.7) is great - I want to look at the nightly builds when I get a chance - is that a SOAP request in this format:

       

      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="tns">

         <soapenv:Header/>

         <soapenv:Body>

            <tns:sayHello>

               <!--Optional:-->

               <tns:arg0>abc</tns:arg0>

            </tns:sayHello>

         </soapenv:Body>

      </soapenv:Envelope>

       

      Results in the transformer extracting a null value for the 'arg0' parameter. The funny thing is that if the 'from' transformer performs a getTextContent() on the element that it receives, it is able to parse out the text value of the arg0 argument. I'm wondering if there is a WSDL-generation error here, as the problem seems to be in the element as it is received by the 'from' transformer - but the WSDL appears to be OK.

       

      Does this sound familiar to anyone?

       

       

      Many thanks!,

      Len D.

       

       

      {code}

      <?xml version="1.0" encoding="UTF-8"?>

      <wsdl:definitions name="HelloService" targetNamespace="tns" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="tns" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">

        <wsdl:types>

      <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="tns" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="tns">

        <xsd:element name="sayHello" type="tns:sayHello"/>

        <xsd:complexType name="sayHello">

          <xsd:sequence>

            <xsd:element minOccurs="0" name="arg0" type="xsd:string"/>

          </xsd:sequence>

        </xsd:complexType>

        <xsd:element name="sayHelloResponse" type="tns:sayHelloResponse"/>

        <xsd:complexType name="sayHelloResponse">

          <xsd:sequence>

            <xsd:element minOccurs="0" name="return" type="xsd:string"/>

          </xsd:sequence>

        </xsd:complexType>

      </xsd:schema>

        </wsdl:types>

        <wsdl:message name="sayHelloResponse">

          <wsdl:part name="parameters" element="tns:sayHelloResponse">

          </wsdl:part>

        </wsdl:message>

        <wsdl:message name="sayHello">

          <wsdl:part name="parameters" element="tns:sayHello">

          </wsdl:part>

        </wsdl:message>

        <wsdl:portType name="HelloServicePortType">

          <wsdl:operation name="sayHello" >

            <wsdl:input name="sayHello" message="tns:sayHello">

          </wsdl:input>

            <wsdl:output name="sayHelloResponse" message="tns:sayHelloResponse">

          </wsdl:output>

          </wsdl:operation>

        </wsdl:portType>

        <wsdl:binding name="HelloServiceSoapBinding" type="tns:HelloServicePortType">

          <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

          <wsdl:operation name="sayHello">

            <soap:operation soapAction="sayHello" style="document"/>

            <wsdl:input name="sayHello">

              <soap:body use="literal"/>

            </wsdl:input>

            <wsdl:output name="sayHelloResponse">

              <soap:body use="literal"/>

            </wsdl:output>

          </wsdl:operation>

        </wsdl:binding>

        <wsdl:service name="HelloService">

          <wsdl:port name="HelloServicePort" binding="tns:HelloServiceSoapBinding">

            <soap:address location="http://localhost:8080/switchyard-example/HelloService"/>

          </wsdl:port>

        </wsdl:service>

      </wsdl:definitions>

       

       

      <?xml version="1.0" encoding="UTF-8"?>

      <switchyard xmlns="urn:switchyard-config:switchyard:1.0" xmlns:bean="urn:switchyard-component-bean:config:1.0" xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" xmlns:soap="urn:switchyard-component-soap:config:1.0" name="switchyard-example" targetNamespace="urn:com.example.switchyard:switchyard-example:1.0">

        <sca:composite name="switchyard-example" targetNamespace="urn:com.example.switchyard:switchyard-example:1.0">

          <sca:component name="HelloServiceBean">

            <bean:implementation.bean class="com.example.switchyard.switchyard_example.HelloServiceBean"/>

            <sca:service name="HelloService">

              <sca:interface.java interface="com.example.switchyard.switchyard_example.HelloService"/>

            </sca:service>

          </sca:component>

          <sca:service name="HelloServicePortType" promote="HelloServiceBean/HelloService">

            <sca:interface.wsdl interface="HelloService.wsdl#wsdl.porttype(HelloServicePortType)"/>

            <soap:binding.soap>

              <soap:contextMapper/>

              <soap:wsdl>HelloService.wsdl</soap:wsdl>

              <soap:wsdlPort>HelloServicePort</soap:wsdlPort>

              <soap:socketAddr>8080</soap:socketAddr>

              <soap:endpointAddress>http://localhost:8080/switchyard-example/HelloService</soap:endpointAddress>

            </soap:binding.soap>

          </sca:service>

        </sca:composite>

      </switchyard>

      {code}

       

       

       

      https://www.dropbox.com/s/t6c3rjm4mhttppf/switchyard-example.zip