Category Archives: axis

Apache axis decoding returns different results in different environment

Need your help in resolving decode issue. I am trying to decode string using Apache axis

byte[] decoded_data = org.apache.axis.encoding.Base64.decode(data)

The decoded value is further passed to output stream for validation. This works from our UAT environment without any issue. But when we move this same code to production it does not work. The decoding for the same data is different between UAT and Production.

Data to be decoded is: bGKtaIin7jPN6dBKv58B/bUyrNwKI/0aG4frGPfwRll+9t1xWtHxcJtRrWgDag42MJQ72uUpuEr0BSkec/wHS770VWOmL4gtOyRZie7pdar+T9dDuPVVdVbkqDD4FxeIqVXQcehTr8fUd62oZ8QZA2ZKd1OYZNsWn/6VfmEpAFZ4AFNgOlCBvpxsYi2bPVuC5KCVfd/Pf4ww8HsqtDP7/tVol/P8vnIv2pyCbBpUII/vZ6fUNJ0yXEGm2LMu6cKzamzv/jrAoJlF9G3K21Kc/Cy5kJi/BlPPhIf41XHPoUZc5KkstGFLtcoFvIhLLsPvq4ldEuZf0Zzr9P6CfyqPEA==

Java and Apache Axis version on both machine is same. What can be the issue? Is there any platform dependency etc.?

Getting java.net.SocketTimeoutException: connect timed out error

I am trying to connect to a webservice from my application and I am getting following exception :

org.apache.axis2.AxisFault: The host did not accept the connection within timeout of 30000 ms
                at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
                at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:197)
                at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
                at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:404)
                at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:231)
                at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443)
                at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:406)
                at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
                at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)

Caused by: org.apache.commons.httpclient.ConnectTimeoutException: The host did not accept the connection within timeout of 30000 ms
                at org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(ReflectionSocketFactory.java:155)
                at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.createSocket(SSLProtocolSocketFactory.java:130)
                at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
                at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
                at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
                at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
                at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
                at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:621)
                at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:193)
                ... 27 more
Caused by: java.net.SocketTimeoutException: connect timed out
                at java.net.PlainSocketImpl.socketConnect(Native Method)
                at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
                at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
                at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
                at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:367)
                at java.net.Socket.connect(Socket.java:524)
                at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:545)
                at sun.reflect.GeneratedMethodAccessor197.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:592)
                at org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(ReflectionSocketFactory.java:140)
                ... 35 more

I am not overwriting timeout interval in my application. Can anyone please tell me through which property this timeout is configured ?and in which place its configured ? I thought its configured in axis2.xml But i might be wrong

Setting a timeout on webservice consumer built with org.apache.axis.client.Call and running on Domino

I'm maintaining an antedeluvian Notes application which connects to a SAP back-end via a manually done 'Webservice'

The server is running Domino Release 7.0.4FP2 HF97.

The Webservice is not the more recently Webservice Consumer, but a large Java agent which is using Apache soap.jar (org.apache.soap). Below an example of the calling code.

private Call setupSOAPCall() {
    Call call = new Call();

SOAPHTTPConnection conn = new SOAPHTTPConnection();
call.setSOAPTransport(conn);

call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);

There has been a change in the SAP system which is now taking 8 minutes to complete (verified by SAP Team).

I'm getting an error message as follows:

[SOAPException: faultCode=SOAP-ENV:Client; msg=For input string: "906    "; targetException=java.lang.NumberFormatException: For input string: "906    "]

I found a blog article describing the error message quite closely:

https://thejavablog.wordpress.com/category/jmeter/

and I've come to the hypothesis that it is a timeout message that is returning to my Call object and that this timeout message is being incorrectly parsed, hence the NumberFormat Exception.

Looking at my logs I can see that there is a time difference of 62 seconds between my call and the response.

I recommended that the server setting in the server document, tab Internet Protocols/HTTP/Timeouts/Request timeouts be changed from 60 seconds to 600 seconds, and the http task restarted with

tell http restart

