Showing posts with label 11g. Show all posts
Showing posts with label 11g. Show all posts

Sunday, March 22, 2015

Converting SAP IDoc XML date and time to structured XML Schema xsd:dateTime data type

In a recent project, we worked with the Oracle Application Adapter for SAP R/3 in order to retrieve data from and publish data to the customers SAP system. Did you ever have a look at an XML-based intermediate document (IDoc) from SAP? Well, good news is that you get structured data. Each IDoc type comes with a schema definition as XML Schema Definition (XSD) which can be retrieved from the SAP system using Oracle Application Explorer. Bad news is that absolutly everything is stored as xsd:string. No matter the content of the element, if it's some numeric values, text, date or time values ... the values are stored as string. SAP doesn't make use of the more appropriate default datatypes or the XML Schema Definition.
However, other sources do. So if you want to use for example the header data of an XML IDoc DC40 fragment to call a web service, you need to transform the string based date value CREDAT and the string based time value CRETIM to the more appropriate xsd:dateTime.

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            targetNamespace="urn:sap-com:document:sap:idoc"
            xmlns="urn:sap-com:document:sap:idoc"
            elementFormDefault="qualified">
   <xsd:element name="IDOCTYPEOFYOURCHOICE">
      <xsd:complexType>
         <xsd:sequence>
            <xsd:element name="IDOC" maxOccurs="unbounded" minOccurs="0">
               <xsd:complexType>
                  <xsd:sequence>
                     <xsd:element name="EDI_DC40">
                        <xsd:complexType>
                           <xsd:sequence>
                              ...
                              <xsd:element name="CREDAT" minOccurs="0">
                                 <xsd:simpleType>
                                    <xsd:restriction base="xsd:string">
                                       <xsd:maxLength value="8"/>
                                    </xsd:restriction>
                                 </xsd:simpleType>
                              </xsd:element>
                              <xsd:element name="CRETIM" minOccurs="0">
                                 <xsd:simpleType>
                                    <xsd:restriction base="xsd:string">
                                       <xsd:maxLength value="6"/>
                                    </xsd:restriction>
                                 </xsd:simpleType>
                              </xsd:element>
                              ...
                           </xsd:sequence>
                           ...
                        </xsd:complexType>
                     </xsd:element>
                     ...
                  </xsd:sequence>
                  ...
               </xsd:complexType>
            </xsd:element>
         </xsd:sequence>
         ...
      </xsd:complexType>
   </xsd:element>
</xsd:schema>


You can achieve this by assigning string data in the correct pattern to an xsd:dateTime element. This is possible since xsd:dateTime is accepting string inputs. However, the pattern of xsd:dateTime has to be respected. For our example, it is enough to target the pattern "yyyy-mm-ddThh:mm:ss" without the optional milliseconds and time zone parameters. Check out detailed information in XML Schema Definition Part 2 Datatypes.

The little POC for this is based on a synchronous BPEL process waiting for input data similar to XML IDoc data. An XSL Transformation is used to transform the string-based input data to xsd:dateTime data. Additionally, the XSL engine will add a generated xsd:dateTime value of the runtime environment. The following figure shows the BPEL process.

BPEL process GenerateTime
The service component architecture diagram is as simple as that, showing the exposed service endpoint and the BPEL process.

SCA composite overview of the POC
The input data to the request contains two elements date and time. Both of them are simple types based on xsd:string and restricted in length of 8 respectively 6 characters to represent a date of patter "yyyymmdd" and time of pattern "hhmmss".

XML Schema definition of the POC
The response data on the other hand contains two xsd:dateTime elements. One of them will be the target of the XSL transformation while the other one will hold engine generated data.

The following screenshot is taken from the XSLT editor in JDeveloper with SOA extension.

XSL Transformation is XSLT editor
We are using substrings to extract the year, month and day fragments from the input string date. The same way, we are extracting the hour, minute and second fragments from the input time value. Afterwards, we are concatinating all fragments including the required separators to the desired pattern of the xsd:dateTime based value ns1:customDateTime. Please find below the source code.

  <xsl:template match="/">
    <ns1:response>
      <ns1:customDateTime>
        <xsl:value-of select="concat(

          substring(/ns1:request/ns1:date,1.0,4.0),'-',
          substring(/ns1:request/ns1:date,5.0,2.0),'-',
          substring(/ns1:request/ns1:date,7.0,2.0),'T',
          substring(/ns1:request/ns1:time,1.0,2.0),':',
          substring(/ns1:request/ns1:time,3.0,2.0),':',
          substring(/ns1:request/ns1:time,5.0,2.0))"/>
      </ns1:customDateTime>
      <ns1:generatedDateTime>
        <xsl:value-of select="xp20:current-dateTime()"/>
      </ns1:generatedDateTime>
    </ns1:response>
  </xsl:template>



Now let's test the process (and XSL transformation) from Enterprise Manager, providing some sample data ...

Input data for testing
... and we are successfully receiving the transformed data as response:

Output data of the test
Notice that our transformed xsd:dateTime value only comes with the precision of the provided input data while the generated timestamp comes with the complete, detailed xsd:dateTime pattern including the optional parameters of milliseconds and time zone.

Here you can download the complete POC.

Friday, April 25, 2014

Upgrade your Oracle BPM Studio 11g (11.1.1.7)

Just in case some of you might have missed this: When Oracle BPM 11g's MLR3 came out (finally providing a basic OOTB UI for Case Management included in the Business Process Workspace application), also Oracle BPM Studio 11g (hence: Oracle JDeveloper with the extensions SOA Composite Editor and BPMN Editor) got an update:

  • SOA Composite Editor: 11.1.1.7.0.00.08 11.1.1.7.0.00.97
  • BPMN Editor: 11.1.1.7.0.0.8 11.1.1.7.0.0.97
