April 27, 2020
Estimated Post Reading Time ~

How to Invoke the SOAP services from Adobe CQ5

This post will explain how to invoke the SOAP services from Adobe CQ5

Configure wsimport plugin to POM.xml:
<plugin>
   <groupId>org.codehaus.mojo</groupId>
   <artifactId>jaxws-maven-plugin</artifactId>
   <version>1.12</version>
   <executions>
      <execution>
         <goals>
            <goal>wsimport</goal>
         </goals>
      </execution>
   </executions>
   <configuration>
      <verbose>true</verbose>
      <args>
         <arg>-B-XautoNameResolution</arg>
      </args>
      <wsdlUrls>
         <wsdlUrl>http://localhost:8080/services/AddressService_1.0.wsdl</wsdlUrl>
      </wsdlUrls>
      <sourceDestDir>src/main/java/</sourceDestDir>
      <packageName>com.ws.address.validation</packageName>
   </configuration>
</plugin>

Change the wsdlurl,sourceDestDir, and packageName accordingly.


Execute the generate-source target

This will generate the java code to the specified path.


Invoke the service:
AddressServiceV01_Service service = new AddressServiceV01_Service();
AddressServiceV01 port = service.getAddressServiceV01();
BindingProvider bindingProvider = (BindingProvider) port;
bindingProvider.getRequestContext().put("http://localhost:8080/services/AddressService");
String response = port.method(input);

Change the service and the endpoint accordingly.

Add com.sun.xml.internal.ws.* to sling.properties org.osgi.framework.bootdelegation property.

org.osgi.framework.bootdelegation=com.yourkit.*, ${org.apache.sling.launcher.bootdelegation}, com.sun.xml.internal.ws.*


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.