Create and return a soap service type defined for this instance
486250
def get_soap_object(self, client):
        
        def to_soap_attribute(attr):
            words = attr.split('_')
            words = words[:1] + [word.capitalize() for word in words[1:]]
            return ''.join(words)

        soap_object = client.factory.create(self.soap_name)
        for attr in self._attributes:
            value = getattr(self, attr)
            setattr(soap_object, to_soap_attribute(attr), value)

        return soap_object
527129
def create_service(self, *args, **kwargs):
        
        return self._client.create_service(*args, scope=self.id, **kwargs)
363224
private function createSoapHeaderObject(
        AdsServiceDescriptor $serviceDescriptor
    ) {
        // The SOAP header object is in the same namespace as the Ad Manager
        // service we are generating headers for.
        $reflectionClass = new ReflectionClass(
            $serviceDescriptor->getServiceClass()
        );

        return $this->reflection->createInstance(
            sprintf(
                '%s\\%s',
                $reflectionClass->getNamespaceName(),
                self::SOAP_HEADER_CLASS_NAME
            )
        );
    }
917468
def _AddType(type):
   
   type.Array = CreateArrayType(type)

   typeNS = GetWsdlNamespace(type._version)
   newType = _SetWsdlType(typeNS, type._wsdlName, type)
   if newType != type:
      raise RuntimeError("Duplicate wsdl type %s (already in typemap)" % (type._wsdlName))

   return type
1053071
function(service) {

		// Create self, which inherits from its parent
		var self = Object.create(this);

		// Inherit the prototype from its parent
		self.settings = Object.create(this.settings);

		// Define the default service
		if (service) {
			self.settings.default_service = service;
		}

		// Create an instance of Events
		self.utils.Event.call(self);

		return self;
	}
1374837
public function getSoapTypes()
    {
        if (null === $this->types) {

            $soapTypes = $this->__getTypes();
            foreach ($soapTypes as $soapType) {
                $properties = array();
                $lines = explode("\n", $soapType);
                if (!preg_match('/struct (.*) {/', $lines[0], $matches)) {
                    continue;
                }
                $typeName = $matches[1];

                foreach (array_slice($lines, 1) as $line) {
                    if ($line == '}') {
                        continue;
                    }
                    preg_match('/\s* (.*) (.*);/', $line, $matches);
                    $properties[$matches[2]] = $matches[1];
                }

                // Since every object extends sObject, need to append sObject elements to all native and custom objects
                if ($typeName !== 'sObject' && array_key_exists('sObject', $this->types)) {
                    $properties = array_merge($properties, $this->types['sObject']);
                }

                $this->types[$typeName] = $properties;
            }
        }

        return $this->types;
    }
1237717
def get_soap_object(self, client):
        
        record_data = super().get_soap_object(client)
        record_data.records = [Record(r).get_soap_object(client) for r in record_data.records]
        return record_data
194157
def create(self):
        
        self.service.create()

        os.environ[predix.config.get_env_key(self.use_class, 'host')] = self.get_eventhub_host()
        os.environ[predix.config.get_env_key(self.use_class, 'port')] = self.get_eventhub_grpc_port()
        os.environ[predix.config.get_env_key(self.use_class, 'wss_publish_uri')] = self.get_publish_wss_uri()
        os.environ[predix.config.get_env_key(self.use_class, 'zone_id')] = self.get_zone_id()
162351
def get_service(self, service_type=None):
        """"""
        for service in self._services:
            if service.type == service_type and service_type:
                return service
        return None
104116
def generateHeader(self, sObjectType):
    '''
    
    '''
    try:
      return self._sforce.factory.create(sObjectType)
    except:
      print 'There is not a SOAP header of type %s' % sObjectType
