In this exercise we will use custom document to exchange data between two partners.
We will also create a response document and cor relate with the input. We will use B2B listening channel to read the file.
In later exercise we will see how we can do the same from BPEL. That is reading data from BPEL and passing it to B2B.
Login to the b2b console
http://<host>:<soa_server port>/b2bconsole
you will get following screen
Edit the name to Host and then add a partnerlink and name it as Partner (give any logical name)
Define the channel for both host and partner.
Make it a file channel and point it to some local directory in your machine.
Create a host channel and point it to local directory "C:\Users\Token\Desktop\DemoB2B\Receive"
Create a channel for partner also in the similar way
Next is create a document deifinition.
for that go to administration-->Document-->Custom-->Add
Create two document for request and response.
PORequest will have following schema
<?xml version= '1.0' encoding= 'UTF-8' ?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://xmlns.oracle.com/purchase/order"
xmlns:xsd="http://xmlns.oracle.com/purchase/order"
elementFormDefault="qualified">
<element name="PORequest" type="xsd:PORequestType"/>
<complexType name="PORequestType">
<sequence>
<element name="OrderNumber" type="string" minOccurs="1"/>
<element name="ProductName" type="string" minOccurs="0"/>
<element name="ProductDescription" type="string" minOccurs="0"/>
</sequence>
</complexType>
</schema>
POResponse will have following schema
<?xml version= '1.0' encoding= 'UTF-8' ?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://xmlns.oracle.com/purchase/order"
xmlns:xsd="http://xmlns.oracle.com/purchase/order"
elementFormDefault="qualified">
<element name="POResponse" type="xsd:POResponseType"/>
<complexType name="POResponseType">
<sequence>
<element name="OrderNumber" type="string" minOccurs="1"/>
<element name="status" type="string" minOccurs="0"/>
</sequence>
</complexType>
</schema>
You can see that OrderNumber is a common element in both the schema and this will act as a correlation point between the request and response.
The assumption is that OrderNumber will be unique for the Purchase Order
Now create document definition structure as showm below
Go to POREquestDef and add the schema file to it as shown below
Similarly for response message
The XPath to identify the request and response is as shown below
//*[local-name()='PORequest']
//*[local-name()='POResponse']
Now next thing is to correlate the request and response --this can be done by co-relating the common parameter in both the schema and that is OrderNumber.
go back to your Request definition go to your cor relation tab and add
XPath to get the order number
//*[local-name()='OrderNumber']
Similarly go to the response message and add the corelation to XPath
Next add the document to the partner.
Go to your partner-->document tab and add the two document you have created,Make sure that you have selected both sender and receiver capability for the two document.
Next is create an agreement between the two partner link to exchange data.
Select your Partner and create an agreement.
Give some name to the agreement and click on the + icon to add a document.
Select the poRequest document from host to Partner as shown in the diagram
now say ok and then select the channel that you have created as shown below.Save all the changes and deploy your agreement
Next is create another agreement give it some logical name and select the response document from partner to host this time as shown
Say ok -->Select the channel and again save the agreement.
Just check the two agreement i have not yet deployed the new agreement i have create hence it is still in edit mode.
As soon as you will deploy the agreement it will appear in document mode as the previous agreement looks like.
Save all the changes and deploy this agreement.
Next step is to create a listening channel where b2b can listen and read the document.
We will create two listening channel
One will be internal listening channel which host trading partner will use for processing document
and one external listening channel which our partner will use to process the document.
This we are doing as we wanted to simulate a scenario where in we are cor relating the request and response.
working with any standard document the collaboration id itself takes care of the co-relation between request and response.
If you are using a BPEL then using the Message ID in BPEL you can co relate with the MDN ID of the response to co relate the request and response.
We will check out the implementation using BPEL in later exercise.
So first we will create a internal listening channel for host to read data.
Go to Administration-->Listening Channel
and add a listening channel
Select generic file as protocol and specify the folder location which you wanted to poll.
Lets make this an internal channel so that host can use it to read the data
Go to the channel attributes and select internal as shown
Save the changes.
Add one more listening channel for partner.
Now we are done with all the configuration and we can go ahead and test it.
Create two XML document from the schema that we have used.
request xml document is
<?xml version="1.0" encoding="UTF-8" ?>
<PORequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.oracle.com/purchase/order PORequest.xsd"
xmlns="http://xmlns.oracle.com/purchase/order">
<OrderNumber>123</OrderNumber>
<ProductName>Moto-G</ProductName>
<ProductDescription>Mobile</ProductDescription>
</PORequest>
and response xml document is
<?xml version="1.0" encoding="UTF-8" ?>
<POResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.oracle.com/purchase/order PORequest.xsd"
xmlns="http://xmlns.oracle.com/purchase/order">
<OrderNumber>123</OrderNumber>
<status>Approved</status>
</POResponse>
Copy the request document to the folder location where internal channel is listening.
Once it is processed copy the response xml to the location where external channel is listening.
Now in order to name the xml file there is a pattern which must be followed
The same can be found in the following dooument
http://www.oracle.com/technetwork/middleware/b2b-integrations/learnmore/tnb2b11g002-326857.pdf
For the internal listening channel
the pattern is %TO_PARTY%_%DOCTYPE_NAME%_%DOCTYPE_REVISION%_%MSG_TYPE%_%MSG_ID%.xml
So my input will be Partner_PORequest_0.1_1_1234.xml
Similarly for external listening channel the format is
%FROM_PARTY%_*.xml
So my file name is
Partner_1234.xml
As soon as you will copy the request doc to the internal listening channel directory the file will be picked and it will be written to the channel of your partner..
Once request is complete. Put the response document in the directory where external listening channel is polling . The data will be picked and it will be written to the directory defined in the host channel.
you can go to report to validate the request and response message
you can see from host to partner the request document is going and
from partner to host a response document is coming.
Now go to the report of request
You will find the corelation id
Similarly if you will go to response you will get the co relation id in to XPath section.
It is missing in my case as i believe i might have done some wrong configuration.
This same configuration is working fine in SOA 11.1.1.3 so unless there is some other issue with 11.1.1.7 this should work fine.
This is how you can relate a request and a response
you can also go to conversation tab and see the collaboration id which co relate the request and the response message.
18 comments:
Hi Mikku,
Thanks for sharing! I was able to get the PORequest message to work, however, the response just sits as "processing" in the Wire Message. Help.
Could you please elaborate more on this issue? Is the file getting written in to the output directory? What error log says on this/
Hi Mikku
I am new to b2b .. followed each step ..I am ending up with application message either than business message
need some help
Can you explain the issue in details. I didn't actually get what is the issue you are facing? Let me know the version of SOA you are using and where are you facing the issue?
Sorry, but I will not be able to.
Hi Mikku
I have similar requirement to receive XML AP invoice. I have xml file, can you help me how to convert that xml file to xsd to use in B2B?
Thanks
Hi Mikku
Nice post, I have similar requirement to receive AP Invoice XML file to process, can you help me how to convert .xml file into xsd to use in B2B?
Thanks!
Hi Mikku
I have similar requirement, I have AP Invoice XML file, can you help me how to convert it into xsd to use in B2B?
Thanks!
Hi Lokesh,
Using Jdeveloper you can easily created it.
Go to Jdeveloper
Create New -->Select XML in the left hand pane
and choose XML Schema from XML document.
It will allow you to select the xml document.
Select you xml document, keep saying next and finish the wizard.
Once it is finished the xml schema will be created for you.
Thanks! It worked!!
Can we have an post having demo of accepting Invoice files from Suppliers which was integrated to Oracle EBS XML Gateway? I just want to know the relationships between xml file we receive with xsd and the dtd file as we are planning to implement this and i am finding issue as I am new to B2B and XML Gateway
Again Thanks!
Lokesh,
DTD is now an obsolote technology.
Using Jdeveloper you can create a Schema file for any XML document so my suggestion will be to use Schema and follow the steps in the document for the flow.
You can also convert DTD to Schema and use the same as a starting point.
EBS XML gateway provides the data in XML and Schema
Thanks! you said follow the steps in the document, what document you are referring?
I did converted the xml document into schema file using JDev and added that xsd in B2B...
Can you guide me how to create DTD using my Schema/XML file because I need that dtd file to create a mapping file to use in EBS XML Gateway.
there are a lot of online tools you can use for the same.
or you can use software such as altova,xml spy
Hi Mikku,
Thanks for this nice example. On the response journey, though the transaction is getting successfully completed, the response file is not getting saved to the location as configured on the host channel.
Can you advise please.
Thanks.
Are you getting error/exception in the logs? With this configuration i was able to get the response.
I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in Oracle B2B.kindly contact us http://www.maxmunus.com/contact
MaxMunus Offer World Class Virtual Instructor led training on Oracle B2B. We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
For Free Demo Contact us:
Name : Arunkumar U
Email : arun@maxmunus.com
Skype id: training_maxmunus
Contact No.-+91-9738507310
Company Website –http://www.maxmunus.com
Can I simply say what a comfort to find somebody that actually understands what they're discussing over the internet.
You certainly know how to bring a problem to light and make it important.
More and more people must check this out and understand this side
of the story. I was surprised that you aren't more popular given that you most
certainly have the gift.
Post a Comment