Expand my Community achievements bar.

SOLVED

How to Authenticate SOAP API in pom.xml

Avatar

Level 4

Hi,

 

We need to integrate SOAP API in AEM. I followed the below blog for the integration

https://one-inside.com/soap-web-services-aem/ 

This is working fine, and the classes are generated.

In my pom.xml I am adding a plugin with the wsdl url, which generates the class.

 

SwetaB_0-1665657022330.png

 

 

I have a scenario to this where we need to access the WSDL url, after authentication.

 

Any idea on how to do that.

 

Thanks,

Sweta

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Please check this below example for reading the version from a property file. You can do similar to a property for WSDL URL and configure it and use it POM -> wsdlUrls config and access it in java code too.  Give it a try

 

https://stackoverflow.com/questions/3697449/retrieve-version-from-maven-pom-xml-in-code 

  1. Create a .properties file in (most commonly) your src/main/resources directory (but in step 4 you could tell it to look elsewhere).

  2. Set the value of some property in your .properties file using the standard Maven property for project version:

    foo.bar=${project.version}
    
  3. In your Java code, load the value from the properties file as a resource from the classpath (google for copious examples of how to do this, but here's an example for starters).

  4. In Maven, enable resource filtering. This will cause Maven to copy that file into your output classes and translate the resource during that copy, interpreting the property. You can find some info here but you mostly just do this in your pom:

    <build>
      <resources>
        <resource>
          <directory>src/main/resources</directory>
          <filtering>true</filtering>
        </resource>
      </resources>   
    </build>

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Please check this below example for reading the version from a property file. You can do similar to a property for WSDL URL and configure it and use it POM -> wsdlUrls config and access it in java code too.  Give it a try

 

https://stackoverflow.com/questions/3697449/retrieve-version-from-maven-pom-xml-in-code 

  1. Create a .properties file in (most commonly) your src/main/resources directory (but in step 4 you could tell it to look elsewhere).

  2. Set the value of some property in your .properties file using the standard Maven property for project version:

    foo.bar=${project.version}
    
  3. In your Java code, load the value from the properties file as a resource from the classpath (google for copious examples of how to do this, but here's an example for starters).

  4. In Maven, enable resource filtering. This will cause Maven to copy that file into your output classes and translate the resource during that copy, interpreting the property. You can find some info here but you mostly just do this in your pom:

    <build>
      <resources>
        <resource>
          <directory>src/main/resources</directory>
          <filtering>true</filtering>
        </resource>
      </resources>   
    </build>