You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by camikusch <ca...@web.de> on 2019/10/14 12:57:48 UTC

[Solved] Re: Axis2 receiving and sending in one Method fails

Am Tue, 8 Oct 2019 08:34:23 -1000
schrieb "robertlazarski ." <ro...@gmail.com>:

> Please see my comments inline.
>
> On Tue, Oct 1, 2019 at 11:51 PM camikusch <ca...@web.de> wrote:
>
> > Hi,
> >
> > I'm trying to implement something like a SOAP Proxy.
> > Database sends SOAP request to my Tomcat Server, Tomcat Server
> > sends a Request to
> > a Remote Server. The Answer from the Remote Server gets back to
> > Tomcat and from there back to the Database.
> >
> > The single steps "Database to Tomcat" and "Tomcat to remote Server"
> > are working, but
> > as soon as i try to combine them the "Tomcat to remote Server" part
> > fails with an AxisFault.
> >
> > The following code runs on my Tomcat Server and receives Requests
> > just fine (here: login() ).
> > I'm creating a new Stub Service with the URL of the remote Server
> > and then i try to send
> > a request with it (stub.login()) which fails with an
> > "org.apache.axis2.AxisFault: Function 'To' does not exist".

The problem was resolved by creating a new connection manager in the
constructor of the receiving service class.
It seems in standard configuration its not possible to make a SOAP
request while still working on an incoming request.

/**
 * Constructor that takes in a configContext and useseperate listner
 */
public
BGNILIASSoapWebserviceStub(org.apache.axis2.context.ConfigurationContext
configurationContext, java.lang.String targetEndpoint, boolean
useSeparateListener) throws org.apache.axis2.AxisFault { //To populate
AxisService populateAxisService();
	populateFaults();

	// mikusch start
	if (null == configurationContext) {
		try {
			configurationContext =
	ConfigurationContextFactory.createDefaultConfigurationContext(); }
	catch (Exception ex) { throw new AxisFault(ex.getMessage());
		}
	}
	MultiThreadedHttpConnectionManager conmgr = new
	MultiThreadedHttpConnectionManager();
	conmgr.getParams().setDefaultMaxConnectionsPerHost(10);
	HttpClient client = new HttpClient(conmgr);
	configurationContext.setProperty(HTTPConstants.CACHED_HTTP_CLIENT,
	client);
	configurationContext.setProperty(HTTPConstants.REUSE_HTTP_CLIENT,
	"true"); // mikusch ende

	_serviceClient = new
	org.apache.axis2.client.ServiceClient(configurationContext,
	_service);

	_serviceClient.getOptions().setTo(new
	org.apache.axis2.addressing.EndpointReference( targetEndpoint));
	_serviceClient.getOptions().setUseSeparateListener(useSeparateListener);

}

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org