Skip to Main Content

Oracle Developer Tools for VS Code

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Are you using Directory Servers (LDAP) to connect to Oracle Database? Please read

Christian.Shay -OracleMay 4 2020 — edited Mar 21 2021

Hi all,

EDIT 3/21/21:

We just released version 19.3.4 which should finally fix the LDAP issues plus adds support for VS code on macOS and Linux as well. No special LDAP installation is required. 

The quickstart contains step by step instructions showing how to connect using Directory Servers (LDAP). Please check it out:

https://www.oracle.com/database/technologies/appdev/dotnet/odtvscodequickstart.html

Thanks,

Christian

Comments

Create a string variable in BPEL.

Set the value of SHA1 to the variable using setVariableData() method.

Re-assign the variable to the XMLElement in assign activity in BPEL.

3741383

hi

thankyou for answering..

do i have to put library for SHA1 as well?

how i do i set the variable in Java method? i am really dont know java code

Please refer to Section 13.2.3 and 13.3 here

3741383

hello @"Hemanth Lakkaraju-Oracle"

i finally figured out, how to use java embedded.. so here is my code

XMLElement pwdElement = (XMLElement)getVariableData("setVar","/n8SetVar","/ns8:pwd");         

String text = pwdElement.getTextContent();         

try{   

    MessageDigest md = MessageDigest.getInstance("SHA1");       

    byte[] data = new byte[40];        

    md.update(text.getBytes("iso-8859-1"), 0, text.length());        

    data = md.digest();        

    StringBuffer buf = new StringBuffer();   

    for (int i = 0; i < data.length; i++) {        

        int halfbyte = (data[i] >>> 4) & 0x0F;        

        int two_halfs = 0;        

        do {        

            if ((0 <= halfbyte) && (halfbyte <= 9)) {        

                buf.append((char) ('0' + halfbyte));  }      

            else {        

                buf.append((char) ('a' + (halfbyte - 10))); }   

                halfbyte = data[i] & 0x0F;       

        } while (two_halfs++ < 1);  

    }  

    String result = buf.toString();

    System.out.println(result);

    setVariableData("setVar","/n8SetVar","/ns8:setPwd",result);

}catch(Exception e){

}

and i deployed successfully, but when i test it got this following error.. any ideas what happened?

