Monday, 29 December 2014

XSLT-SOME GUIDE

<xsl:apply-template> tag signals the XSLT processor to find the appropriate template to apply, based on the type and context of each selected node.

Following is the example of xslt template :

<xsl:apply-template
   select = Expression
   mode = QName
</xsl:apply-template>
 
 
 
select--> used to process nodes selected by an XPath expression, instead of processing all children
mode--> Allows an element as specified by its Qualified Names to be processed multiple times, each time producing a different result



Simple Example  1 :

Consider this xml :
 <?xml version="1.0"?><?xml-stylesheet type="text/xsl"?><hello-world><greeter>An XSLT Programmer</greeter><greeter1>An XSLT Programmers</greeter1><greeting>Hello, World!</greeting> </hello-world>

XSLT :

<?xml version="1.0"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:template match="/"><xsl:apply-templates select="hello-world/greeter"/></xsl:template><xsl:template match="hello-world/greeter"><xsl:value-of select="." /></xsl:template></xsl:stylesheet>

OUTPUT :

<?xml version="1.0" encoding="UTF-8"?>An XSLT Programmer

Here apply templates calls : template match which in turns displays the value.




good link:


http://www.informit.com/library/content.aspx?b=STY_XML_21days&seqNum=109



Saturday, 6 September 2014

Cannot Find Portype in Wsdl Manager

Solution :


1>Go to bpel process.

2>Check for bpelprocess.componenttype file in your project


3>Remove the unnecessary service component whose reference partner link/wsdl  has been removed earlier,for example I have deleted the below service  which was removed:

 <service name="http_1" ui:wsdlLocation="http_1.wsdl">
    <interface.wsdl interface="http://xmlns.oracle.com/pcbpel/adapter/http/Application1/syntest/http_1#wsdl.interface(Request_Response_ptt)"/>
  </service>


4>Compile and run your code

Xml Parsing Failed Because =

Many times when we compile our bpel code we tend to find this error which is very hard to identify.On click "go to source" it shoots straight to top to bpel xml file without exact notification.


Please look into below steps for resolution of this issue:


1>This error might be because of duplicate wsdl file.

2>This error might be because of duplicate xsd file.


3> This error might be because of  change in wsdl file.Delete old variable and create new input/output variable to refer  new/changed wsdl.

4>Check in your client and target endpoints.Your operation might have got removed.

5>Save your bpel code.Save close it.Then try to recompile it.


Hope this helps.I will post  as I discover more.Happy Programming!!!!




Sunday, 31 August 2014

How to Develop And Test a Simple Synchronous OSB Service

Go To Oracle Service Bus Console and create the below folder structure  under project Testservicesync:






XSD-This folder will include all the xsds we need in this proj.Create a new xsd name :"Helloworld " and paste below lines of code :

<?xml version='1.0' encoding='UTF-8'?>
<schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://xmlns.oracle.com/SchedulingApplication/HelloWorld/HelloWorld" xmlns="http://www.w3.org/2001/XMLSchema">
   <element name="process">
      <complexType>
         <sequence>
            <element name="input" type="string"/>
         </sequence>
      </complexType>
   </element>
   <element name="processResponse">
      <complexType>
         <sequence>
            <element name="result" type="string"/>
         </sequence>
      </complexType>
   </element>
</schema>

Screenshot of Helloworld xsd:



WSDL :Next we need to create a wsdl service.In this project we have two wsdl files one for calling external service and 2nd to be used by incoming proxy service.

Copy and paste the below lines of code to create two new wsdls.

Helloworld.wsdl :

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="HelloWorld" targetNamespace="http://xmlns.oracle.com/SchedulingApplication/HelloWorld/HelloWorld" xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/" xmlns:client="http://xmlns.oracle.com/SchedulingApplication/HelloWorld/HelloWorld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
   
    <plnk:partnerLinkType name="HelloWorld">
        <plnk:role name="HelloWorldProvider">
            <plnk:portType name="client:HelloWorld"/>
        </plnk:role>
    </plnk:partnerLinkType>
    <wsdl:types>
        <schema xmlns="http://www.w3.org/2001/XMLSchema">
            <import namespace="http://xmlns.oracle.com/SchedulingApplication/HelloWorld/HelloWorld" schemaLocation="../xsd/HelloWorld.xsd"/>
        </schema>
    </wsdl:types>
    <wsdl:message name="HelloWorldRequestMessage">
        <wsdl:part name="payload" element="client:process"/>
    </wsdl:message>
    <wsdl:message name="HelloWorldResponseMessage">
        <wsdl:part name="payload" element="client:processResponse"/>
    </wsdl:message>
    <wsdl:portType name="HelloWorld">
        <wsdl:operation name="process">
            <wsdl:input message="client:HelloWorldRequestMessage"/>
            <wsdl:output message="client:HelloWorldResponseMessage"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="HelloWorldBinding" type="client:HelloWorld">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="process">
            <soap:operation style="document" soapAction="process"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="helloworld_client_ep">
        <wsdl:port name="HelloWorld_pt" binding="client:HelloWorldBinding">
            <soap:address location="http://localhost:8050/soa-infra/services/default/HelloWorld/helloworld_client_ep"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