I've re-run the tests and I am getting the same error, and the time difference is still slightly more than 60 seconds, which is not what I was expecting.

I read Michael Rulnau's blog entry

http://www.mruhnau.net/2014/06/how-to-overcome-domino-webservice.html

which points to this APR

http://www-01.ibm.com/support/docview.wss?uid=swg1LO48272

but I'm not convinced that this would apply in this case, since there is no way that IBM would know that my Java agent is in fact making a Soap call.

My current hypothesis is that I have to use either the setTimeout() method on

org.apache.axis.client.Call

https://axis.apache.org/axis/java/apiDocs/org/apache/axis/client/Call.html

or on the org.apache.soap.transport.http.SOAPHTTPConnection

https://docs.oracle.com/cd/B13789_01/appdev.101/b12024/org/apache/soap/transport/http/SOAPHTTPConnection.html

and that the timeout value is an apache default, not something that is controlled by the Domino server.

I'd be grateful for any help.

Setting a timeout on webservice consumer built with org.apache.axis.client.Call and running on Domino

I'm maintaining an antedeluvian Notes application which connects to a SAP back-end via a manually done 'Webservice'

The server is running Domino Release 7.0.4FP2 HF97.

The Webservice is not the more recently Webservice Consumer, but a large Java agent which is using Apache soap.jar (org.apache.soap). Below an example of the calling code.

private Call setupSOAPCall() {
    Call call = new Call();

SOAPHTTPConnection conn = new SOAPHTTPConnection();
call.setSOAPTransport(conn);

call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);

There has been a change in the SAP system which is now taking 8 minutes to complete (verified by SAP Team).

I'm getting an error message as follows:

[SOAPException: faultCode=SOAP-ENV:Client; msg=For input string: "906    "; targetException=java.lang.NumberFormatException: For input string: "906    "]

I found a blog article describing the error message quite closely:

https://thejavablog.wordpress.com/category/jmeter/

and I've come to the hypothesis that it is a timeout message that is returning to my Call object and that this timeout message is being incorrectly parsed, hence the NumberFormat Exception.

Looking at my logs I can see that there is a time difference of 62 seconds between my call and the response.

I recommended that the server setting in the server document, tab Internet Protocols/HTTP/Timeouts/Request timeouts be changed from 60 seconds to 600 seconds, and the http task restarted with

tell http restart

I've re-run the tests and I am getting the same error, and the time difference is still slightly more than 60 seconds, which is not what I was expecting.

I read Michael Rulnau's blog entry

http://www.mruhnau.net/2014/06/how-to-overcome-domino-webservice.html

which points to this APR

http://www-01.ibm.com/support/docview.wss?uid=swg1LO48272

but I'm not convinced that this would apply in this case, since there is no way that IBM would know that my Java agent is in fact making a Soap call.

My current hypothesis is that I have to use either the setTimeout() method on

org.apache.axis.client.Call

https://axis.apache.org/axis/java/apiDocs/org/apache/axis/client/Call.html

or on the org.apache.soap.transport.http.SOAPHTTPConnection

https://docs.oracle.com/cd/B13789_01/appdev.101/b12024/org/apache/soap/transport/http/SOAPHTTPConnection.html

and that the timeout value is an apache default, not something that is controlled by the Domino server.

I'd be grateful for any help.

timeout issue apache axis 1.4-

I tried the below. Still it takes 60Sec to timeout. I am testing by providing a wrong URL.

GetSubsInfo subInfo= loc.getGetSubsInfoSOAPQSPort(new URL("http://DUMMYIP:8002/PULLHandler/GetSubsInfoWS_PS"));
                GetSubsInfoSOAPStub stub =  (GetSubsInfoSOAPStub) subInfo;
                log.info("GenericServiceImpl.getPackageSSP() getTimeout "+stub.getTimeout());
                stub.setTimeout(5000);
                stub._setProperty(org.apache.axis.client.Call.CONNECTION_TIMEOUT_PROPERTY, 10); 
                stub._setProperty(org.apache.axis.components.net.DefaultCommonsHTTPClientProperties.CONNECTION_DEFAULT_CONNECTION_TIMEOUT_KEY, 10); 
                stub._setProperty(org.apache.axis.components.net.DefaultCommonsHTTPClientProperties.CONNECTION_DEFAULT_SO_TIMEOUT_KEY, 10);