faultName: {{http://docs.oasis-open.org/wsbpel/2.0/process/executable}selectionFailure} messageType: {{http://schemas.oracle.com/bpel/extension}RuntimeFaultMessage} parts: {{ summary=<summary></summary>}

<bpelFault><faultType>0</faultType><selectionFailure xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"><part name="summary"><summary></summary></part></selectionFailure></bpelFault>

XMLElement pwdElement = (XMLElement)getVariableData("setVar","/n8SetVar","/ns8:pwd");

setVariableData("setVar","/n8SetVar","/ns8:setPwd",result);

This doesn't seem correct! It should be /ns8:SetVar.

3741383

yeah i mistyped that my apologies, but i have fixed that, but still got the following error

"BPELFault" has not been caught by a catch block.

faultName: {{http://docs.oasis-open.org/wsbpel/2.0/process/executable}selectionFailure} messageType: {{http://schemas.oracle.com/bpel/extension}RuntimeFaultMessage} parts: {{ summary=<summary></summary>}

<bpelFault><faultType>0</faultType><selectionFailure xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"><part name="summary"><summary></summary></part></selectionFailure></bpelFault>

This is the error code

env:Fault xmlns:ns0="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"> <faultcode>ns0:selectionFailure</faultcode> <faultstring/> <faultactor/> <detail> <exception/> </detail> </env:Fault> oracle.j2ee.ws.client.jaxws.JRFSOAPFaultException: Client received SOAP Fault from server : null at oracle.j2ee.ws.client.jaxws.DispatchImpl.throwJAXWSSoapFaultException(DispatchImpl.java:1053) at oracle.j2ee.ws.client.jaxws.DispatchImpl.invoke(DispatchImpl.java:839) at oracle.j2ee.ws.client.jaxws.OracleDispatchImpl.synchronousInvocationWithRetry(OracleDispatchImpl.java:235) at oracle.j2ee.ws.client.jaxws.OracleDispatchImpl.invoke(OracleDispatchImpl.java:106) at oracle.sysman.emSDK.webservices.wsdlapi.dispatch.DispatchUtil.invoke(DispatchUtil.java:358) at oracle.sysman.emSDK.webservices.wsdlparser.OperationInfoImpl.invokeWithDispatch(OperationInfoImpl.java:1004) at oracle.sysman.emas.model.wsmgt.PortName.invokeOperation(PortName.java:757) at oracle.sysman.emas.model.wsmgt.WSTestModel.invokeOperation(WSTestModel.java:809) at oracle.sysman.emas.view.wsmgt.WSView.invokeOperation(WSView.java:402) at oracle.sysman.emas.view.wsmgt.WSView.invokeOperation(WSView.java:319) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.sun.el.parser.AstValue.invoke(AstValue.java:187) at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297) at org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:53) at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodBinding(UIXComponentBase.java:1491) at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:183) at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:111) at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:395) at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:115) at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:102) at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:111) at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:395) at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:115) at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:96) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756) at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:971) at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:439) at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:219) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60) at oracle.sysman.emSDK.license.LicenseFilter.doFilter(LicenseFilter.java:101) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60) at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:211) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60) at oracle.help.web.rich.OHWFilter.doFilter(Unknown Source) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60) at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:133) at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:478) at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60) at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:478) at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:303) at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:208) at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60) at oracle.sysman.emas.fwk.MASConnectionFilter.doFilter(MASConnectionFilter.java:41) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60) at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:180) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60) at oracle.sysman.eml.app.AuditServletFilter.doFilter(AuditServletFilter.java:179) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60) at oracle.sysman.eml.app.EMRepLoginFilter.doFilter(EMRepLoginFilter.java:203) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60) at oracle.sysman.core.model.targetauth.EMLangPrefFilter.doFilter(EMLangPrefFilter.java:158) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60) at oracle.sysman.core.app.perf.PerfFilter.doFilter(PerfFilter.java:141) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60) at oracle.sysman.eml.app.ContextInitFilter.doFilter(ContextInitFilter.java:542) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60) at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:138) at java.security.AccessController.doPrivileged(Native Method) at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324) at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:464) at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:121) at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:211) at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60) at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:163) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60) at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3748) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3714) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2283) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2182) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1499) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:263) at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)

Are you sure if the error is coming in this java embedding activity? Are you sure you are using the right variable structure? Can you paste a screenshot of your variable? One way to do it right is - create an assign pointing to the xpath. Go to source and use the variable name, part name and xpath from the assign statement to use it in setVariableData or getVariableData.

3741383

here is the flow

pastedImage_0.png

pastedImage_1.png

this is i want to add value to pwd, and after this i want java embedding to hash that value..

here is the variable

pastedImage_2.png

3741383

im sure it came from java embed bcs when i cut the java embed, the flow almost done into insert to database, do you need more brief explanation about the flow, code or xpath?

This seems to be an elementType variable. Try using:

XMLElement pwdElement = (XMLElement)getVariableData("setVar","/n8:SetVar/ns8:pwd");

setVariableData("setVar","/n8:SetVar/ns8:setPwd",result);

3741383

i had changed it into that, but sadly still facing the same error.. is it because of the java Exception? i tried with different variables but still facing the same prob, do you think my code is wrong?

3741383

@"Martien van den Akker" sir can you help me, please?

3741383

can you help me sir @"3168278"

Martien van den Akker
Answer

Hi,

First off: this is quite a bit of functional code you want to try to do in embedded java. I'm not so fond of that. I'd use embedded java only for small, simple calculations or logging/auditing. The thing is that you can properly test and debug your code in embedded java. Also exception-handling cannot be done very nicely and declaratively. Since you apparently have a class that works as a stand-alone class, I'd register it as a spring bean. Possibly by adding a few accompanying beans that serve as  an input and result. See for instance my article here: https://blog.darwin-it.nl/2012/09/forget-about-wsif-welcome-spring.html This way you can add this bean declaratively to your composite and wire it to your bpel. That will generate a wsdl and a partnerlink for you. So you can just invoke it. That way you can test and debug the class stand alone in JDeveloper and then only need to get your input and output variables assigned properly.

