/** * Get the PortType name for the service which has been specified by serviceName and portName at construction time. * * @return QName of the PortType. */ public QName getPortTypeQName() { Binding b = _port.getBinding(); return b.getPortType().getQName(); }
/** * Get the name of the current port. * * @return Name of the current port. */ public String getPortName() { return _port.getName(); }
/** * Get the target namespace for the WSDL. * * @return The targetNamespace */ public String getTargetNamespace() { return _wsdlDefinition.getTargetNamespace(); }
private void loadParameters( Operation op ) throws KettleStepException { Input input = op.getInput(); if ( input != null ) { Message in = input.getMessage(); List<Object> paramOrdering = op.getParameterOrdering(); List<Part> inParts = in.getOrderedParts( paramOrdering ); Output output = op.getOutput(); if ( output != null ) { Message out = output.getMessage(); List<Part> outParts = out.getOrderedParts( null );
/** * Get a list of all operations defined in this WSDL. * * @return List of WsdlOperations. */ @SuppressWarnings( "unchecked" ) public List<WsdlOperation> getOperations() throws KettleStepException { List<WsdlOperation> opList = new ArrayList<WsdlOperation>(); PortType pt = _port.getBinding().getPortType(); List<Operation> operations = pt.getOperations(); for ( Iterator<Operation> itr = operations.iterator(); itr.hasNext(); ) { WsdlOperation operation = getOperation( itr.next().getName() ); if ( operation != null ) { opList.add( operation ); } } return opList; }
throw new RuntimeException( "Could not load WSDL file: " + e.getMessage(), e ); } catch ( KettleException e ) { throw new RuntimeException( "Could not load WSDL file: " + e.getMessage(), e ); _service = (Service) _wsdlDefinition.getServices().values().iterator().next(); } else { _service = _wsdlDefinition.getService( serviceQName ); if ( _service == null ) { throw new IllegalArgumentException( "Service: " _port = getSoapPort( _service.getPorts().values() ); } else { _port = _service.getPort( portName ); if ( _port == null ) { throw new IllegalArgumentException( "Port: " + portName + " is not defined in the service: " + serviceQName ); } else { _port = _service.getPort( portName );
/** * Create a WsdlOpFault from the Fault. * * @param fault * Fault to process. * @return WsdlOpFault Result of processing. */ @SuppressWarnings( "unchecked" ) private WsdlOpFault getFault( Fault fault ) throws KettleStepException { Message m = fault.getMessage(); // a fault should only have one message part. Map<?, Part> partMap = m.getParts(); if ( partMap.size() != 1 ) { throw new IllegalArgumentException( "Invalid part count for fault!!" ); } Part faultPart = partMap.values().iterator().next(); boolean complexType = false; // type of fault is specified either in Part's type or element attribute. QName type = faultPart.getTypeName(); if ( type == null ) { type = faultPart.getElementName(); Element schemaElement = _wsdlTypes.findNamedElement( type ); type = _wsdlTypes.getTypeQName( schemaElement.getAttribute( "type" ) ); complexType = true; } return new WsdlOpFault( fault.getName(), type, complexType, _wsdlTypes ); } }
/** * Generate a WsdlOpParameter from the message part. * * @param part * A list of message part. * @param requesPart * true if part from request message. */ private List<WsdlOpParameter> getParameter( Part part, boolean requesPart ) throws KettleStepException { List<WsdlOpParameter> params = new ArrayList<WsdlOpParameter>(); if ( part.getElementName() != null ) { if ( WsdlUtils.isWrappedParameterStyle( _operation.getName(), !requesPart, part.getName() ) ) { _parameterStyle = WsdlOperation.SOAPParameterStyle.WRAPPED; } params.addAll( resolvePartElement( part ) ); } else { params.add( new WsdlOpParameter( part.getName(), part.getTypeName(), _wsdlTypes.findNamedType( part .getTypeName() ), _wsdlTypes ) ); } return params; }
/** * Create a new for WsdlTypes instance for the specified WSDL definition. * * @param wsdlDefinition * The WSDL definition. */ @SuppressWarnings( "unchecked" ) protected WsdlTypes( Definition wsdlDefinition ) { _types = wsdlDefinition.getTypes(); _targetNamespace = wsdlDefinition.getTargetNamespace(); _prefixMappings = wsdlDefinition.getNamespaces(); _elementFormQualifiedNamespaces = new HashSet<String>( getElementFormQualifiedNamespaces() ); _namedComplexTypes = new WsdlComplexTypes( this ); }
/** * Find the specified operation in the WSDL definition. * * @param operationName * Name of operation to find. * @return A WsdlOperation instance, null if operation can not be found in WSDL. */ public WsdlOperation getOperation( String operationName ) throws KettleStepException { // is the operation in the cache? if ( _operationCache.containsKey( operationName ) ) { return _operationCache.get( operationName ); } Binding b = _port.getBinding(); PortType pt = b.getPortType(); Operation op = pt.getOperation( operationName, null, null ); if ( op != null ) { try { WsdlOperation wop = new WsdlOperation( b, op, _wsdlTypes ); // cache the operation _operationCache.put( operationName, wop ); return wop; } catch ( KettleException kse ) { LogChannel.GENERAL.logError( "Could not retrieve WSDL Operator for operation name: " + operationName ); throw new KettleStepException( "Could not retrieve WSDL Operator for operation name: " + operationName, kse ); } } return null; }
public Wsdl( WSDLLocator wsdlLocator, QName serviceQName, String portName, String username, String password ) throws AuthenticationException { // load and parse the WSDL try { _wsdlDefinition = parse( wsdlLocator, username, password ); } catch ( AuthenticationException ae ) { // throw it again or KettleException will catch it throw ae; } catch ( WSDLException e ) { throw new RuntimeException( "Could not load WSDL file: " + e.getMessage(), e ); } catch ( KettleException e ) { throw new RuntimeException( "Could not load WSDL file: " + e.getMessage(), e ); } _service = _wsdlDefinition.getService( serviceQName ); if ( _service == null ) { throw new IllegalArgumentException( "Service: " + serviceQName + " is not defined in the WSDL file." ); } _port = _service.getPort( portName ); if ( _port == null ) { throw new IllegalArgumentException( "Port: " + portName + " is not defined in the service: " + serviceQName ); } _wsdlTypes = new WsdlTypes( _wsdlDefinition ); _operationCache = new HashMap<String, WsdlOperation>(); }
BindingOperation bindingOperation = binding.getBindingOperation( operationName, null, null ); BindingInput bindingInput = bindingOperation.getBindingInput(); if ( bindingInput != null ) { ExtensibilityElement soapBodyElem = return ( (SOAP12BodyImpl) soapBodyElem ).getUse(); } else { return ( (SOAPBody) soapBodyElem ).getUse(); BindingOutput bindingOutput = bindingOperation.getBindingOutput(); if ( bindingOutput != null ) { ExtensibilityElement soapBodyElem = return ( (SOAP12BodyImpl) soapBodyElem ).getUse(); } else { return ( (SOAPBody) soapBodyElem ).getUse();
BindingOperation bindingOperation = binding.getBindingOperation( operationName, null, null ); if ( bindingOperation == null ) { throw new IllegalArgumentException( "Can not find operation: " + operationName ); BindingInput bindingInput = bindingOperation.getBindingInput(); if ( bindingInput != null ) { headers.addAll( WsdlUtils.findExtensibilityElements( bindingInput, SOAP_HEADER_ELEMENT_NAME ) ); BindingOutput bindingOutput = bindingOperation.getBindingOutput(); if ( bindingOutput != null ) { headers.addAll( WsdlUtils.findExtensibilityElements( bindingOutput, SOAP_HEADER_ELEMENT_NAME ) ); for ( ExtensibilityElement element : headers ) { if ( element instanceof SOAP12Header ) { headerSet.add( ( (SOAP12Header) element ).getPart() ); } else { headerSet.add( ( (SOAPHeader) element ).getPart() );
_operationQName = new QName( wsdlTypes.getTargetNamespace(), op.getName() ); _oneway = true; String soapBindingUse = WsdlUtils.getSOAPBindingUse( binding, op.getName() ); if ( "encoded".equals( soapBindingUse ) ) { _bindingUse = SOAPBindingUse.ENCODED; _soapAction = WsdlUtils.getSOAPAction( binding.getBindingOperation( op.getName(), null, null ) );
/** * Constructor. * * @param op * Operation this arg list is for. * @param binding * Binding for the operation. * @param wsdlTypes * Wsdl types. */ protected WsdlOpParameterList( Operation op, Binding binding, WsdlTypes wsdlTypes ) { _wsdlTypes = wsdlTypes; _returnParam = null; _operation = op; _parameterStyle = WsdlOperation.SOAPParameterStyle.BARE; _headerNames = WsdlUtils.getSOAPHeaders( binding, op.getName() ); }
/** * Get the name of this service. * * @return Service name. */ public String getServiceName() { return _service.getQName().getLocalPart(); }
/** * Change the port of the service. * * @param portName * The new port name. * @throws IllegalArgumentException * if port name is not defined in WSDL. */ public void setPort( QName portName ) { Port port = _service.getPort( portName.getLocalPart() ); if ( port == null ) { throw new IllegalArgumentException( "Port name: '" + portName + "' was not found in the WSDL file." ); } _port = port; _operationCache.clear(); }
/** * Create the fault list for this operation. * * @param op * Operation */ @SuppressWarnings( "unchecked" ) private void loadFaults( Operation op ) throws KettleStepException { Map<?, Fault> faultMap = op.getFaults(); for ( Fault fault : faultMap.values() ) { _faults.add( fault ); } }
List<String> parameterOrder = _operation.getParameterOrdering(); if ( parameterOrder != null ) { if ( !parameterOrder.contains( responseParam.getName().getLocalPart() ) ) {