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/02 09:50:39 UTC

Axis2 receiving and sending in one Method fails

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".
--------------------------------------------------------------------------------
/**
 * Auto generated method signature ILIAS login function
 *
 * @param login196
 * @return loginResponse197
 */
public iluseradministration.LoginResponseDocument login(iluseradministration.LoginDocument login196) {
	gLogger.Log("INCOMING:\n" + login196.xmlText());
	try {
		ILIASSoapWebserviceStub stub = new ILIASSoapWebserviceStub(ILIAS_ENDPOINT);
		LoginResponseDocument login = stub.login(login196);
		gLogger.Log("SERVER RESULT:\n" + login.xmlText());
		return login;
	} catch (AxisFault ex) {
		gLogger.LogException("EXCEPTION: " + ex.getMessage() + "\n" + ex.getReason(), ex);
		throw new java.lang.UnsupportedOperationException(ex);
	} catch (RemoteException ex) {
		gLogger.LogException("EXCEPTION: " + ex.getMessage(),ex);
		throw new java.lang.UnsupportedOperationException(ex);
	}
}
--------------------------------------------------------------------------------

Log excerpt with stack trace
--------------------------------------------------------------------------------
00002 de.bgn.kvm.ilias.ILIASSoapWebservice.<init> Line:71 Logdatei: 2019.10.02_09:19:23_342.log
00001 de.bgn.kvm.ilias.ILIASSoapWebservice.<init> Line:72 GIT-Version: Git Branch:master  Git Hash:9afefe86
00173 de.bgn.kvm.ilias.ILIASSoapWebservice.login Line:1539 INCOMING:
<urn:login soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="htt....
         <client xsi:type="xsd:string">client</client>
         <username xsi:type="xsd:string">username</username>
         <password xsi:type="xsd:string">password</password>
      </urn:login>
00420 de.bgn.kvm.ilias.ILIASSoapWebservice.login Line:1550 EXCEPTION: Function 'To' does not exist
Function 'To' does not exist
org.apache.axis2.AxisFault: Function 'To' does not exist
	at
org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:508)
at
org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:368)
at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:414)
at
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225)
at
org.apache.axis2.client.OperationClient.execute(OperationClient.java:150)
at
de.bgn.kvm.ilias.ILIASSoapWebserviceStub.login(ILIASSoapWebserviceStub.java:12080)
at
de.bgn.kvm.ilias.ILIASSoapWebservice.login(ILIASSoapWebservice.java:1546)
at
de.bgn.kvm.ilias.ILIASSoapWebserviceMessageReceiverInOut.invokeBusinessLogic(ILIASSoapWebserviceMessageReceiverInOut.java:1536)
at
org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at
org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:106)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:169) at
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:178)
at
org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:164) ....
--------------------------------------------------------------------------------

I've tried several things to track down where that AxisFault may come from
- Changed the ILIAS_ENDPOINT URL to an invalid Endpoint. Got 404, so the remote Server is reachable.
- Changed the variable login196 (used in stub.login(login196)) to a locally new created one. Still the same AxisFault.

My guess is that its "something" axis2 internally related, that i cant simply receive a request on my Tomcat
Server, and while working on that request send another one to the remote Server.
But thats where i'm lost :/

Appreciating any help, Christoph.

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


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

Posted by camikusch <ca...@web.de>.
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


Re: Axis2 receiving and sending in one Method fails

Posted by "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".
>
> --------------------------------------------------------------------------------
> /**
>  * Auto generated method signature ILIAS login function
>  *
>  * @param login196
>  * @return loginResponse197
>  */
> public iluseradministration.LoginResponseDocument
> login(iluseradministration.LoginDocument login196) {
>         gLogger.Log("INCOMING:\n" + login196.xmlText());
>         try {
>                 ILIASSoapWebserviceStub stub = new
> ILIASSoapWebserviceStub(ILIAS_ENDPOINT);
>                 LoginResponseDocument login = stub.login(login196);
>                 gLogger.Log("SERVER RESULT:\n" + login.xmlText());
>                 return login;
>         } catch (AxisFault ex) {
>                 gLogger.LogException("EXCEPTION: " + ex.getMessage() +
> "\n" + ex.getReason(), ex);
>                 throw new java.lang.UnsupportedOperationException(ex);
>         } catch (RemoteException ex) {
>                 gLogger.LogException("EXCEPTION: " + ex.getMessage(),ex);
>                 throw new java.lang.UnsupportedOperationException(ex);
>         }
> }
>
> --------------------------------------------------------------------------------
>
> Log excerpt with stack trace
>
> --------------------------------------------------------------------------------
> 00002 de.bgn.kvm.ilias.ILIASSoapWebservice.<init> Line:71 Logdatei:
> 2019.10.02_09:19:23_342.log
> 00001 de.bgn.kvm.ilias.ILIASSoapWebservice.<init> Line:72 GIT-Version: Git
> Branch:master  Git Hash:9afefe86
> 00173 de.bgn.kvm.ilias.ILIASSoapWebservice.login Line:1539 INCOMING:
> <urn:login soapenv:encodingStyle="
> http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="htt....
>          <client xsi:type="xsd:string">client</client>
>          <username xsi:type="xsd:string">username</username>
>          <password xsi:type="xsd:string">password</password>
>       </urn:login>
> 00420 de.bgn.kvm.ilias.ILIASSoapWebservice.login Line:1550 EXCEPTION:
> Function 'To' does not exist
> Function 'To' does not exist
> org.apache.axis2.AxisFault: Function 'To' does not exist
>         at
>
> org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:508)
> at
>
> org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:368)
> at
>
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:414)
> at
>
> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225)
> at
> org.apache.axis2.client.OperationClient.execute(OperationClient.java:150)
> at
>
> de.bgn.kvm.ilias.ILIASSoapWebserviceStub.login(ILIASSoapWebserviceStub.java:12080)
> at
> de.bgn.kvm.ilias.ILIASSoapWebservice.login(ILIASSoapWebservice.java:1546)
> at
>
> de.bgn.kvm.ilias.ILIASSoapWebserviceMessageReceiverInOut.invokeBusinessLogic(ILIASSoapWebserviceMessageReceiverInOut.java:1536)
>

Looks like your invokeBusinessLogic() method was generated WSDL2Java or
some other type of auto generation, and fails on 1536 of the class .

What happens when you log the message context? You can get it as a String
like so:

String request = messageContext.getEnvelope().toString();

I suppose you have some type of Skeleton implementation there, might help
for you to post that method here.

Regards,
Robert

>
> at
>
> org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
> at
>
> org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:106)
> at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:169) at
>
> org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:178)
> at
> org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:164)
> ....
>
> --------------------------------------------------------------------------------
>
> I've tried several things to track down where that AxisFault may come from
> - Changed the ILIAS_ENDPOINT URL to an invalid Endpoint. Got 404, so the
> remote Server is reachable.
> - Changed the variable login196 (used in stub.login(login196)) to a
> locally new created one. Still the same AxisFault.
>
> My guess is that its "something" axis2 internally related, that i cant
> simply receive a request on my Tomcat
> Server, and while working on that request send another one to the remote
> Server.
> But thats where i'm lost :/
>
> Appreciating any help, Christoph.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
>