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!!!!!!!
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!!!!!!!