For example, this upgrade includes components to work with Case Management UI, e.g. to generate case data.

Just upgrade your JDeveloper with the integrated update functionality Help > Check for updates ... and reduce the selection in step 3 to Shop upgrades only.

You cannot upgrade both extensions the same time (unless JDeveloper won't warn you on that). Make sure to first upgrade the SOA extension. (Otherwise, when first upgrading BPM, you won't be able to apply the SOA update afterwards.)

You can also download the extension sources first and upgrade the extensions with the integrated functionality Help > Check for updates ... and the Install from local file in step 2.

Tuesday, April 8, 2014

OPatch'ing Pre-built Virtual Machine for SOA Suite and BPM Suite 11g

In March 2014, Oracle released an updated version of its Pre-built Virtual Machine for SOA Suite and BPM Suite 11g for Patchset 6 (11.1.1.7). The bundle patch 17014142 for Oracle BPM 11.1.1.7.1 is already installed. However, most of you will like to upgrade to bundle patch 17584181 directly (11.1.1.7.2). By using the installed version of OPatch in /oracle/fmwhome/Oracle_SOA1/OPatch directory, you will run into an opatch error 70:

[ Error during Patch conflict resolution for apply patch phase ] Detail: OUI-67073:OPatch failed: ApplySession failed in system modification phase... 'Current access level does not allow writing to the inventory'
OPatch will attempt to restore the system...


The reason is that the OPatch version installed in /oracle/fmwhome/Oracle_SOA1/OPatch is 11.2.0.3.5. However, for any opatch application on Oracle Fusion Middleware 11.1.x, the most recent version of OPatch 11.1.x is recommended (at the time of writing OPatch version 11.1.0.10.3).

  1. Download most recent version of OPatch 11.1.x
  2. Copy it to /oracle/fmwhome/Oracle_SOA1/OPatch_11.1.0.10.3
  3. Apply opatch by using absolute path:
    $ sh /oracle/fmwhome/Oracle_SOA1/OPatch_11.1.0.10.3/opatch apply
 OPatch will then work correctly.

Friday, February 7, 2014

Test Case Initialization with Web Service end point

The Oracle Adaptive Case Management Demo for HelloWorld introduces how to test a Case Management application by invoking a web service end point. This web service on the other hand will initiate a case instance.
Oracle promotes to invoke this web service using the test end point available at http://<your-server>:<your-port>/soa-infra/ This cause a little bit of frustration to me since this end point did not show the web service payload attributes unless I knew I implemented them.

Checking forth and back, reimplementing the web service again and again, I finally had the idea to check in Enterprise Manager ... and voila: everything there!

I don't really know why the test end point at soa-infra doesn't do the job any more or even if others faced the problem. But if ever, you run into it, you'll at least have a workaround by now.

Thursday, January 30, 2014

JBO-29114 / JBO-25004 with Oracle BPM 11g - Workspace does not load UI for Human Task

A while back, I struggled with the UI of a POC not coming up in Oracle Business Process Workspace. The following has been tested with Oracle BPM 11.1.1.7.0 / 11.1.1.7.2 but may be the same for other releases. To spoil a bit: It's a system fault and once understood, no big deal. However, I passed some time on that since all related sources I found (e.g. on OTN Forums) didn't not exactly cover this context with BPM involved.

Checking the stack trace, I found the following:

Root cause of ServletException.
oracle.jbo.InvalidDefNameException: JBO-29114 ADFContext is not setup to process messages for this exception. Use the exception stack trace and error code to investigate the root cause of this exception. Root cause error code is JBO-25004. Error message parameters are {0=Package, 1=poc-bpm-002_ui.DataBindings}
    at oracle.jbo.mom.DefinitionManager.loadProjectDefinition(DefinitionManager.java:1801)
    at oracle.jbo.uicli.mom.JUMetaObjectManager.findCpx(JUMetaObjectManager.java:667)
    at oracle.jbo.uicli.mom.JUMetaObjectManager.loadCpx(JUMetaObjectManager.java:748)
    at oracle.adf.model.BindingContext.initialize(BindingContext.java:402)
    at oracle.adf.model.BindingRequestHandler.beginRequest(BindingRequestHandler.java:238)
    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:203)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.share.http.ServletADFFilter.doFilter(ServletADFFilter.java:71)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:128)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
    at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.bpel.services.workflow.client.worklist.util.WorkflowFilter.doFilter(WorkflowFilter.java:175)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.bpel.services.workflow.client.worklist.util.DisableUrlSessionFilter.doFilter(DisableUrlSessionFilter.java:70)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:180)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
    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:460)
    at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
    at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:163)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3730)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)
    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:2273)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)


JBO-29114 doesn't say much and JBO-25004 pointing us to the involved package (poc-bpm-002_ui in my case) only helps when we understand where it comes from. Actually, this package for the DataBindings will be generated by Oracle BPM Studio 11.1.1.7 if you auto-generate the Task Form for a Human Task component. On generation, the package name is taken from the ADF project name you are choosing for the UI project. Unless ADF Naming Conventions (v2.00) do not impose any restrictions on ADF project names, this generation procedure requires that you do not use the minus sign "-" in the ADF UI project name. However, the underscore doesn't impose any problems.

Summery: No minus sign in ADF UI project names if you use Oracle BPM Studio 11g auto-generation of Task Flows!