Hi mike.bowman,
Please refer webM API for an answer to your question. Obviously, while scheduling and invoking getCurrentPort, it cannot resolve the port number associated with the excution thread (that of scheduler) and hence, returns -1.
If you have any other questions, please post. Let us know why you need to invoke getCurrentPort from a scheduled service. Maybe there is a better solution approach to your requirements.
Here is the excerpt from the API.
com.wm.app.b2b.server
Class ServerAPI method getCurrentPort
public static int getCurrentPort()
Returns the port number associated with the current thread of execution. The current thread of execution has an associated InvokeState object which encapsulates the information describing every service invocation (for example, the service being invoked, the user invoking the service, inputs to the service, etc). If the InvokeState object associated with the current thread of execution cannot resolve the port number, then -1 is returned.
#webMethods#Integration-Server-and-ESB#webMethods-General