3 Replies Latest reply on Mar 2, 2010 10:44 PM by Radhakrishna Bhat

    WSDL Wizard w/ SOAP, RequestContext, ComplexType and WSSE

    ClayMitchell

      Is it possible to run the wizard against a WSDL that uses a Request Context, SOAP, WSSE security and required input as a complexType?

       

      I've tried it and while it generated all the service and value objects, any time I try invoking the service, I get the following error:

       

      Array of input arguments did not contain a required parameter at position 1

       

      I don't even think the document is being sent to the server.

       

      I've read that in FB3, the wizard didn't handle SOAP services right and would ignore headers - I'm just trying to establish if it works at all and if I should continue trying to sort this out.

       

      The request document should look something like this:

       

      <soapenv:Envelope
          xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
         <soapenv:Header>
            <wsse:Security
                xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
               <wsse:UsernameToken>
                  <wsse:Username>12345</wsse:Username>
                  <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">12345</wsse:Password>
               </wsse:UsernameToken>
            </wsse:Security>
            <rc:RequestContext
                xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                xmlns:rc="http://www.mydomain.com/crme/request-context.xsd">
               <rc:Property rc:key="username">12345</rc:Property>
               <rc:Property rc:key="sourceapp">12345</rc:Property>
            </rc:RequestContext>
         </soapenv:Header>
         <soapenv:Body>
            <s0:getAssociatePortfolioByNBID
                xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
                xmlns:s0="http://www.mydomain.com/wsdl/gpbs/associatePortfolio/AssociatePortfolioService/v001"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xmlns:xsd="http://www.w3.org/2001/XMLSchema">
               <s0:nbid>NBD2ZXN</s0:nbid>
               <s0:attributeGroup>PARTYID</s0:attributeGroup>
            </s0:getAssociatePortfolioByNBID>
         </soapenv:Body>
      </soapenv:Envelope>
      
      



      Thanks!

        • 1. Re: WSDL Wizard w/ SOAP, RequestContext, ComplexType and WSSE
          MartinRose

          I was running into similar issues attempting to send a complex-typed request to a SOAP service.  Right up to the same error message, actually.  After a lot of googling and a little experimentation, I came up with an adjustment to the generated code that makes it work.

           

          (OBVersionDisclosure:  Flash Builder 4, Flex 4 SDK.)

           

          The generator produced an ActionScript class called [servicename], along with one named _Super_[servicename].  This service class gives you asynchronous RPC-style access to your SOAP methods.  For what we're doing, though, ignore the [servicename] class -- all the action is in the _Super_[servicename] class.

           

          Anyway, for each of these SOAP methods there is a same-named method on the Super class.  So if your SOAP method is named [mycall] and takes a data structure named [mycallstruct], it made an AS method that looks like this:

           

              public function [mycall]([mycallparam]:valueObjects.[mycallstruct]) : AsyncToken
              {
                  model_internal::loadWSDLIfNecessary();
                  var _internal_operation:AbstractOperation = _serviceControl.getOperation("[mycall]");
                  var _internal_token:AsyncToken = _internal_operation.send([mycallparam]) ;

           

                  return _internal_token;
              } 

           

          Which should be fine, except that it's throwing that "did not contain a required parameter" fault.

           

          Long story short:  It looks like the send(args) form of the remote operation call is a little broken.  Because all I had to do to make this method work as advertised is this:

           

              public function [mycall]([mycallparam]:valueObjects.[mycallstruct]) : AsyncToken
              {
                  model_internal::loadWSDLIfNecessary();
                  var _internal_operation:AbstractOperation = _serviceControl.getOperation("[mycall]");
                  _internal_operation.arguments = [mycallparam];
                  var _internal_token:AsyncToken = _internal_operation.send() ;

           

                  return _internal_token;
              } 

           

          which is the call form I found in posted code for previous versions of Flex.

           

          Well, that's the extent of my knowledge on the subject.  Hope it's helpful.

          • 2. Re: WSDL Wizard w/ SOAP, RequestContext, ComplexType and WSSE
            Radhakrishna Bhat Level 3

            You need to add SOAP headers manually in your generated code.

             

            var header:SOAPHeader = new SOAPHeader(qname,"Security");

            header.content = <XML header>;

            <WebService_Instance>.addHeader(header);

             

            If your using FB4, add this code to servicename.as class's constructor. Replace <Webservice_instance> with _serviceControl

             

            Please refer to http://livedocs.adobe.com/flex/3/html/help.html?content=data_access_3.html

             

             

            -Radhakrishna

            • 3. Re: WSDL Wizard w/ SOAP, RequestContext, ComplexType and WSSE
              Radhakrishna Bhat Level 3

              Hi MartinRose,

               

              If there are no parameters used in send() method, operation's 'arguments' value will be used. Either way it should successfully send the request parameter. Please file a bug at http://bugs.adobe.com/flex if you are facing any issue.

               

              -Radhakrishna