NewWSDLile :(this to be used by our proxy service):

 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.example.org/NewWSDLFile/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="NewWSDLFile" targetNamespace="http://www.example.org/NewWSDLFile/">
  <wsdl:types>
    <xsd:schema targetNamespace="http://www.example.org/NewWSDLFile/">
      <xsd:element name="NewOperation">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="in" type="xsd:string"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="NewOperationResponse">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="out" type="xsd:string"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
    </xsd:schema>
  </wsdl:types>
  <wsdl:message name="NewOperationRequest">
    <wsdl:part element="tns:NewOperation" name="parameters"/>
  </wsdl:message>
  <wsdl:message name="NewOperationResponse">
    <wsdl:part element="tns:NewOperationResponse" name="parameters"/>
  </wsdl:message>
  <wsdl:portType name="NewWSDLFile">
    <wsdl:operation name="NewOperation">
      <wsdl:input message="tns:NewOperationRequest"/>
      <wsdl:output message="tns:NewOperationResponse"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="NewWSDLFileSOAP" type="tns:NewWSDLFile">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="NewOperation">
      <soap:operation soapAction="http://www.example.org/NewWSDLFile/NewOperation"/>
      <wsdl:input>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="NewWSDLFile">
    <wsdl:port binding="tns:NewWSDLFileSOAP" name="NewWSDLFileSOAP">
      <soap:address location="http://www.example.org/"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

Now our wsdl file will look like this under folder wsdl:


 Business Service :

Next we need to create a business service.Create a new bsuiness service and point that business service to link helloworld.wsdl.as shown below :

Just select two steps as shown below .Remaining keep as it is ->Next->Next to finish it off.







 Note : In my case i have created a sample service named Helloworld in bpel,soa and used that wsdl over here .

Proxy Service :

We are done with business service.Now create a new proxy service and use  above :newwsdl file to consume from it.




Remaining step keep default one only.


Now select proxy service and we need to edit the flow.Add a pipeline pair,then stage activity and your complete design looks like this :



Click on stage 1 to write below lines of code :

 

Click on link under Assign to have below lines of code :



XQuery : This is mapping file which transforms the source value to target one.Create a new xquery file and in source choose newwsdl.file as input and in target choose helloworld.xsd as output.Map the contents and save it.Use this xquery file  to select while assigning values in step above.

Finally Xquery file looks like this(you can copy and paste to generate) :

(:: pragma bea:global-element-parameter parameter="$newOperation1" element="ns0:NewOperation" location="../wsdl/NewWSDLFile.wsdl" ::)
(:: pragma bea:global-element-return element="ns1:process" location="../xsd/HelloWorld.xsd" ::)

declare namespace ns1 = "http://xmlns.oracle.com/SchedulingApplication/HelloWorld/HelloWorld";
declare namespace ns0 = "http://www.example.org/NewWSDLFile/";
declare namespace xf = "http://tempuri.org/testservicesync/xquery/req_resp/";

declare function xf:req_resp($newOperation1 as element(ns0:NewOperation))
    as element(ns1:process) {
        <ns1:process>
            <ns1:input>{ data($newOperation1/in) }</ns1:input>
        </ns1:process>
};

declare variable $newOperation1 as element(ns0:NewOperation) external;

xf:req_resp($newOperation1)




 Go back click on stage1 icon under response and paste below lines of code :





W are done.Now we need to test our services.

Go to proxy service and hit test button as shown below :




Click execute to see response :







 Go down and select Invocation Trace to understand the flow :



Ha


 Happy Programming!!!!!!!