using wcf-sql adapter - biztalk

I need to poll the data in xml format and map it to the EDI 834.........
I have written the stored procedure using for xml auto,element
when i consume it using add adapter metadata i am getting a xml message....
but i need to use this xml message to map it to the EDI834 ....How to get the structure of xml so that i can use that in map....
I also followed http://social.msdn.microsoft.com/Forums/en-US/biztalkgeneral/thread/6a7e0093-0692-4ba5-9e14-0d2090c2cf54
this thread and generated the schems using xml polling and mapped that to EDI834.
But when i use the map into outbound map...It doesnt map the polling data to edi 834..

The WCF-SQL adapter removes the need to use the 'for xml auto, elements' syntax. This is a legacy leftover from the old Sql Adapter.
Just write your stored procedure in a manner to return a consistent result set, then generate metadata against the stored procedure. The adapter framework will create an appropriate schema based on the metadata returned from your stored procedure.
Then simply map the data from your WCF-SQL schema to your EDI834 schema.

Create the stored procedure that returns xml (or xml part) by using the FOR XML PATH syntax
-Setup a receive location using WCF-SQL. Select XmlPolling. Choose a rootname and namespace for the adapter to wrap around the xml returned from SQL (mandatory).
-Set Polling Statement to: exec [SPNAME]
-Set PollDataAvailableStatement to something appropriate that will return a count > 0 if there are rows/xml to be polled.
-Use passthrureceive pipeline for the receive-location
-Set up a send port (FILE) that subscribes to everything that comes from the receiveport used for the receivelocation.
-Start the application. Examine the XML returned from the adapter.
-In VS generate a schema using well-formed XML (Add->Add generated Items->Generate Schemas) (NOTE: You may have to run the InstallWFX.vbs found under the BizTalk SDK/Utilities/Schema generator, if you have not already done this earlier on the machine).
-Choose the xml file generated by the adapter (give the file a name representing the schema you are trying to create).
-Now you should have a schema representing the xml returned by the adapter, you may have to go through the schema manually and change data types to something more appropriate than what the wizard has chosen.

Related

BizTalk pipeline custom component disassemble with no document schema

I am going to parse and format the flat file input based on the business logic stored in SQL server database tables. I don’t have a document schema for the input. I wrote a C# custom component class for the disassemble. When I use the custom component in Disassemble stage in receive pipeline, I am getting document schema not found error.
Did anyone come across with same situation and handled it differently? .
BizTalk routes messages using the 'MessageType' property (The namespace + the root node name of the XML in the message) in the context portion of the message. You don't have that with your design so it doesn't know what to do with it.
You can:
handle each type of flat file separately by parsing and assigning a unique message type
distill the content into one type of message
wrap the content of the file in an 'envelope'
You'll need to create a schema for any of those choices.
Namespaces and routing are a spiffy way to handle changes to file structure. If you include the version of the file in the namespace BizTalk can route the message to the code that handles that kind of message for you. You can continue to handle old style messages as well as new formats. We handle pilot programs that way.

How to retrieve the source code of an XQuery module stored in eXist-db?

I am looking for a way how to retrieve the source code of an XQuery module stored in the database.
Is there any way how to do this using eXist-db's REST API or an XQuery extension function or any other eXist-db interface?
If you are using the REST Server, you have two main options:
Do a GET on the XQuery stored in the db, with the query string parameter _source=yes. You need to change some settings in $EXIST_HOME/descriptor.xml to enable that.
Write a query for retrieving queries. A query stored in the database is like any other binary document, so you could use util:binary-doc() to get it.

Biztalk 2013r2 wcf-sql adapter composite operation

