create string representation of operation.

def _setContent(self):
        '''create string representation of operation.
        '''
        kwstring = 'kw = {}'
        tCheck = 'if isinstance(request, %s) is False:' % self.inputName
        bindArgs = ''
        if self.encodingStyle is not None:
            bindArgs = 'encodingStyle="%s", ' %self.encodingStyle

        if self.useWSA:
            wsactionIn = 'wsaction = "%s"' % self.inputAction
            wsactionOut = 'wsaction = "%s"' % self.outputAction
            bindArgs += 'wsaction=wsaction, endPointReference=self.endPointReference, '
            responseArgs = ', wsaction=wsaction'
        else:
            wsactionIn = '# no input wsaction'
            wsactionOut = '# no output wsaction'
            responseArgs = ''

        bindArgs += '**kw)'

        if self.do_extended:
            inputName = self.getOperation().getInputMessage().name
            wrap_str = ""
            partsList = self.getOperation().getInputMessage().parts.values()
            try:
                subNames = GetPartsSubNames(partsList, self._wsdl)
            except TypeError, ex:
                raise Wsdl2PythonError,\
                    "Extended generation failure: only supports doc/lit, "\
                    +"and all element attributes (<message><part element="\
                    +"\"my:GED\"></message>) must refer to single global "\
                    +"element declaration with complexType content.  "\
                    +"\n\n**** TRY WITHOUT EXTENDED ****\n"
                
            args = []
            for pa in subNames:
                args += pa

            for arg in args:
                wrap_str += "%srequest.%s = %s\n" % (ID2,
                                                     self.getAttributeName(arg),
                                                     self.mangle(arg))

            #args = [pa.name for pa in self.getOperation().getInputMessage().parts.values()]
            argsStr = ",".join(args)
            if len(argsStr) > 1: # add inital comma if args exist
                argsStr = ", " + argsStr

            method = [
                '%s# op: %s' % (ID1, self.getOperation().getInputMessage()),
                '%sdef %s(self%s):' % (ID1, self.name, argsStr),
                '\n%srequest = %s()' % (ID2, self.inputName),
                '%s' % (wrap_str),
                '%s%s' % (ID2, kwstring),
                '%s%s' % (ID2, wsactionIn),
                '%sself.binding.Send(None, None, request, soapaction="%s", %s'\
                %(ID2, self.soapaction, bindArgs),
            ]
        elif self.soap_input_headers:
            method = [
                '%s# op: %s' % (ID1, self.name),
                '%sdef %s(self, request, soapheaders=(), **kw):' % (ID1, self.name),
                '%s%s' % (ID2, tCheck),
                '%sraise TypeError, "%%s incorrect request type" %% (%s)' %(ID3, 'request.__class__'),
                '%s%s' % (ID2, wsactionIn),
                '%s# TODO: Check soapheaders' % (ID2),
                '%sself.binding.Send(None, None, request, soapaction="%s", soapheaders=soapheaders, %s'\
                %(ID2, self.soapaction, bindArgs),
            ]
        else:
            method = [
                '%s# op: %s' % (ID1, self.name),
                '%sdef %s(self, request, **kw):' % (ID1, self.name),
                '%s%s' % (ID2, tCheck),
                '%sraise TypeError, "%%s incorrect request type" %% (%s)' %(ID3, 'request.__class__'),
                '%s%s' % (ID2, wsactionIn),
                '%sself.binding.Send(None, None, request, soapaction="%s", %s'\
                %(ID2, self.soapaction, bindArgs),
            ]
        #
        # BP 1.0: rpc/literal
        # WSDL 1.1 Section 3.5 could be interpreted to mean the RPC response 
        # wrapper element must be named identical to the name of the 
        # wsdl:operation.
        # R2729

        #    
        # SOAP-1.1 Note: rpc/encoded
        # Each parameter accessor has a name corresponding to the name of the 
        # parameter and type corresponding to the type of the parameter. The name of 
        # the return value accessor is not significant. Likewise, the name of the struct is 
        # not significant. However, a convention is to name it after the method name 
        # with the string "Response" appended.
        #   
        if not self.outputName:
            method.append('%s#check for soap, assume soap:fault' %(ID2,))
            method.append('%sif self.binding.IsSOAP(): self.binding.Receive(None, **kw)' % (ID2,))
            self.writeArray(method)
            return
        
        response = ['%s%s' % (ID2, wsactionOut),]
        if self.isRPC() and not self.isLiteral():
            # rpc/encoded Replace wrapper name with None
            response.append(\
                '%stypecode = Struct(pname=None, ofwhat=%s.typecode.ofwhat, pyclass=%s.typecode.pyclass)' %(
                     ID2, self.outputName, self.outputName)
                )
            response.append(\
                '%sresponse = self.binding.Receive(typecode%s)' %(
                     ID2, responseArgs)
                )
        else:
            response.append(\
                '%sresponse = self.binding.Receive(%s.typecode%s)' %(
                     ID2, self.outputName, responseArgs)
                )

        # only support lit
        if self.soap_output_headers:
            sh = '['
            for shb in self.soap_output_headers:
                #shb.encodingStyle, shb.use, shb.namespace
                shb.message
                shb.part
                try:
                    msg = self._wsdl.messages[shb.message]
                    part = msg.parts[shb.part]
                    if part.element is not None:
                        sh += 'GED%s,' %str(part.element)
                    else:
                        warnings.warn('skipping soap output header in Message "%s"' %str(msg))
                except:
                    raise WSDLFormatError(
                      'failure processing output header typecodes, ' +
                      'could not find message "%s" or its part "%s"' %(
                               shb.message, shb.part)
                    )
                                 
            sh += ']'
            if len(sh) > 2:
                response.append(\
                '%sself.soapheaders = self.binding.ps.ParseHeaderElements(%s)' %(ID2, sh)
                )

        if self.outputSimpleType:
            response.append('%sreturn %s(response)' %(ID2, self.outputName))
        else: 
            if self.do_extended:
                partsList = self.getOperation().getOutputMessage().parts.values()
                subNames = GetPartsSubNames(partsList, self._wsdl)
                args = []
                for pa in subNames:
                    args += pa

                for arg in args:
                    response.append('%s%s = response.%s' % (ID2, self.mangle(arg), self.getAttributeName(arg)) )
                margs = ",".join(args)
                response.append("%sreturn %s" % (ID2, margs) )
            else:
                response.append('%sreturn response' %ID2)
        method += response

        self.writeArray(method)