Wednesday, June 21, 2017

Deploying connectors on ESB using admin services

Apart from deploying connectors through WSO2 ESB UI, you can use the AdminServices to deploy the connector. By default, the WSDLs of admin services are hidden from consumers. 

Follow the steps mentioned below to discover them.
  1. Set the <HideAdminServiceWSDLs> element to false in the <PRODUCT_HOME>/repository/conf/carbon.xml file.
  2. Restart the server.
  3. Start the WSO2 product with the -DosgiConsole option, such as sh <PRODUCT_HOME>/bin/wso2server.sh -DosgiConsole in Linux.
  4. When the server is started, hit the enter/return key several times to get the OSGI shell in the console.
  5. In the OSGI shell, type: osgi> listAdminServices

Step 1

Use “uploadLibrary” operation from https://localhost:9443/services/MediationLibraryUploader AdminService to upload the connector. The following sample curl request shows how to upload the connector zip file.


curl -k -v -H "Content-Type: application/soap+xml;charset=UTF-8;"  -H "SOAPAction:urn:getImport" --basic -u "admin:admin" --data @uploadLibrary.xml https://localhost:9443/services/MediationLibraryUploader
uploadLibrary.xml

uploadLibrary.xml

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:upl="http://upload.service.library.mediation.carbon.wso2.org" xmlns:xsd="http://upload.service.library.mediation.carbon.wso2.org/xsd">
   <soap:Header/>
   <soap:Body>
      <upl:uploadLibrary>
         <upl:fileItems>
            <xsd:dataHandler>{BASE64_ENCODED_ZIP_CONTENT}</xsd:dataHandler>
            <xsd:fileName>fileconnector-connector-2.0.7.zip</xsd:fileName>
            <xsd:fileType>zip</xsd:fileType>
         </upl:fileItems>
      </upl:uploadLibrary>
   </soap:Body>
</soap:Envelope>

Step 2

Once you upload the connector, use the following command to add the import file into repository/deployment/server/synapse-configs/default/imports.


curl -k -v -H "Content-Type: application/soap+xml;charset=UTF-8;"  -H "SOAPAction:urn:addImport" --basic -u "admin:admin" --data @addImport.xml https://localhost:9443/services/MediationLibraryAdminService
addImport.xml


addImport.xml





<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://org.apache.synapse/xsd">
   <soap:Header/>
   <soap:Body>
      <xsd:addImport>
         <xsd:libName>fileconnector</xsd:libName>
         <xsd:packageName>org.wso2.carbon.connector</xsd:packageName>
      </xsd:addImport>
   </soap:Body>
</soap:Envelope>


Step 3

Then, enable the connector using the following command:


curl -k -v -H "Content-Type: application/soap+xml;charset=UTF-8;"  -H "SOAPAction:urn:updateStatus" --basic -u "admin:admin" --data @updateStatus.xml https://localhost:9443/services/MediationLibraryAdminService
updateStatus.xml


updateStatus.xml




<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://org.apache.synapse/xsd">
   <soap:Header/>
   <soap:Body>
      <xsd:updateStatus>
         <xsd:libQName>{org.wso2.carbon.connector}fileconnector</xsd:libQName>
         <xsd:libName>fileconnector</xsd:libName>
         <xsd:packageName>org.wso2.carbon.connector</xsd:packageName>
         <xsd:status>enabled</xsd:status>
      </xsd:updateStatus>
   </soap:Body>
</soap:Envelope>

That's all. Now you can call operations which supports from the connector inside your proxy.

Thanks.

Tuesday, June 6, 2017

What to do when you get "java.lang.OutOfMemoryError: PermGen space " issue once you login WSO2EI 6.1.1

After the successful start of the WSO2 Enterprise Integrator (EI) 6.1.1, I tried to log in the management console and encountered an error java.lang.OutOfMemoryErrorPermGenspace [1]. 

[1] java.lang.OutOfMemoryError: PermGen space
Dumping heap to /home/sa/Desktop/sachini/PROD-7/wso2ei-6.1.1/repository/logs/heap-dump.hprof ...
Unable to create /home/sa/Desktop/sachini/PROD-7/wso2ei-6.1.1/repository/logs/heap-dump.hprof: File exists
SEVERE:Memory usage is low, parachute is non existent, your system may start failing.
Exception in thread "http-nio-9443-exec-13" 
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "http-nio-9443-exec-13"
Exception in thread "PoolCleaner[1007456727:1496813475907]" 

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "PoolCleaner[1007456727:1496813475907]"


Please follow the steps to solve the issue.

  1. Open /wso2ei-6.1.1/bin/integrator.sh
  2.  Add the below value under "$JAVA_OPTS \ "             
            -Xms256m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m \

That's all.Once you restart the server you will be able to log to EI 6.1.1

 
Blogger Widgets