Any other way

Standard WebSphere JAX-RPC Web Service to Liberty profile

We have an old application with JAX-RPC webservice running on standard WebSphere Cluster. As part of porting it to the liberty profile, it was identified that the liberty does not support JAX-RPC.

What could be an approach to get this application running on liberty with minimum code changes needed ?

We attempted to create a new JAX-WS service with the same WSDL, however it runs into some issues.

Can the exact same code run with Apache Axis 1.4 runtime ?

Axis returns error java.lang.NoClassDefFoundError

I have an axis2-based web-service which calls another WebService to get some data. While trying to invoke another service somewhere inside axis2(I can not say exactly where because it's inside some axis2 class) error occurs and gets returned as response:

java.lang.NoClassDefFoundError: org/apache/axis2/jaxws/catalog/impl/OASISCatalogManager

So I guess I don't have some library or class installed.

Inside my folder WebService\WebContent\WEB-INF\classes\org\apache\axis2 I see 2 folders: Transport and WebApp.

As I know that class has to be inside axis2-metadata.jar and I've checked - I have "axis2-metadata-1.7.1.jar" in my classpath. So I've I've took jaxws/catalog/...etc... folders, containig missing classes (I guess), and put it inside axis2 folder just like transport and webapp, but error remains.

There's callstack of my error:

[ERROR] org/apache/axis2/jaxws/catalog/impl/OASISCatalogManager
java.lang.NoClassDefFoundError: org/apache/axis2/jaxws/catalog/impl/OASISCatalog
Manager
        at org.apache.axis2.jaxws.description.impl.ServiceDescriptionImpl.<init>
(ServiceDescriptionImpl.java:203)
        at org.apache.axis2.jaxws.description.impl.ServiceDescriptionImpl.<init>
(ServiceDescriptionImpl.java:172)
        at org.apache.axis2.jaxws.description.impl.DescriptionFactoryImpl.create
ServiceDescription(DescriptionFactoryImpl.java:134)
        at org.apache.axis2.jaxws.description.impl.DescriptionFactoryImpl.create
ServiceDescription(DescriptionFactoryImpl.java:79)
        at org.apache.axis2.jaxws.description.DescriptionFactory.createServiceDe
scription(DescriptionFactory.java:78)
        at org.apache.axis2.jaxws.spi.ServiceDelegate.<init>(ServiceDelegate.jav
a:218)
        at org.apache.axis2.jaxws.spi.Provider.createServiceDelegate(Provider.ja
va:83)
        at org.apache.axis2.jaxws.spi.Provider.createServiceDelegate(Provider.ja
va:79)
        at javax.xml.ws.Service.<init>(Unknown Source)
        at com.opentext.livelink.service.core.Authentication_Service.<init>(Auth
entication_Service.java:42)
        at com.opentext.livelink.service.fnc.ECMCleansingUtilsSkeleton.GetAuthTo
ken(ECMCleansingUtilsSkeleton.java:201)
        at com.opentext.livelink.service.fnc.ECMCleansingUtilsSkeleton.getWSIDLi
stByDPIDList(ECMCleansingUtilsSkeleton.java:88)
        at com.opentext.livelink.service.fnc.ECMCleansingUtilsMessageReceiverInO
ut.invokeBusinessLogic(ECMCleansingUtilsMessageReceiverInOut.java:51)
        at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusines
sLogic(AbstractInOutMessageReceiver.java:40)
        at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMe
ssageReceiver.java:106)
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:169)
        at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostReq
uest(HTTPTransportUtils.java:176)
        at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:1
63)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:305)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:210)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52
)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:210)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:222)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:123)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
torBase.java:502)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:171)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:100)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
953)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:409)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp
11Processor.java:1044)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(
AbstractProtocol.java:607)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoin
t.java:313)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

