[ 
https://issues.apache.org/jira/browse/NIFI-3536?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16066079#comment-16066079
 ] 

ASF GitHub Bot commented on NIFI-3536:
--------------------------------------

Github user pvillard31 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1824#discussion_r124471858
  
    --- Diff: 
nifi-nar-bundles/nifi-soap-bundle/nifi-soap-processors/src/main/java/org/apache/nifi/processors/soap/GetSOAP.java
 ---
    @@ -0,0 +1,508 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.nifi.processors.soap;
    +
    +import com.fasterxml.jackson.core.type.TypeReference;
    +import com.fasterxml.jackson.databind.ObjectMapper;
    +import org.apache.axiom.om.OMAbstractFactory;
    +import org.apache.axiom.om.OMElement;
    +import org.apache.axiom.om.OMFactory;
    +import org.apache.axiom.om.OMNamespace;
    +import org.apache.axis2.AxisFault;
    +import org.apache.axis2.Constants;
    +import org.apache.axis2.addressing.EndpointReference;
    +import org.apache.axis2.client.Options;
    +import org.apache.axis2.client.ServiceClient;
    +import org.apache.axis2.transport.http.HTTPConstants;
    +import 
org.apache.axis2.transport.http.impl.httpclient3.HttpTransportPropertiesImpl;
    +import org.apache.nifi.annotation.behavior.DynamicProperty;
    +import org.apache.nifi.annotation.behavior.InputRequirement;
    +import org.apache.nifi.annotation.behavior.SupportsBatching;
    +import org.apache.nifi.annotation.behavior.WritesAttribute;
    +import org.apache.nifi.annotation.behavior.WritesAttributes;
    +import org.apache.nifi.annotation.documentation.CapabilityDescription;
    +import org.apache.nifi.annotation.documentation.Tags;
    +import org.apache.nifi.components.PropertyDescriptor;
    +import org.apache.nifi.components.ValidationContext;
    +import org.apache.nifi.components.ValidationResult;
    +import org.apache.nifi.components.Validator;
    +import org.apache.nifi.flowfile.FlowFile;
    +import org.apache.nifi.flowfile.attributes.CoreAttributes;
    +import org.apache.nifi.logging.ComponentLog;
    +import org.apache.nifi.processor.AbstractProcessor;
    +import org.apache.nifi.processor.ProcessContext;
    +import org.apache.nifi.processor.ProcessSession;
    +import org.apache.nifi.processor.ProcessorInitializationContext;
    +import org.apache.nifi.processor.Relationship;
    +import org.apache.nifi.processor.exception.ProcessException;
    +import org.apache.nifi.processor.util.StandardValidators;
    +
    +import java.io.IOException;
    +import java.util.ArrayList;
    +import java.util.Collection;
    +import java.util.Collections;
    +import java.util.HashMap;
    +import java.util.HashSet;
    +import java.util.List;
    +import java.util.Map;
    +import java.util.Set;
    +
    +@SupportsBatching
    +@InputRequirement(InputRequirement.Requirement.INPUT_ALLOWED)
    +@Tags({"SOAP", "Get", "Ingest", "Ingress"})
    +@CapabilityDescription(
    +        "Execute provided request against the SOAP endpoint. The result 
will be left in it's orginal form and all " +
    +        "headers that are returned will be written as attributes to the 
resulting flow file.")
    +@WritesAttributes({@WritesAttribute(attribute = "getsoap.status.code", 
description = "The status code that is returned"),
    +        @WritesAttribute(attribute = "getsoap.status.message", description 
= "The status message that is returned"),
    +        @WritesAttribute(attribute = "getsoap.request.wsdl_url", 
description = "The request WSDL URL"),
    +        @WritesAttribute(attribute = "getsoap.request.method", description 
= "The request method"),
    +        @WritesAttribute(attribute = "mime.type", description = "Sets mime 
type to text/xml")})
    +@DynamicProperty(name = "The name of a input parameter the needs to be 
passed to the SOAP method being invoked.",
    +        value = "The value for this parameter '=' and ',' are not 
considered valid values and must be escaped . " +
    +                "Note, if the value of parameter needs to be an array the 
format should be key1=value1,key2=value2.  ",
    +        description = "The name provided will be the name sent in the SOAP 
method, therefore please make sure " +
    +                      "it matches the wsdl documentation for the SOAP 
service being called. In the case of arrays " +
    +                      "the name will be the name of the array and the 
key's specified in the value will be the element " +
    +                      "names passed.")
    +
    +public class GetSOAP extends AbstractProcessor {
    +
    +    protected static final PropertyDescriptor ENDPOINT_URL = new 
PropertyDescriptor
    +            .Builder()
    +            .name("endpoint-url")
    +            .displayName("Endpoint URL")
    +            .description("The endpoint url that hosts the web service(s) 
that should be called.")
    +            .required(true)
    +            .expressionLanguageSupported(false)
    +            .addValidator(StandardValidators.URL_VALIDATOR)
    +            .build();
    +
    +    protected static final PropertyDescriptor WSDL_URL = new 
PropertyDescriptor
    +            .Builder()
    +            .name("wsdl-url")
    +            .displayName("WSDL URL")
    +            .description("The url where the wsdl file can be retrieved and 
referenced.")
    +            .required(true)
    +            .expressionLanguageSupported(false)
    +            .addValidator(StandardValidators.URL_VALIDATOR)
    +            .build();
    +
    +    protected static final PropertyDescriptor METHOD_NAME = new 
PropertyDescriptor
    +            .Builder()
    +            .name("soap-method-name")
    +            .displayName("SOAP Method Name")
    +            .description("The method exposed by the SOAP webservice that 
should be invoked.")
    +            .required(true)
    +            .expressionLanguageSupported(true)
    +            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
    +            .build();
    +
    +    protected static final PropertyDescriptor USER_NAME = new 
PropertyDescriptor
    +            .Builder()
    +            .name("username")
    +            .displayName("Username")
    +            .sensitive(true)
    +            .description("The username to use in the case of basic Auth")
    +            .required(false)
    +            .expressionLanguageSupported(false)
    +            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
    +            .build();
    +
    +    protected static final PropertyDescriptor PASSWORD = new 
PropertyDescriptor
    +            .Builder()
    +            .name("password")
    +            .displayName("Password")
    +            .sensitive(true)
    +            .description("The password to use in the case of basic Auth")
    +            .required(false)
    +            .expressionLanguageSupported(false)
    +            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
    +            .build();
    +
    +    protected static final PropertyDescriptor USER_AGENT = new 
PropertyDescriptor
    +            .Builder()
    +            .name("user-agent")
    +            .displayName("User Agent")
    +            .defaultValue("NiFi SOAP Processor")
    +            .description("The user agent string to use, the default is 
Nifi SOAP Processor")
    +            .required(false)
    +            .expressionLanguageSupported(false)
    +            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
    +            .build();
    +
    +    protected static final PropertyDescriptor SO_TIMEOUT = new 
PropertyDescriptor
    +            .Builder()
    +            .name("socket-timeout")
    +            .displayName("Socket Timeout")
    +            .defaultValue("60000")
    +            .description("The timeout value to use waiting for data from 
the webservice")
    +            .required(false)
    +            .expressionLanguageSupported(false)
    +            .addValidator(StandardValidators.POSITIVE_INTEGER_VALIDATOR)
    +            .build();
    +
    +    protected static final PropertyDescriptor CONNECTION_TIMEOUT = new 
PropertyDescriptor
    +            .Builder()
    +            .name("connection-timeout")
    +            .displayName("Connection Timeout")
    +            .defaultValue("60000")
    +            .description("The timeout value to use waiting to establish a 
connection to the web service")
    +            .required(false)
    +            .expressionLanguageSupported(false)
    +            .addValidator(StandardValidators.POSITIVE_INTEGER_VALIDATOR)
    +            .build();
    +
    +    protected static final PropertyDescriptor AUTH_BY_HEADER = new 
PropertyDescriptor.Builder()
    +            .name("header-authentication")
    +            .displayName("Header Authentication")
    +            .description("If you need to do authentication with SOAP 
headers, this must be a json string " +
    +                         "defining the structure since it varies from 
service to service. Username and Password " +
    +                         "must be set in the separate parameters and 
referenced here " +
    +                         "as variables ${Username} and ${Password}. For 
example, " +
    +                         "{ \"UserAuthentication\": { \"username\": 
\"${Username}\", \"password\": \"${Password}\"," +
    +                         " \"some_other_custom_field\": \"value\" }")
    +            .required(false)
    +            .expressionLanguageSupported(true)
    +            .addValidator(new Validator() {
    +                @Override
    +                public ValidationResult validate(String subject, String 
value, ValidationContext context) {
    +                    try {
    +                        return (new ValidationResult.Builder())
    +                                .subject(subject)
    +                                .input(value)
    +                                .explanation("Header Authentication must 
be empty or valid json")
    +                                .valid("".equals(value) || 
mapper.readTree(value) != null).build();
    +                    } catch (IOException e) {
    +                        return (new ValidationResult.Builder())
    +                                .subject(subject)
    +                                .input(value)
    +                                .explanation("Header Authentication must 
be empty or valid json: " + e.getMessage())
    +                                .valid(false).build();
    +                    }
    +                }
    +            })
    +            .build();
    +
    +    protected static final PropertyDescriptor API_NAMESPACE = new 
PropertyDescriptor.Builder()
    +            .name("namespace")
    +            .displayName("Namespace")
    +            .description("XML Namespace.")
    +            .required(true)
    +            .expressionLanguageSupported(false)
    +            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
    +            .dynamic(false)
    +            .build();
    +
    +    protected static final PropertyDescriptor SKIP_FIRST_ELEMENT = new 
PropertyDescriptor.Builder()
    +            .name("skip-first-element")
    +            .displayName("Skip First Element")
    +            .description("Return the XML that comes after the first 
element.")
    +            .required(true)
    +            .defaultValue("false")
    +            .allowableValues("true", "false")
    +            .expressionLanguageSupported(false)
    +            .addValidator(StandardValidators.BOOLEAN_VALIDATOR)
    +            .dynamic(false)
    +            .build();
    +
    +    public static final Relationship REL_SUCCESS = new 
Relationship.Builder()
    --- End diff --
    
    Since the processor accepts incoming flow files, wouldn't that make sense 
to also have a failure relationship? (in particular if some properties are 
evaluated against attributes of the incoming flow files)


> Add GetSOAP Processor
> ---------------------
>
>                 Key: NIFI-3536
>                 URL: https://issues.apache.org/jira/browse/NIFI-3536
>             Project: Apache NiFi
>          Issue Type: New Feature
>            Reporter: Andrew Psaltis
>            Assignee: Andrew Psaltis
>
> Although it may seem like everyone is now using REST or at least RESTful 
> services there still remains a need for many enterprises to interact with 
> SOAP endpoints. This JIRA is for a new processor that supports interacting 
> with SOAP endpoints.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to