Can Axis Client-Config.wsdd config be picked up from JBoss? - axis2

I have a client for a 3rd party webservice that had to be created using the Azis WSDL2Java tool. Every web request must be encrypted using an Encryption handler provided by the 3rd party and the incoming responses myst be Decrypted in the same format. This all works really well, except that I have the handlers specified in a client-config.wsdd in the src/main/resources of my jar. one of the parameters of the client-config is a username and one is the location to a key file. This will need to be deployed to many different environments where the user and key location will differ, and it's not going to be feasible to change the values each time then rebuild. Is there a way I can either pass in parameters to my wsdd or place the wsdd in the $JBOSS_HOME/server//conf folder etc? (I am using JBoss 5.1.0.GA)
The wsdd looks like this
<?xml version='1.0'?>
<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<globalConfiguration>
<requestFlow>
<handler name="EncryptionHandler" type="java:com.3rdparty.services.util.EncryptionHandler" >
<parameter name="userName" value="myuser"/>
<parameter name="keyFile" value="/jboss-5.1.0.GA/server/<name>/conf/my.key"/>
<parameter name="passwordCallbackClass" value="com.3rdparty.security.client.PWCallback"/>
</handler>
</requestFlow>
<responseFlow>
<handler name="DecryptionHandler" type="java:com.3rdparty.services.util.DecryptionHandler" >
<parameter name="userName" value="myuser"/>
<parameter name="keyFile" value="/jboss-5.1.0.GA/server/<name>/conf/my.key"/>
</handler>
</responseFlow>
</globalConfiguration>
<transport name="http" pivot="java:org.apache.axis.transport.http.HTTPSender"/>
<transport name="local" pivot="java:org.apache.axis.transport.local.LocalSender"/>
<transport name="java" pivot="java:org.apache.axis.transport.java.JavaSender"/>
</deployment>

You can use the system property axis.ClientConfigFile to specify a particular directory of the client-config.wsdd file.

Related

WSO2EI 7.1.1 File Processing not working on centos server

I am trying this tutorial from this given link https://ei.docs.wso2.com/en/latest/micro-integrator/use-cases/tutorials/file-processing/
Here is the file proxy definition
<?xml version="1.0" encoding="UTF-8"?>
<proxy name="daily-file-proxy" startOnLoad="true" transports="vfs" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<log level="full"/>
<clone>
<target sequence="daily-file-file-write-sequence"/>
<target sequence="daily-file-mail-notification-sequence"/>
<target sequence="daily-file-db-sequence"/>
</clone>
</inSequence>
<outSequence/>
<faultSequence/>
</target>
<parameter name="transport.PollInterval">15</parameter>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.vfs.MoveAfterProcess">$FILE:FILE_DAILY_PROCESS</parameter>
<parameter name="transport.vfs.FileURI">$FILE:FILE_DAILY_DOWNLOAD</parameter>
<parameter name="transport.vfs.MoveAfterFailure">$FILE:FILE_DAILY_FAILURE</parameter>
<parameter name="transport.vfs.FileNamePattern">.*.txt</parameter>
<parameter name="transport.vfs.ContentType">text/plain</parameter>
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
</proxy>
I also declared all the parameters in the file.properties as well.
This code worked properly from Integration Studio as I drop the txt file in the FILE:FILE_DAILY_PROCESS, it processed in 15 sec and put the data into database.
Then I packaged the project as car file and deployed to micro integerator wso2 in the centos server.
I checked the log and everything deployed properly without error (wso2carbon.log and wso2-error.log not show any error)
I am thinking that the wso2ei could not see the folder declaring
Here is the parameters declaring in file.properties
FILE_DAILY_DOWNLOAD=file:///root/file-processing/daily-download/202107
FILE_DAILY_PROCESS=file:///root/file-processing/daily-process
FILE_DAILY_PROCESS_URI=vfs:file:///root/file-processing/daily-process
FILE_DAILY_FAILURE=file:///root/file-processing/daily-failure
finally, I have figured out the issue. The wso2 could not see the specific folder under ssh user root. It must be under /home/wso2 so the VFS listener only see the folder available under /home/wso2 folder
So use the update settings
FILE_DAILY_DOWNLOAD=file:///home/wso2/file-processing/daily-download/202107
FILE_DAILY_PROCESS=file:///home/wos2/file-processing/daily-process
FILE_DAILY_PROCESS_URI=vfs:file:///home/wso2/file-processing/daily-process
FILE_DAILY_FAILURE=file:///home/wso2/file-processing/daily-failure

How to handle VFS proxy error in WSO2 EI 6.4?