984952
def _CreateMethod(self, method_name):
    
    soap_service_method = getattr(self.suds_client.service, method_name)

    def MakeSoapRequest(*args):
      """Perform a SOAP call."""
      AddToUtilityRegistry('suds')
      self.SetHeaders(
          self._header_handler.GetSOAPHeaders(self.CreateSoapElementForType),
          self._header_handler.GetHTTPHeaders())

      try:
        return soap_service_method(
            *[_PackForSuds(arg, self.suds_client.factory,
                           self._packer) for arg in args])
      except suds.WebFault as e:
        if _logger.isEnabledFor(logging.WARNING):
          _logger.warning('Response summary - %s',
                          _ExtractResponseSummaryFields(e.document))

        _logger.debug('SOAP response:\n%s', e.document.str())

        if not hasattr(e.fault, 'detail'):
          exc = (googleads.errors.
                 GoogleAdsServerFault(e.document, message=e.fault.faultstring))
          raise exc  # Done this way for 2to3

        # Before re-throwing the WebFault exception, an error object needs to be
        # wrapped in a list for safe iteration.
        fault = e.fault.detail.ApiExceptionFault
        if not hasattr(fault, 'errors') or fault.errors is None:
          exc = (googleads.errors.
                 GoogleAdsServerFault(e.document, message=e.fault.faultstring))
          raise exc  # Done this way for 2to3

        obj = fault.errors
        if not isinstance(obj, list):
          fault.errors = [obj]

        exc = googleads.errors.GoogleAdsServerFault(e.document, fault.errors,
                                                    message=e.fault.faultstring)
        raise exc  # Done this way for 2to3

    return MakeSoapRequest
614535
def fromWSDL(self, wsdl):
        '''
        '''
        assert isinstance(wsdl, WSDLTools.WSDL), 'expecting WSDL instance'

        if len(wsdl.services) == 0:
            raise WsdlGeneratorError, 'No service defined'
            
        self.reset() 
        self.wsdl = wsdl
        self.setUpHeader()
        self.setUpImports()
                
        for service in wsdl.services:
            sd = self._service_class(service.name)
            self._services[service.name] = sd

            for port in service.ports:
                desc = BindingDescription(wsdl=wsdl)
                try:
                    desc.setUp(port.getBinding())
                except Wsdl2PythonError, ex:
                    continue
                
                for soc in desc.operations:
                    if not soc.hasInput(): continue
                    
                    self.messages.append(MessageWriter())
                    self.messages[-1].setUp(soc, port, input=True)
                    if soc.hasOutput():
                        self.messages.append(MessageWriter())
                        self.messages[-1].setUp(soc, port, input=False)
                
                for e in port.extensions:
                    if isinstance(e, WSDLTools.SoapAddressBinding):
                        sd.location = e.location

                self.setUpMethods(port)

            self.setUpClassDef(service)
            self.setUpInitDef(service)
513705
def make(class_name, base, schema):
    
    return type(class_name, (base,), dict(SCHEMA=schema))
987929
protected function createWSDL_binding()
    {
        /*
        <binding name="myServiceBinding" type="typens:myServicePort">
            <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
                <operation name="hello">
                    <soap:operation soapAction="urn:myServiceAction"/>
                    <input>
                        <soap:body use="encoded" namespace="urn:myService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
                    </input>
                    <output>
                        <soap:body use="encoded" namespace="urn:myService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
                    </output>
            </operation>
        </binding>
        */
        $binding = $this->wsdl->createElement('binding');
        $binding->setAttribute('name', $this->wsdlclassname . 'Binding');
        $binding->setAttribute('type', 'typens:' . $this->wsdlclassname . 'Port');
        $soap_binding = $this->wsdl->createElement('soap:binding');
        $soap_binding->setAttribute('style', 'rpc');
        $soap_binding->setAttribute('transport', self::SCHEMA_SOAP_HTTP);
        $binding->appendChild($soap_binding);
        foreach ($this->wsdlStruct[$this->wsdlclassname]['method'] as $name => $vars) {
            $operation = $this->wsdl->createElement('operation');
            $operation->setAttribute('name', $name);
            $binding->appendChild($operation);
            $soap_operation = $this->wsdl->createElement('soap:operation');
            $soap_operation->setAttribute(
                'soapAction',
                'urn:'.$this->wsdlclassname.'Action'
            );
            $operation->appendChild($soap_operation);
            $input  = $this->wsdl->createElement('input');
            $output = $this->wsdl->createElement('output');
            $operation->appendChild($input);
            $operation->appendChild($output);
            $soap_body = $this->wsdl->createElement('soap:body');
            $soap_body->setAttribute('use', 'encoded');
            $soap_body->setAttribute('namespace', 'urn:'.$this->namespace);
            $soap_body->setAttribute('encodingStyle', self::SOAP_SCHEMA_ENCODING);
            $input->appendChild($soap_body);
            $soap_body = $this->wsdl->createElement('soap:body');
            $soap_body->setAttribute('use', 'encoded');
            $soap_body->setAttribute('namespace', 'urn:'.$this->namespace);
            $soap_body->setAttribute('encodingStyle', self::SOAP_SCHEMA_ENCODING);
            $output->appendChild($soap_body);
        }
        $this->wsdl_definitions->appendChild($binding);
    }