I am trying to use the wcf-sql adapter to call a stored procedure multiple times with different parameters. I have created the original schema using the wizard and then created the composite schema by hand. I understand what the error is telling me I just do not understand why I am getting the error and/or how to resolve it.
Error: Microsoft.ServiceModel.Channels.Common.MetadataException:
Object [dbo].[DEPT_NUM] of type StoredProcedure does not exist. The
message that is suspended in Biztalk looks like this...
<ns0:DINV_sumDepartmentInventory xmlns:ns0="http://schemas.microsoft.com/Sql/2008/05/TypedProcedures/dbo"><ns0:DEPT_NUM> 4</ns0:DEPT_NUM><ns0:INV_DATE>2016-03-21T00:00:00</ns0:INV_DATE><ns0:USERNAME>Service</ns0:USERNAME></ns0:DINV_sumDepartmentInventory>
This is the portion of the orchestration...
This is the map that is associated with the "transform_3" shape...
This is what the composite schema looks like...
I am expecting the output to more like this...
<ns1:Request xmlns:ns1="http://BigY.PICSInventory.Updated_SQL_Schemas.Composite_SumDepartmentInventory" xmlns:ns0="http://schemas.microsoft.com/Sql/2008/05/TypedProcedures/dbo"><ns0:DINV_sumDepartmentInventory><ns0:DEPT_NUM>4</ns0:DEPT_NUM><ns0:INV_DATE>2016-03-21T00:00:00</ns0:INV_DATE><ns0:USERNAME>Service</ns0:USERNAME></ns0:DINV_sumDepartmentInventory></ns1:Request>
Any ideas what is wrong with the setup or what else I can try?
It looks like the Composite Operation is not composed correctly. It has to be a very specific structure with certain namespaces and Operation.
This Wiki Article explains the process step by step: BizTalk Server: Streamlining WCF SQL and Oracle Messaging-Only and Other Patterns

BizTalk 2013 - execute stored procedure on send port without orchestration?

A while back I set up BizTalk to pick up a file via FTP and drop it into a network directory. It's all passsthru so I didn't use an orchestration.
Now I've been asked to execute a stored procedure once the file is picked up. The procedure contains no parameters and I do not need the contents of the file.
It seems like such a simple request but I can't figure it out. Is there any way to do this without over complicating things?
This can be accomplished through the use of either the WCF-SQL adapter or the WCF_Custom adapter with a SQL binding. You can do this using messaging only with just a SendPort with a filter/map on it thus no orchestration needed.
For the SOAP action header use TypedProcedure/dbo/name_of_your_stored_procedure and in the messages tab you can specify the paramters to the stored procuders as well as add a payload in the following manner:
<name_of_your_stored_procedure xmlns="http://schemas.microsoft.com/Sql/2008/05/TypedProcedures/dbo">
<parameter1>XXXX</parameter1>
<xml_parameter>
<bts-msg-body xmlns="http://www.microsoft.com/schemas/bts2007" encoding="string"/>
</xml_parameter>
</name_of_your_stored_procedure>
In the above case xml_parameter will have the contents of the message payload passed to it.
The stored procedure should look something like :
CREATE PROCEDURE [dbo].[name_of_your_stored_procedure]
#parameter1 int,
#xml_parameter nvarchar(max)
AS
BEGIN
-- your code goes here
END
More details can be found here
Regards Hasse
This MSDN page describes the process and has this to say: "You must create a BizTalk orchestration to use BizTalk Server for performing an operation on SQL Server."
However if you're really desperate not to use an orchestration I believe you have the option of setting the operation context property in a custom pipeline component. Then you can initialise the message in a map on a port. In theory this should work but I can't guarantee it.

Text file output from Biztalk?

I have a mapping in Biztalk from an external XML schema to an internal XML schema. The internal schema I wish to map to a flat file schema. But that doesent seems to be possible. I cant select the flat file schema as destination schema. So I guess I need to use a flat file assembler in a send pipeline? But on properties on the flat file assembler the flat file schema is not visible under Document Schema.
Do you know how to do this?
I use Biztalk 2009
+1 to what Jay said.
Moreover, You should do the following after step 2:
2.1 Create a new Map that references source schema (external schema) and destination schema (flat file schema created in step 2)
and then you should use this map to transform XML to flat file. This should be done using a send port configured with two things:
pipeline (already mentioned in Jay's response, #3)
Outbound Maps, you can find that in BizTalk Administration console under Send Port properties .. You should configure add the map you created in step 2.1 to the outbound maps.
Typically, you should be receiving the XML file on a receive location. so what you need to do is to create a new receive port, and a receive location. and in the send port properties (again!) add a new filter with the following configuration:
BTS.ReceivePortName == XXXXX
Where XXXXX is the receive port name.
This way, any message is received on receipt port XXXXX is going to be sent to the send port with the map and pipeline already configured.
Create an example flat file that has the formatting you want for your output
Create a flat file schema using the flat file schema wizard. Use your example file as the input to the wizard.
create a pipeline. Put the flat file assembler into the pipeline.
Click on the flat file assembler shape and set the document schema to the flat file schema you created. This tells it the format of the output file.
Create a send port and use the pipeline you created.
Send your data to the send port.

Resources