In VFS proxy, How I can handle errors? For example in below cases:
If VFS is not able to connect to SFTP server due to different reasons(like wrong password, directory not exist etc). I am able to see Warning in console log but I want to send a mail or want to do some other stuff if connection is not possible.
If the folder does not exist where we have to move file after reading.
I am able to handle error during processing in FaultSequence but that thing does not work for proxy. I tried to set onError attribute as well but seems proxy does not support that attribute.
Please let me know if someone handle such errors or I am missing something.
<proxy name="FileProxy" startOnLoad="false" statistics="enable" trace="enable" transports="vfs" xmlns="http://ws.apache.org/ns/synapse">
<target faultSequence="Global_Error_Handler">
<inSequence>
<log level="custom">
<property name="status=" value="File received."/>
</log>
</inSequence>
<outSequence/>
</target>
<parameter name="transport.vfs.Streaming">true</parameter>
<parameter name="transport.PollInterval">10</parameter>
<parameter name="transport.vfs.FileURI">vfs:sftp://abc:***#127.0.0.1:22/test/ftp_in?transport.vfs.AvoidPermissionCheck=true</parameter>
<parameter name="transport.vfs.ContentType">text/plain</parameter>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.vfs.MoveAfterFailure">vfs:sftp://abc:***#127.0.0.1:22/test/ftp_failure</parameter>
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
<parameter name="transport.vfs.ReplyFileName">ReplyFileName.csv</parameter>
<parameter name="transport.vfs.FileNamePattern">.*.dat</parameter>
<parameter name="transport.vfs.MoveAfterProcess">file:///home/test/ftp_process</parameter>
</proxy>
Need to handle any error that occurs outside the <target> functionality of proxy for VFS.

The system cannot infer the transport information from the vfs:sftp://user:password#sftpserverhost/in URL

I am using the following code in my proxy to connect ftp server to read file from.
<proxy name="SFTPVFSProxy" transports="vfs" startOnLoad="true" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<send/>
</inSequence>
</target>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.PollInterval">15</parameter>
<parameter name="transport.vfs.MoveAfterProcess">vfs:sftp://username:password#ftpserver-host/outbox</parameter>
<parameter name="transport.vfs.FileURI">vfs:sftp://username:password#ftpserver-host/inbox</parameter>
<parameter name="transport.vfs.MoveAfterFailure">vfs:sftp://username:password#ftpserver-host/sent</parameter>
<parameter name="transport.vfs.FileNamePattern">.*.txt</parameter>
<parameter name="transport.vfs.ContentType">application/xml</parameter>
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
</proxy>
But I am getting below error when I ran the above. VFS transport is eanbled in axis2.xml and I can see vfs transport in wso2 esb 4.9.0 admin console.
The system cannot infer the transport information from the vfs:sftp://user:password#sftpserverhost/in URL
SFTP uses SSH protocol to communicate with the server, so it always logs into the user's home directory and then it takes the path relative to the user's home directory.
You can add "sftpPathFromRoot" to WSO2 VFS transport URI as to get absolute path access as below.
<parameter name="transport.vfs.FileURI">sftp://[ username[: password]#] hostname[: port][ absolute-path]?sftpPathFromRoot=true</parameter>
Alternatively you can use symbolic link.You can find more details here.

Unable to generate WSDL 1.1 for this service

I have a wsdl (that works) and I've generated boilerplate code from it but wish to use my original wsdl not the auto generated one but on changing useOriginalwsdl to true I get errors. There is absolutely no documentation in the Axis website regarding this property so I have followed the steps here:
useOriginalwsdl=true is not working in axis2
specifically:
My services.xml has the same name as the wsdl service name
I have called my wsdl service.wsdl and put it in the META-INF folder (I also tried it with the service name)
But I get the error Unable to generate WSDL 1.1 for this service
Below is my folder structure:
.\com
.\lib
.\META-INF
services.xml
service.wsdl
My services.xml is:
<?xml version="1.0" encoding="UTF-8"?><!-- This file was auto-generated from WSDL -->
<!-- by the Apache Axis2 version: 1.6.2 Built on : Apr 17, 2012 (05:33:49 IST) -->
<serviceGroup>
<service name="MyService">
<messageReceivers>
<messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" class="com.neil.systems.ServiceMessageReceiverInOut"/>
</messageReceivers>
<parameter name="ServiceClass">com.neil.webservice.MyService</parameter>
<parameter name="useOriginalwsdl">true</parameter>
<parameter name="modifyUserWSDLPortAddress">false</parameter>
<operation name="Provision" mep="http://www.w3.org/ns/wsdl/in-out" namespace="http://xmlns.neil.com/systems">
<actionMapping>http://xmlns.neil.com/systems/Provision</actionMapping>
<outputActionMapping>http://xmlns.neil.com/systems/ProvisionResponse</outputActionMapping>
</operation>
</service>
</serviceGroup>
My service.wsdl, the relevant part is:
<wsdl:service name="MyService">
Note, I changed a couple of things in the services.xml to reduce the size so any obvious errors is just down to my cutting.

