OWSM Custom Step - Determine Remote Address

I'm working on a custom step that provides custom metrics for some of our web services (BPEL). The only thing that I haven't been able to figure out is the remote address.
The heart of my code is:
public IResult execute(IMessageContext messageContext) throws Fault {
Result result = new Result();
result.setStatus(IResult.FAILED);
boolean isRequest = (IMessageContext.STAGE_REQUEST.equals(messageContext.getProcessingStage()) || IMessageContext.STAGE_PREREQUEST.equals(messageContext.getProcessingStage()));
if (!isRequest) {
result.setStatus(IResult.SUCCEEDED);
return result;
try {
log(messageContext);
result.setStatus(IResult.SUCCEEDED);
} catch (Exception ex) {
messageContext.getInvocationStatus().setErrorMessage(ex.getMessage());
generateFault(ex.getMessage());
return result;
private void log(IMessageContext messageContext) throws Exception {
String client = null;
try {
client = ((MessageContext) messageContext).getRemoteAddr();
// HttpServletRequest httpServletRequest = (HttpServletRequest) messageContext.getProperty("javax.servlet.request");
// if (httpServletRequest != null) {
// client = httpServletRequest.getHeader("Host");
} catch (Exception ex) {
String msg = "Unable to extract the client IP address.";
throw new Exception (msg);
<continue capturing metrics and log to the database>
The problem is, client is always null. I've tried both techniques I've found online and neither of them seem to produce any results. Could there be some server configuration that is preventing this information from be sent to OWSM?

mrmora,
After opening a Service Request and communicating with one of Oracle's reps, I was told that the HttpServletRequest (and I guess other client info) is never available for either the Server Agent or Client Agent.
I created a Gateway, instead, and and I'm now getting the HttpServletRequest and the client's IP. Both of these codes now work:
HttpServletRequest request = (HttpServletRequest)messageContext.getProperty("javax.servlet.request");
String clientIP = httpSrvltRqst.getRemoteHost();
=====
String clientIP = ((MessageContext)messageContext).getRemoteAddr();
Thanks.

Similar Messages

  • OWSM custom step

    I am creating a OWSM custom step for validating 'XML Signature Verification'. The step provided by the tool has some limitations (if otherwise please correct me).
    Only one certificate can be configured and the certificates need to be provided in jks file store.
    My requirements are a bit different. I am using both username token as well as XML signatures. Using the username I will retrieve the certificate from the LDAP or database. But my question is how do I verify the XML signature. Can I extend the step already provided in OWSM?
    I have already written a custom step that retrieves the certificate from the database using the username.
    Thanks,
    Sashwat

    I've come across the following Beans which look like they provide the details I need:
    com.cfluent.webui.uibeans.opcockpit.ServiceLatencyBean;
    com.cfluent.webui.uibeans.opcockpit.MessageTrafficBean;
    Has anyone used these and tried to access data via these beans directly?

  • OWSM Custom Step SOAPMessage Class Problem

    I have SOA Suite installed on several different machines. All have BPEL, ESB, and OWSM installed. I have a BPEL process that calls a web service hosted on a remote machine that uses a OWSM client agent to do "security stuff". I have a custom OWSM step that does the "security stuff". On one machine everything works as it should. On another machine, I am getting the following error in the execute() method of my custom step implementation:
    java.lang.UnsupportedOperationException: getSOAPBody must be overridden by all subclasses of SOAPMessage:
    at my.custom.step.CustomStep(CustomStep:83)
    at com.cfluent.pipelineengine.container.DefaultPipeline.execute(DefaultPipeline.java:124)
    at com.cfluent.pipelineengine.container.DefaultPipeline.execute(DefaultPipeline.java:97)
    at com.cfluent.pipelineengine.container.DefaultPolicy$DeferredPipeline.execute(DefaultPolicy:63)
    at com.cfluent.pipelineengine.container.DefaultPolicy$DeferredPipeline.access$300(DefaultPolicy:18)
    <snipped>
    Here's the snippet of code from the execute() method of the custom step:
    SOAPMessage soapMsg = messageContext.getRequestMessage();
    if ( soapMsg.getSOAPBody().hasFault()) // !!!!!!!!!!!!!!!!!!!!!!!! Here's where the error is occurring
    When I log out soapMsg.getClass().getName() I get "org.apache.axis.Message".
    Now, when I execute the same piece of code on another machine, it works fine and the class for SOAPMessage
    is oracle.j2ee.ws.saaj.soap.soap12.Message12.
    Any idea why the class difference? Is there some SOAPFactory configuration value somewhere?
    Thanks in advance.

    mrmora,
    After opening a Service Request and communicating with one of Oracle's reps, I was told that the HttpServletRequest (and I guess other client info) is never available for either the Server Agent or Client Agent.
    I created a Gateway, instead, and and I'm now getting the HttpServletRequest and the client's IP. Both of these codes now work:
    HttpServletRequest request = (HttpServletRequest)messageContext.getProperty("javax.servlet.request");
    String clientIP = httpSrvltRqst.getRemoteHost();
    =====
    String clientIP = ((MessageContext)messageContext).getRemoteAddr();
    Thanks.

  • OWSM Custom Step to modify SOAPBody

    We're trying to write a custom step that takes a username out of a WS-SECURITY header and forces it into an element in our SOAPBody.
    My code to pull the name from the header works fine, so does my code to iterate through the body to find the element I want to modify. But then what? setObjectValue doesn't seem to work. I also know that I've got to use setDirty, but when I run it on my soapbodyelement then most of the body disappears from the soap message.
    try {
    org.apache.axis.message.SOAPEnvelope env = soapMessage.getAxisMessage().getSOAPEnvelope();
    env.setDirty(true);
    SOAPBody soapBody = (SOAPBody)env.getBody();
    soapBody.setDirty(true);
    java.util.Iterator iterator = soapBody.getChildElements();
    while (iterator.hasNext()) {
    SOAPBodyElement bodyElement = (SOAPBodyElement)iterator.next();
    java.util.Iterator childIterator = bodyElement.getChildElements();
    while (childIterator != null && childIterator.hasNext()) {
    MessageElement childElement = (MessageElement)childIterator.next();
    if (childElement.getName() == "usernamein1") {
    log("Hey, I found the username 1 paramenter");
    log("old child element value" + childElement.getValue());
    childElement.setObjectValue("eureeka");
    ((org.apache.axis.message.MessageElement)childElement).setDirty(true);
    logSOAPMessage(soapMessage);
    I've seen the thread and blog post about adding a new header and I've done that. But I can't seem to affect the body, except to destroy it.
    So again, my goal is to take a WS-SECURITY username and force it in to a particular body element so that my web service (which is a pl/sql stored procedure) can know who it is talking to for auditing purposes. Help!

    I was never able to find out exactly why the problem occurs with setDirty(true) on an existing SOAPBodyElement in the message, but I did find a way to circumvent the problem.
    Basically what I did was to create a new SOAPBodyElement with the same Name, add that as a child to the SOAPBody, add the children of the old SOAPBodyElement to the new one, and detach the old SOAPBodyElement. Using setDirty(true) on the new element did not drop the content.
    SOAPEnvelope senv = msg.getAxisMessage().getSOAPEnvelope();
    SOAPBody sBody = (SOAPBody) senv.getBody();
    SOAPBodyElement serviceRequestOld = senv.getFirstBody();
    SOAPBodyElement serviceRequest = (SOAPBodyElement) sBody.addBodyElement(serviceRequestOld.getElementName());
    ArrayList<MessageElement> serviceRequestChildrenOld = serviceRequestOld.getChildren();
    for (MessageElement oldMessageElement : serviceRequestChildrenOld) {
    serviceRequest.addChild(oldMessageElement);
    serviceRequestOld.detachNode();
    // modify children as needed
    // setDirty(true) on changed elements and all the way up the hierarchy
    serviceRequest.setDirty(true);
    sBody.setDirty(true);
    senv.setDirty(true);
    This was helpful:
    http://www.oracle.com/technetwork/articles/jones-owsm-101767.html

  • OWSM custom step & web service proxy

    Hello!
    I'm writing custom step, in which I want to call methods from another web services. So I generated in JDev (i'm using 10g) Web Service Proxy, I have all needed classes generated,
    and I want to use it in my custom step (i.e. invoke some method). But when I try to build .jar I get errors like this:
    [javac] C:\Documents and Settings\admin\Pulpit\My Dropbox\my_apps\Laboratoria\PEP\src\pep\proxy\runtime\PDPConnectorPortBinding_Stub.java:61: cannot find symbol
    [javac] symbol : method setProperty(java.lang.String,java.lang.Object)
    [javac] location: class javax.xml.soap.SOAPMessage
    [javac] _state.getMessageContext().getMessage().setProperty("DimeEncode",_getProperty(ClientConstants.DIME_ENCODE_MESSAGES_WITH_ATTACHMENTS));
    what is the problem? some classes incompatiblity? I tried to use jdk 1.5 and 1.6...
    Best regards,
    Michal

    Hi,
    Are you accessing teh WSDl from a deployed service ? If yes, when providing the Web Service URL, did you extend the URL with ?WSDL ?
    Frank

  • ** OWSM Custom Step: Accessing OWSM Monitor Metrics Programmatically ?? **

    Hi all,
    I have posted this in the SOA Forum with no response, so trying my luck here.
    I would like to programmatically access the OWSM monitor metrics, specifically the Service Statistics (Traffic Analysis and Latency Variance).
    Is there any way to programmatically query the current Stats for the service protected by OWSM policies?
    I would like create a custom policy step that interrogates the current OWSM Monitor status of the Service, and then actions it accordingly.
    I have looked in the Extensibility Guide, but documentation is not very clear.
    I have found classes in com.cfluent.coreman.sdk.* and com.cfluent.webui.uibeans.opcockpit.* which seem useful, but no documentation is available as these APIs do not appear to be published.
    Any help would be greatly appreciated.

    I've come across the following Beans which look like they provide the details I need:
    com.cfluent.webui.uibeans.opcockpit.ServiceLatencyBean;
    com.cfluent.webui.uibeans.opcockpit.MessageTrafficBean;
    Has anyone used these and tried to access data via these beans directly?

  • OWSM - Build a Pause into a Custom Step

    Hi,
    We have been experiencing an EOF error in BPEL process on response step of remote Web Service invocation. The invocation is in a loop which will retrieve data from 3rd party web service until no data left to return, so could run through 100 invocations in quick succession. We are using a clustered 10.1.3.4 environment. I cannot replicate this in our UAT environment which is exactly the same build as our Production. Never get the error, no matter how big the payload in response or frequency of invocations. It shares the same environment, config, firewalls..etc. I have set the Disable Keep Alives which is still not resolving the issue. The problem is intermittant and only seems to occur on request/response steps taking over 3 seconds. We have had all the firewall policies checked on our side and on 3rd parties side, with not timeout policies found. In order to try and replicate the issue, I was hoping to build a wait into the reponse of message via OWSM custom step. However, no matter what I try, OWSM just ignores this and keeps processing.
    Used a template with a variable for sleep time in milliseconds to deploy custom step, which appears in policies and the variable can be assigned a value like 5000 (5 seconds). Invocation runs fine with message being returned from BPEL process, just does not wait! Has anyone got any ideas on the initial issue or how to get the wait to work.
    Thanks
    Custom Step Code below:
    import com.cfluent.policysteps.sdk.AbstractStep;
    import com.cfluent.policysteps.sdk.Fault;
    import com.cfluent.policysteps.sdk.IMessageContext;
    import com.cfluent.policysteps.sdk.IResult;
    import com.cfluent.policysteps.sdk.Result;
    public class SleepStep extends AbstractStep {
    public SleepStep() {
    public IResult execute(IMessageContext messageContext) throws Fault {
    IResult resultStatus = new Result();
    resultStatus.setStatus(IResult.FAILED);
    try {
    //Getting the SOAPMessage object from the context
    javax.xml.soap.SOAPMessage soapMessage = messageContext.getRequestMessage();
    // Code to generate a specific wait time in milliseconds
    long time = ((Long)messageContext.getProperty("time_to_sleep")).longValue();
    long start,stop;
    start=System.currentTimeMillis();
    do{
    stop=System.currentTimeMillis();
    } while ((stop-start)<time);
    resultStatus.setStatus(IResult.SUCCEEDED);
    //Set the SOAP Request back into the context
    messageContext.setRequestMessage(soapMessage);
    } catch (Exception ex) {
    String errMsg = ex.getMessage();
    generateFault(errMsg);
    return resultStatus;
    } }

    So it is not possible to use setInterval() inside a for()
    loop?
    "kglad" <[email protected]> wrote in message
    news:eth4g6$2np$[email protected]..
    > you can't. use an onEnterFrame() or setInterval() loop.

  • OWSM: Where to put additional jars for a custom step

    I'm in the process of creating a custom step for OWSM. The step relies on some additional libraries that are not found on the server at the moment. Where do I put them so that my custom step will find them?
    I'd like to avoid packaging them into the steps jar file if possible.

    You can put anywhere and probably create shared library in your server.xml and import them in following shared libraries:
    oracle.wsm.policymanager
    oracle.wsm.gateway
    oracle.wsm.coreman
    oracle.wsm.ccore
    HTH,
    Chintan

  • OWSM: How to reference Custom Step properties/parameters?

    Hi,
    When you define a Custom Step via a XML file. You can define properties/parameters. In the sample files that comes with OWSM (CustomAuthenticationStep.xml) Username and Password are defined. My problem is that I cannot figure out how to reference these in the Java Step source. In the sample file CustomAuthenticationStep.java there are no references. There are two class variables called expectedUsername and expectedUserPassword, but they are never set in the source? There are nothing in the Extensibility Guide about this. Anybody know how it works?
    Regards Peter

    I've made a couple of these now. It somehow walks through the xml file you upload and then the properties defined are matched with the appropriate get/set methods in the actual java code.
    One example I had to make was to add HTTP Basic Auth headers to a request. Here is the section of the xml file.
    <csw:PropertyDefinitionSet name="HTTP Basic Auth Params">
    <csw:PropertyDefinition name="httpBasicAuthUsername" type="string" isRequired="true">
    <csw:DisplayName>Username</csw:DisplayName>
    <csw:Description>Http Basic Auth Username</csw:Description>
    <csw:DefaultValue>
    <csw:Absolute>USERNAME</csw:Absolute>
    </csw:DefaultValue>
    </csw:PropertyDefinition>
    <csw:PropertyDefinition name="httpBasicAuthPassword" type="string" isRequired="true" displayType="password">
    <csw:DisplayName>Http Basic Auth Password</csw:DisplayName>
    <csw:Description>Password to access Private Key</csw:Description>
    <csw:DefaultValue>
    <csw:Absolute>PASSWORD</csw:Absolute>
    </csw:DefaultValue>
    </csw:PropertyDefinition>
    </csw:PropertyDefinitionSet>
    You then have these get/set methods at the bottom of the class I created.
    public String gethttpBasicAuthUsername() {
    return this._httpBasicAuthUsername;
    public void sethttpBasicAuthUsername(String username) {
    this._httpBasicAuthUsername = username;
    public String gethttpBasicAuthPassword() {
    return this._httpBasicAuthPassword;
    public void sethttpBasicAuthPassword(String password) {
    this._httpBasicAuthPassword = password;
    Then I had this and the properties were available for use.
    public class BasicAuthStep extends AbstractStep {
    private String _httpBasicAuthUsername = null;
    private String _httpBasicAuthPassword = null;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • OWSM 10g Custom step deployment

    I try to deploy a custom step in OWSM 10g. Does anyone know where should I put the custom.jar and how to deploy it?

    Put the JAR file in $ORACLE_HOME/owsm/lib/custom
    Restart SOA Suite and away you go ...

  • Custom Step for inserting SAML in OWSM

    Hi All,
    I am working on creating a custom step for SAML assertion in OWSM 10g.
    I did the following things
    1) Extented AbstractStep class, and Implemented its methods (init,destroy,execute...)
    2) Compiled and created java archieve; placed in the custom folder of owsm
    3) Created the step template xml with accordance to the class and imported it.
    In the java class i used com.cfluent.policysteps.security.saml.InsertSAMLSVStep.
    Can any one assist me in finding some documentation on the class?
    Edited by: Justin Smith on Dec 1, 2010 4:08 AM

    I shud have posted this question in SOA Suite forum, but still, any feed back is welcomed. :)

  • OWSM Server Agent custom steps

    Can someone please lead me to a document and/or provide instructions that detail how to configure a custom step (like the one in C:\product\10.1.3.1\OracleAS_1\owsm\samples\customsteps) into an existing server agent policy as one of the pipeline steps. It's not obvious which option it is in the "Step Template" drop-down menu; unless I'm missing something; I'm also thinking the custom step (code/package) itself is a template and needs to be configured so that it appears in the pipeline "Step Template" drop-down.
    Thanks in advance!

    Found it.
    http://www.oracle.com/technology/obe/fusion_middleware/owsm/custom%20steps/custom%20steps.htm

  • OWSM: Modify SOAPMessage in custom step

    I'm working on a custom step to provide web service authentication. For whatever reason, I've been told that to put the security token inside of of the SOAPBody and not in a header. Anyway, our request will look something like:
    &lt;SOAPBody&gt;
    &lt;FooRequest&gt;
    &lt;SecurityToken&gt;'security token'&lt;/SecurityToken&gt;
    &lt;/FooRequest&gt;
    &lt;/SOAPBody&gt;
    I have no problems extracting the contents of &lt;SecurityToken&gt;. Once extracted, I run the token through some processing to return a username. At that point, I want to replace 'security token' with the 'username' I computed.
    So my BPEL process will receive something like:
    &lt;SOAPBody&gt;
    &lt;FooRequest&gt;
    &lt;SecurityToken&gt;'username'&lt;/SecurityToken&gt;
    &lt;/FooRequest&gt;
    &lt;/SOAPBody&gt;
    Problem is I don't see how to easily accomplish this. For whatever reason, my SOAPElement does not have the setValue function available. I've gone as far as detaching the element and then recreating it. But in doing so, I'm not able to get the namespaces and prefixes setup easily.
    Any ideas?
    I think I'm going to have to convince some people that it would be better to put the 'security token' in WS-Security's BinarySecurityToken and then adding the UsernameToken to the SOAPHeader.

    I'm working on a custom step to provide web service authentication. For whatever reason, I've been told that to put the security token inside of of the SOAPBody and not in a header. Anyway, our request will look something like:
    &lt;SOAPBody&gt;
    &lt;FooRequest&gt;
    &lt;SecurityToken&gt;'security token'&lt;/SecurityToken&gt;
    &lt;/FooRequest&gt;
    &lt;/SOAPBody&gt;
    I have no problems extracting the contents of &lt;SecurityToken&gt;. Once extracted, I run the token through some processing to return a username. At that point, I want to replace 'security token' with the 'username' I computed.
    So my BPEL process will receive something like:
    &lt;SOAPBody&gt;
    &lt;FooRequest&gt;
    &lt;SecurityToken&gt;'username'&lt;/SecurityToken&gt;
    &lt;/FooRequest&gt;
    &lt;/SOAPBody&gt;
    Problem is I don't see how to easily accomplish this. For whatever reason, my SOAPElement does not have the setValue function available. I've gone as far as detaching the element and then recreating it. But in doing so, I'm not able to get the namespaces and prefixes setup easily.
    Any ideas?
    I think I'm going to have to convince some people that it would be better to put the 'security token' in WS-Security's BinarySecurityToken and then adding the UsernameToken to the SOAPHeader.

  • How to add custom field in delivery address/performance location tab in SRM shopping cart and Ship to address Pop-up in SRM PO?

    Hi Experts
    i have a reuirement where i have to add custom field in delivery address/performance location tab in SRM shopping cart and Ship to address Pop-up in SRM PO
    i am doing below steps for this.
    1. Adding custom field ZZfield in structure INCL_EEW_PD_PARTNER_CSF by  using  append structure.
    2. Spro ->Supplier Relationship Management -> SRM Server -> Cross application basic settings -> Extensions and field controls (personalization) -> Configure field control ->Configure Control for Fields of Substructures
    then click on  "Metadata for Fields of Substructures and Table-Like Enhancements"  
    add the below entry
    Bus. Object Set Type  : I am trying 7 and 29
    Structure Field Name  : ZZfield
    Bus. Object Type       : BUS2121/BUS2201
    Set Level                    : Item
    Field Visible :  Check box should be checked
    Field Enable :  check box should be checked
    Can anyone has the idea of this?
    Thanks
    Rohit

    Hello Rohit,
    Please create a enchancement for component  /SAPSRM/WDC_UI_DO_SHIPTO.
    Add new input field and label in view V_DODC_SHIPTO.
    Bind the input field value with field ZZfield from structure  /SAPSRM/WDC_UI_DO_SHIPTO in the context node SHIP_TO .
    Regards,
    Neelima

  • Can I check remote address connecting to a ServerSocket before accepting?

    I have a ServerSocket for which I'd like to implement an IP filter, using an allow or deny list to control which IP addresses can connect. After accepting the connection, I check the remote address on the Socket that is created, and apply the filter. However, if I close the connection to a denied address, the client sees that the connection was accpeted, but then it throws a SocketException when it tries to write to it.
    That accomplishes the purpose of the filter, but it doesn't seem like good behavior from the client's perspective. I'd like to implement a ServerSocket that doesn't even accept the connection if the remote address is not permitted. Is there any way to do that?

    Why not write a connection accepted/refused message
    to the client and then carry on (or close the
    socket/streams at both ends)?I'm not sure I understand your suggestion. When ServerSocket.accept() returns by providing a Socket object, that is the first time the server code can determine the IP address of the client and apply an IP filter. However, the connection has already been established at this point, so it's not possible to make an accept/refuse decision for the connection based on the client IP address. By the time the server code sees the IP address, the connection has already been accepted, and the only recourse is to close the connection from the server (by calling close() on the Socket object that was returned), and the client will then throw an exception with the message saying that the software closed the connection.
    Legitimate users trying to connect may interpret this as a software problem, if they don't know any better. Intruders will discover from this behavior that the port is open through the firewall, and may conclude that IP filtering is being applied, and if they have some idea of what IP addresses are allowed, they could easily spoof them. Or they could keep trying, hoping to catch the server when the IP filtering is turned off.
    It would be better to mimic the filtering behavior of a firewall, whereby the connection is not established. Then the client would report that it could not establish the connection, and the user would be more likely to look into whether the port is open or IP filtering is occurring, rather than thinking there is a software problem. And the intruder would conclude that the port is not open and go somewhere else.
    I would need a different implementation of ServerSocket to do this. I checked jakarta commons net, but that only provides client side utilities. I'm currently untangling the source code of java.net.ServerSocket to see how difficult it will be to override the accept() method to provide filtering behavior. This seems like a useful thing, and I thought perhaps someone had already done so. Or perhaps someone can tell me why this is not a good idea.
    Message was edited by:
    MidnightJava

Maybe you are looking for