1290652
public ServiceRefType<WebAppDescriptor> getOrCreateServiceRef()
   {
      List<Node> nodeList = model.get("service-ref");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new ServiceRefTypeImpl<WebAppDescriptor>(this, "service-ref", model, nodeList.get(0));
      }
      return createServiceRef();
   }
662961
def call( methodName, args )
      args = (args || {}) #.keys_to_sym!

      # Get Binding
      binding = @wsdl.bindings.getBindingForOperationName( @binding, methodName )
      if binding.size == 0
        raise SOAP::LCNoMethodError, "Undefined method `#{methodName}'"
      elsif binding.size > 1
        raise SOAP::LCError, "Ambigous method name `#{methodName}', please, specify a binding name"
      else
        binding = binding[0]
        @binding = binding.name
      end

      # Get Binding Operation
      binding_operation = binding.operations[methodName]

      # Get PortType
      portType = @wsdl.portTypes[binding.type.nns]
      portType_operation = portType.operations[methodName]

      # Get message for input operation
      input_message = @wsdl.messages[portType_operation[:input][:message].nns]

      # Create method
      soap_method = "<#{methodName} xmlns=\"#{@wsdl.targetNamespace}\">\n"
      input_message.parts.each do |_, attrs|
        case attrs[:mode]
          when :type
            if SOAP::XSD::ANY_SIMPLE_TYPE.include?( attrs[attrs[:mode]].nns )
              # Part refer to a builtin SimpleType
              soap_method << SOAP::XSD.displayBuiltinType( attrs[:name], args, 1, 1 )
            else
              # Part refer to an XSD simpleType or complexType defined in types
              element = @wsdl.types[attrs[attrs[:mode]].nns][:value]
              case element[:type]
                when :simpleType
                  soap_method << "<#{attrs[:name]}>\n#{element.display( @wsdl.types, args )}\n</#{attrs[:name]}>\n" # MAYBE ########## 
                when :complexType
                  soap_method << "<#{attrs[:name]}>\n#{element.display( @wsdl.types, args )}\n</#{attrs[:name]}>\n" # MAYBE ########## 
                else
                  raise SOAP::LCWSDLError, "Malformated part #{attrs[:name]}"
              end
            end
          when :element
            # Part refer to an XSD element
            element = @wsdl.types[attrs[attrs[:mode]].nns][:value]
            case element[:type]
              when :simpleType
                soap_method << element[element[:type]].display( @wsdl.types, args )
              when :complexType
                soap_method << element[element[:type]].display( @wsdl.types, args )
              else
                raise SOAL::LCWSDLError, "Malformated element `#{attrs[attrs[:mode]]}'"
            end
        
            ## TODO ---------- USE element[:key]
          else 
            raise SOAP::LCWSDLError, "Malformated part #{attrs[:name]}"
        end
      end
      soap_method += "</#{methodName}>\n"

      # Create SOAP Envelope
      envelope = soap_envelop do 
        soap_header + soap_body( soap_method )
      end

      # Create headers
      headers = Hash.new
      # Add SOAPAction to headers (if exist)
      action = begin
        binding_operation[:soapAction]
      rescue
        nil
      end
      headers['SOAPAction'] = action unless action.nil? or action.length == 0

      # Search URI
      service_port = @wsdl.services.getServicePortForBindingName( binding.name )
      address = service_port[:address]

      # Complete request
      @request = {
        :headers  => make_header( envelope, headers ),
        :envelope => envelope,
        :uri      => address,
        :wsdl     => @wsdl,
        :response => @wsdl.messages[portType_operation[:output][:message].nns].name,
        :binding  => @binding,
        :method   => methodName
      }
      
      return self
    end
1316801
def processRequest(cls, ps, **kw):
        
        resource = kw['resource']
        request = kw['request']

        root = _get_element_nsuri_name(ps.body_root)
        for key,method in inspect.getmembers(resource, inspect.ismethod):
            if (getattr(method, 'soapmethod', False) and method.root == root):
                break
        else:
            raise RuntimeError, 'Missing soap callback method for root "%s"' %root

        try:
            req = ps.Parse(method.requesttypecode)
        except Exception, ex:
            raise
        try:
            rsp = method.responsetypecode.pyclass()
        except Exception, ex:
            raise
        
        try:
            req,rsp = method(req, rsp)
        except Exception, ex:
            raise

        return rsp