Infinispan Initial State Transfer Hangs and times out

I'm trying to cluster a pair of servers with a shared Infinispan cache (Replicated Asynchronously). One always starts successfully, and registers itself properly with the JDBC database. When the other starts, it registers properly with the database, and I see a bunch of chatter between them, then, while waiting on a response from the second server, I get
`org.infinispan.commons.CacheException: Initial statue transfer timed out`
I think it's just an issue of configuration, but I'm not sure how to debug my configuration issues. I've spent several days configuring and re-configuring my Infinispan XML, and my JGroups.xml:
Infinispan:
<?xml version="1.0" encoding="UTF-8"?>
<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:infinispan:config:6.0"
xsi:schemaLocation="urn:infinispan:config:6.0 http://www.infinispan.org/schemas/infinispan-config-6.0.xsd
urn:infinispan:config:remote:6.0 http://www.infinispan.org/schemas/infinispan-cachestore-remote-config-6.0.xsd"
xmlns:remote="urn:infinispan:config:remote:6.0"
>
<!-- *************************** -->
<!-- System-wide global settings -->
<!-- *************************** -->
<global>
<shutdown hookBehavior="DEFAULT"/>
<transport clusterName="DSLObjectCache">
<properties>
<property name="configurationFile" value="jgroups.xml"/>
</properties>
</transport>
<globalJmxStatistics enabled="false" cacheManagerName="Complex.com"/>
</global>
<namedCache name="ObjectCache">
<transaction transactionMode="TRANSACTIONAL" />
<locking
useLockStriping="false"
/>
<invocationBatching enabled="true"/>
<clustering mode="replication">
<async asyncMarshalling="true" useReplQueue="true" replQueueInterval="100" replQueueMaxElements="100"/>
<stateTransfer fetchInMemoryState="true" />
</clustering>
<eviction strategy="LIRS" maxEntries="500000"/>
<expiration lifespan="86400000" wakeUpInterval="1000" />
</namedCache>
<default>
<!-- Configure a synchronous replication cache -->
<locking
useLockStriping="false"
/>
<clustering mode="replication">
<async asyncMarshalling="true" useReplQueue="true" replQueueInterval="100" replQueueMaxElements="100"/>
<stateTransfer fetchInMemoryState="true" />
</clustering>
<eviction strategy="LIRS" maxEntries="500000"/>
<expiration lifespan="86400000" wakeUpInterval="1000" />
<persistence>
<cluster remoteCallTimeout="60000" />
</persistence>
</default>
</infinispan>
Jboss.xml:
<config xmlns="urn:org:jgroups"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/JGroups-3.0.xsd">
<!-- Default the external_addr to #DEADBEEF so we can see errors coming through
on the backend -->
<TCP
external_addr="${injected.external.address:222.173.190.239}"
receive_on_all_interfaces="true"
bind_addr="0.0.0.0"
bind_port="${injected.bind.port:12345}"
conn_expire_time="0"
reaper_interval="0"
sock_conn_timeout="20000"
tcp_nodelay="true"
/>
<JDBC_PING
datasource_jndi_name="java:jboss/datasources/dsl/control"
/>
<MERGE2 max_interval="30000" min_interval="10000"/>
<FD_SOCK
external_addr="${injected.external.address:222.173.190.239}"
bind_addr="0.0.0.0"
/>
<FD timeout="10000" max_tries="5"/>
<VERIFY_SUSPECT timeout="1500"
bind_addr="0.0.0.0"
/>
<pbcast.NAKACK use_mcast_xmit="false"
retransmit_timeouts="300,600,1200,2400,4800"
discard_delivered_msgs="true"/>
<UNICAST3 ack_batches_immediately="true"
/>
<RSVP ack_on_delivery="true"
throw_exception_on_timeout="true"
timeout="1000"
/>
<pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
max_bytes="400000"/>
<pbcast.GMS print_local_addr="true" join_timeout="5000"
view_bundling="true" view_ack_collection_timeout="5000"/>
<FRAG2 frag_size="60000"/>
<pbcast.STATE_SOCK
bind_port="54321"
external_addr="${injected.external.address:222.173.190.239}"
bind_addr="0.0.0.0"
/>
<pbcast.FLUSH timeout="1000"/>
</config>
I've tried, frankly, every configuration option I can think of, and I'm not sure why the replication keeps timing out. All communication between these servers is wide open. Sorry to just dump so much XML, but I'm not even sure how to collect more information.
Continued exploration indicated that Infinispan was pushing logs to the server.log, but - due to my configuration, this was not duplicated on the console. Further inspection revealed that I left a single element in my cache objects unserializable - making it impossible for it to be written to the wire and transferred. The logs are very specific, making this actually a very easy problem to track down once I realized where the logs were being written.
If you come here from the future, my advice is to just tail every single log you can on the working server, and see what comes up.