What should I do? Should I somehow configure axis2 to use those class files?

Please help.

upgrading commons-httpclient-3.1.jar to httpclient-4.5.2.jar

Well due to some vulnerability we need to move from commons-httpclient-3.1.jar to httpclient-4.5.2.jar

Now have a code base which was working before on 3.1, but the methods are depreceted in 4.5.2. Do you have any idea or came across on how to overcome these errors

Error I get is 1) The import org.apache.commons.httpclient.HostConfiguration cannot be resolved 2) The method getState() is undefined for the type HttpClient

Here is the source code. Let me know if you have any information.

import org.apache.axis.MessageContext;

import org.apache.axis.components.net.TransportClientProperties;
import org.apache.axis.components.net.TransportClientPropertiesFactory;
import org.apache.http.auth.Credentials;
import org.apache.commons.httpclient.HostConfiguration;
import org.apache.http.client.HttpClient;
import org.apache.http.auth.NTCredentials;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.auth.AuthScope;
import java.net.URL;


public class CommonsHTTPSender extends
        org.apache.axis.transport.http.CommonsHTTPSender {

    public static final String PROPERTY_PROXY_HOST = "https.proxyHost";
    public static final String PROPERTY_PROXY_PORT = "https.proxyPort";
    public static final String PROPERTY_PROXY_USERNAME = "https.proxyUser";
    public static final String PROPERTY_PROXY_PASSWORD = "https.proxyPassword";

    public CommonsHTTPSender() {
    }

    protected HostConfiguration getHostConfiguration(HttpClient client,
            MessageContext context, URL targetURL) {

        HostConfiguration config = new HostConfiguration();
        if ( targetURL.getProtocol().equalsIgnoreCase("https") )
        {
            //Jli: our changes start from here. There is a defect in the DefaultHTTPSTransportClientProperties.
            // The class is only called once to get the proxy setttings from the system properties. If users
            // Change the proxy settings, the class will not pick up the changes. On our DMDI GUI, users
            // can make the changes as often as they can. This will create an issue that when the apache axis
            // reconnect, it only picks up the proxy setup that users put in the GUI the first time.
            // We only use the HTTPS, so this change is only valid for the https.  

            int urlPort = targetURL.getPort();
            if (urlPort == -1) {
                urlPort = 443; // default port for https being 443
            }
            String proxyHost = (String)System.getProperty(PROPERTY_PROXY_HOST);
            String proxyPort = (String)System.getProperty(PROPERTY_PROXY_PORT);
            String proxyUsername = (String)System.getProperty(PROPERTY_PROXY_USERNAME);
            String proxyPassword = (String)System.getProperty(PROPERTY_PROXY_PASSWORD);

            if ( proxyHost == null || proxyPort == null ||
                    proxyHost.length() == 0  || proxyPort.length() == 0) {
                  config.setHost(targetURL.getHost(), urlPort, targetURL
                          .getProtocol());
            } else {
                 if ( proxyUsername != null &&  proxyPassword != null && proxyUsername.length() != 0) {
                    Credentials proxyCred = new UsernamePasswordCredentials(proxyUsername,
                            proxyPassword);
                    // if the username is in the form "user\domain"
                    // then use NTCredentials instead.
                    int domainIndex = proxyUsername.indexOf("\\");
                    if (domainIndex > 0) {
                        String domain = proxyUsername.substring(0,
                                domainIndex);
                        if (proxyUsername.length() > domainIndex + 1) {
                            String user = proxyUsername.substring(
                                    domainIndex + 1);
                            proxyCred = new NTCredentials(user, proxyPassword, proxyHost,
                                    domain);
                        }
                    }
                    client.getState().setProxyCredentials(AuthScope.ANY,
                            proxyCred);



                }
                int proxyPortInt = new Integer(proxyPort).intValue();
                config.setProxy(proxyHost, proxyPortInt);
            }     
        }
        else
        {
            config = super.getHostConfiguration(client, context, targetURL);
        }
        return config;
    }

}