However, in your case you probably struggle with the lines

XMLElement pwdElement = (XMLElement)getVariableData("setVar","/n8SetVar","/ns8:pwd");         

String text = pwdElement.getTextContent();      

and

setVariableData("setVar","/n8SetVar","/ns8:setPwd",result);

These are fields within a complex variable, where you need to set a proper xpath and message part. Two ways to solve this

  • If you want to keep these references, create a temporary assign statement with a copy-rule that assigns a dummy string to the particular element. If you select the assign and switch to the source, you'll find the copy rule with in the to-part the specific reference to the variable-part-element. Use that information to correct the getVariableData() and setVariableData() statements. Then remove the dummy assign. The error you posted noted '<faultcode>ns0:selectionFailure</faultcode>' which refers to one of these statements. Probably the first one. But I can't see in the stacktrace which line is meant (since the embedded java is compiled into a class during compilation of the bpel).
  • Much easier is to declare two xsd:string based variables to hold the password and store the result. Then first assign the value of the setVar variable to the variable 'password'. Then you just can refer to it with getVariableData('password'). No xpath needed. Then the setVariableData() becomes setVariableData('result'). I believe you don't need to convert the XMLElement to string. I have in one of my earlier projects a simple embedded sub-process that does logging like:

<bpelx:inlineSubProcess name="SubProcessAddAuditTrailEntry">

    <variables>

      <variable name="logMessage" type="xsd:string"/>

    </variables>

    <sequence name="SequenceAddAuditTrailEntry">

      <extensionActivity>

        <bpelx:exec name="addAuditTrailEntry">

          <![CDATA[final String bpelName = "HREmployeeEventToITProcess.bpel"; 

String logMessage = (String) getVariableData("logMessage"); 

addAuditTrailEntry(bpelName+": "+logMessage);]]>

        </bpelx:exec>

      </extensionActivity>

    </sequence>

  </bpelx:inlineSubProcess>

You see here that I have a logMessage Variable based on xsd:string. I can just refer to it as String logMessage = (String) getVariableData("logMessage");  If I translate this to your situation I would probably get something like:

<scope name="hashAPassword">

    <variables>

      <variable name="password" type="xsd:string"/>

      <variable name="result" type="xsd:string"/>

    </variables>

    <sequence name="SequenceHashAPassword">

      <extensionActivity>

        <bpelx:exec name="addAuditTrailEntry">

          <![CDATA[

String text = (String) getVariableData("password"); 

try{   

    MessageDigest md = MessageDigest.getInstance("SHA1");       

    byte[] data = new byte[40];        

    md.update(text.getBytes("iso-8859-1"), 0, text.length());        

    data = md.digest();        

    StringBuffer buf = new StringBuffer();   

    for (int i = 0; i < data.length; i++) {        

        int halfbyte = (data[i] >>> 4) & 0x0F;        

        int two_halfs = 0;        

        do {        

            if ((0 <= halfbyte) && (halfbyte <= 9)) {        

                buf.append((char) ('0' + halfbyte));  }      

            else {        

                buf.append((char) ('a' + (halfbyte - 10))); }   

                halfbyte = data[i] & 0x0F;       

        } while (two_halfs++ < 1);  

    }  

    String result = buf.toString();

    System.out.println(result);

    setVariableData("result");

}catch(Exception e){

}

]]>

        </bpelx:exec>

      </extensionActivity>

    </sequence>

  </scope>

Add this to your BPEL. Then right click on the scope to transform it to an embedded subprocess and you can call it based on the originating message variables.

Regards,

Martien

PS1: I just got back from vacation this week, so I have a pile of messages to follow-up on

PS2: I did not test this, I rely on the proper functioning on your code and copy and pasted it in my example to refactor it.

Marked as Answer by 3741383 · Sep 27 2020
1 - 14

Post Details

Added on May 4 2020
6 comments
640 views