Author Message
DmitrySenashenko
Joined: Nov 29, 2013
Messages: 72
Offline
Hi Folks,
Who knows how easier to put port and IP for web service request to variable?
OD is designed for putting of IP and port to web service string without variables. It is hardcoded.
But at my case IP and port can be different.
IP address is possible to put as DNS name. But the issue is in port.
How to prepare port for webservice request as variable which can be assigned by configurable variables for example?
Does somebody know any way?
Any help will be very appreciate.
Best regards, Dmitry
RossYakulis
Joined: Nov 6, 2013
Messages: 2652
Offline
I would recomment using CAV variables that way the value can be administered from EP. Add something like below to the operation java code. Also see attached image.


@Override
public void setEndpointFromParameter(String parameterName) {
// get the endpoint from the web.xml
super.setEndpointFromParameter(parameterName);

// Now insert the port from the "mycav" variable"
try {
URL u = new URL( this.endPoint);
IVariableField f = mySession.getVariableField(new VariableName(IProjectVariables.MYCAV));
URL u2 = new URL( u.getProtocol(), u.getHost(), f.getIntValue(), u.getFile());
// set new endpoint.
this.endPoint = u2.toString();
} catch (Exception e) {
// oops....
// just use the old endpoint maybe log an error here.
}
}

  • [Thumb - Capture.PNG]
[Disk] Download
DmitrySenashenko
Joined: Nov 29, 2013
Messages: 72
Offline
Hi, Thank you for your answer.
Looks like my question was not enough clear.

Yes, CAV is very good way and understand how to get it to java servlet with known mySession.
But how to put it to web service servlet?

I am able to find web service servlet at WEB-INF/src/connectivity.ws.beans folder and I am able to see it's java code:

public DataServiceImplServiceStub() throws org.apache.axis2.AxisFault {

this("http://192.168.0.101:7080/DataStorage/services/DataServiceImpl" );

}

I need to replace port at this string to CAV.
But here mySession is unknown and I am not able to get CAV here.
I am able to import needed runtime libs but mySession is unknown.

Or you mean need to work with web service directly from Java servlet with OD Webservice nodes?
Rg, Dmitry
RossYakulis
Joined: Nov 6, 2013
Messages: 2652
Offline
look in WEB-INF/src/connectivity.ws.operations and add that code to wsop java file there.
DmitrySenashenko
Joined: Nov 29, 2013
Messages: 72
Offline
Thanks so much. I am very appreciate.
Best regards, Dmitry
Go to:   
Mobile view