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:
<SOAPBody>
<FooRequest>
<SecurityToken>'security token'</SecurityToken>
</FooRequest>
</SOAPBody>
I have no problems extracting the contents of <SecurityToken>. 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:
<SOAPBody>
<FooRequest>
<SecurityToken>'username'</SecurityToken>
</FooRequest>
</SOAPBody>
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:
<SOAPBody>
<FooRequest>
<SecurityToken>'security token'</SecurityToken>
</FooRequest>
</SOAPBody>
I have no problems extracting the contents of <SecurityToken>. 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:
<SOAPBody>
<FooRequest>
<SecurityToken>'username'</SecurityToken>
</FooRequest>
</SOAPBody>
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.

Similar Messages

  • 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 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 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 - 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.

  • How do I modify custom step type that is part of a sequence?

    I have an example sequence that has a custom step type called "LabView Reentrant Action". My interest is to modify this step type to my needs. Because this custom step type is part of the sequence there is no definition in global type palette. I was told that I could copy this step into global type palette. But, I don't think I could.
    I can copy the step from the sequence space but I do not have an option to paste it in the palette.
    In sequence space I have options to choose LabView Reentrant Dialog Steps under Insert Step pull-down menu. When I open Step Type Menu Editor in the palette space, all types are listed except LabView Reentrant Dialog Steps. I think these are not showing in the palette because they are custom types built into the sequence.
    How can I extract the custom step type into global palette so that I could modify to my needs?

    Hello,
    If you already have the customer step type "LabView Reentrant Action" then to modify it all you need is to go in "Type Palette" (Ctrl-T) and make modifications in the step type.
    In case you are not able to see the step type in type palette then you need to add the step type in a custom ini file. You can add that ini file by clicking on customize in "Palettes" drop down menu. The you can copy paste a step in the step type and make modifications to the step.
    I would recommend going through Tutorial: How Do I Make a Custom Step Type? for more reference.
    I hope it helps..
    Rajiv

  • 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 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 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 ...

  • 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?

  • 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 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.

  • How can I include multiple limits in the sequence file documentat​ion for custom step type?

    Hi,
    I have a custom Step Type that contains Measurements property under Results. Its type is Array of NI_LimitMeasurement.
    I would like to see the values in the sequence file documentation like NI_MultipleNumericLimitTest type.
    Is there any trick to do that?
    Thanks,
    Andras

    Hi Andras,
    I have made  a slight change to the sequencefile 'docgen_txt.seq'.
    In the Sequence 'Step Doc' is a section which handles MultipleNumericLimit step type. There is a precondition check on the step 'Add Multiple Numeric Limits' if the step is of type 'NI_MultipleNumericLimit'. As your step type is based on the MultipleNumeric Limit type, I have just removed this precondition and just relied on the existence of Parameters.Step.Result.Measurement. Equally you could add a new section in this sequence to handle your Custom Step Type which is only called when the precodition match your type name.
    Now when you run the DocGen tool it handles your custom step type.
    Find attached my modified sequencefile 'docgen_txt.seq'.
    Just copy the contents of '..\National Instruments\TestStand 3.5\Components\NI\Tools\DocGen' to the User folder. Then place the attached file in the User\Tools\DocGen overwritting the version that is in that folder.
    Then launch TestStand and try it out on your sequence file.
    If you are using the html version, then you will have to make the same change into Step Doc sequence of the docgen_html sequence file.
    Hope this helps
    Regards
    Ray Farmer
    Message Edited by Ray Farmer on 05-19-2007 05:28 PM
    Regards
    Ray Farmer
    Attachments:
    docgen_txt.seq ‏184 KB

  • Can we add custom steps by default in startup,main and cleanup sequence

    I have made some of the custom steps which i want by default to be included in start up,main and clean up sequence when ever i press for a new sequence. I am using teststand4.0.Cna any help mein this regard.

    Hello kpraveen,
    Ray is correct in that you would need to create a Sequence File that loads a new sequence file into memory, then adds the specified step to the setup, main, and cleanup step groups of the new sequence files main sequence, and finally loads the new sequence file into the Sequence Editor. I've gone ahead and put together an example sequence that implements
    this. This example sequence places a Message Popup step in the setup,
    main, and cleanup step groups of a new sequence file (name will be
    "<no path>") loaded into the Sequence Editor. Once you've modified this sequence to load your custom steps, it is up to you where you place it for use in the toolbar. 
    As Ray suggested, I believe the Tools Menu would be the best place to have this feature since the Tools menu is not process model dependent. To add this option to the Tools Menu:
    1. Go to Tools»Customize.
    2. In the Items Text field select where you want to place this option in the Tools Menu list and click Add.
    3. In the Add Tools Menu Item window, select Sequence as the Item Type from the drop down menu.
    4. Browse to New Custom Sequence File.seq in the Sequence File field then select Main Sequence in the Sequence field.
    5. Click OK to exit the Add Tools Menu Item window.
    6. In the Customize Tools Menu window, change the name of your Tools option in the Item Text Expression field. For example I changed the Item Text Expression field to "New Custom Sequence File". 
    6. Click OK to exit the Customize Tools Menu window.
    7. Now if you go to Tools, you should see the New Custom Sequence File option and once clicked, it should load a new sequence file with your specified steps in the Setup, Main, and Cleanup step groups.
    This should get you on your way kpraveen. Good luck! 
    Manooch H.
    National Instruments
    Attachments:
    New Custom Sequence File_40.seq ‏5 KB

Maybe you are looking for