Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
aspx
ReceiveIdoc operation enables adapter to receive IDOCs having a weakly-typed schema. This operation receives IDOCs as a string in an XML message under the <idocData> tag. On the adapter side, you can specify a value for the ReceiveIDocFormat binding property to specify the format of IDOC the adapter would receive. Typed specifies the adapter will receive IDOCs with strongly-typed schema. This yields an XML IDOC.
String specifies the adapter will receive IDOCs with weakly-typed schema. This yields an XML message with the <idocData> tag. Rfc specifies the adapter will receive IDOCs in any format.
For receiving IDOCs, the SAP adapter also supports a set of message context properties that adapter clients can use in the orchestrations. For the list of properties, see Message Context Properties for Receiving IDOCs. For more information about how the SAP adapter supports receiving IDOCs from an SAP system, see Operations on IDOCs. For more information about the structure of SOAP messages for receiving an IDOC, see Message Schemas for IDOC Operations.
The following table provides key BizTalk scenarios for receiving IDOCs from an SAP system:
Orchestration Design-Time
1.
2. Use the WCF adapters XPath support in the receive port configuratio XML message. For example:
3. /*[local-name()='ReceiveIdoc']/*[local-name()='idocData']
4.
Important This approach can be used to receive IDOCs using the new WCF-based SAP adapt existing BizTalk project written to receive IDOCs from the existing BizTalk SAP ad approach to receive IDOCs with version number less than the release number (SY
Receive XML message with the IDOC represented as a string in the <
5. Configure the BizTalk application by creating physical send and receive ports. This topic provides instructions to perform these tasks.
Generating Schema
You must generate schema for the Receive operation of the ORDERS03.V3.620 IDOC under the /IDOC/ORDERS/ORDERS03 node. See Browsing, Searching, and Retrieving Metadata for IDOC Operations for instructions on how to generate schema for a particular IDOC. While generating the schema, you might want to set the following properties as well: GenerateFlatFileCompatibleIDoc Generates <appinfo> tags so that the BizTalk flat-file parser can be used in BizTalk scenarios to support flat-file IDOCs.
FlatFileSegmentIndicator Indicates if the IDOC schema <appinfo> tags should contain segment definition names or segment type names. This is applicable when a used wishes to send/receive a flat-file IDOC to/from SAP. If the GenerateFlatFileCompatibleIDoc is set to false, then FlatFileSegmentIndicator binding property is ignored.
Important
Because you are generating the schema for an inbound IDOC call, make sure you select Service type drop-down list in the Consume Adapter Service BizTalk Project Add-in.
To create messages and link to schema 1. Add a new orchestration to the BizTalk project. 2. Open the orchestration view the BizTalk project, if not already open. Click View, point to Other Windows, and click Orchestration View. 3. In the Orchestration View, right-click Messages, and then click New Message. 4. Right-click the newly create message and select Properties Window. 5. In the Properties pane for Message_1, do the following:
Use this
Identifier Message Type
To do this
Type Request. From the drop-down list, expand Schemas, and select ReceiveIDOC.SAPBindingSchema2, project.SAPBindingSchema2 is the schema generated for the Receive operation.
6. Repeat step 2 to create a new message. In the Properties pane for the new
message, do the following:
Use this
Identifier Message Type
To do this
Type Response.
Construct Message shape, and within that a Message Assignment shape, to generate a response to be sent to the SAP system.
Note
If the orchestration includes a two-way receive port (request-response) to receive IDOCs fro
response back to the SAP system. If not, the SAP system does not send the next IDOC. How does not have to send a response to the SAP system. A one-way send port to send the IDOCs received from the SAP system to a folder.
A sample orchestration for receiving an IDOC from an SAP system looks like:
Shape
ListenToSAP
Shape Type
Receive
Properties
Set Name to L
Set Activate t
SaveIDOC
Send
Set Name to S
SendResponse
Send
Set Name to S
Important
If the orchestration includes a two-way receive port (request-response) to receive IDOCs from the back to the SAP system. If not, the SAP system does not send the next IDOC. However, if a one-wa send a response to the SAP system. For the construct message shape, set the Message Constructed property to Response. The code to generate the response could be part of the same Visual Studio solution as your BizTalk project. A sample code for generating a response message looks like this.
namespace IdocReceiveResponseMessageCreator { public class IdocReceiveResponseMessageCreator { private static XmlDocument Message; private static string XmlFileLocation; private static string ResponseDoc; public static XmlDocument XMLMessageCreator()
{ XmlFileLocation = "C:\\test\\in"; try { ResponseDoc = (Directory.GetFiles(XmlFileLocation, "*.xml", SearchOption.TopDirectoryOnly))[0]; } catch (Exception ex) { Console.WriteLine("Trying to get XML from: " + XmlFileLocation); Console.WriteLine("EXCEPTION: " + ex.ToString()); throw ex; } //Create Message From XML Message = new XmlDocument(); Message.PreserveWhitespace = true; Message.Load(ResponseDoc); return Message; } } }
Note
After you build the project, IdocReceiveResponseMessageCreator.dll will be created in the project assembly cache (GAC). Add the following expression to invoke this code from the Message Assignment shape and to set the action for the response sent to the SAP system. To add an expression, double-click the Message Assignment shape to open the Expression Editor.
Response = IdocReceiveResponseMessageCreator.IdocReceiveResponseMessageCreator.XMLMessageCr eator(); Response(WCF.Action)= "http://Microsoft.LobServices.Sap/2007/03/Idoc/3/ORDERS03//620/Receive/response";
Important
You must explicitly set the action on the response message. If you do not set the action, WCF-Cus appending Response to the request action. So, the action for the response message becomes http://Microsoft.LobServices.Sap/2007/03/Idoc/3/ORDERS03//620/ReceiveResponse. How appending /response to the request action, for examplehttp://Microsoft.LobServices.Sap/2007
Adding Ports
Make sure you specify the following properties for the logical port. The name listed in the Port column is the name of the port as displayed in the orchestration.
Port
ReceiveIDOCPort
Properties
GetIDOCPort
Set Identifier to GetIDOCPort Set Type to GetIDOCPortType Set Communication Pattern to One-Way Set Communication Direction to Send
Important
If the orchestration includes a two-way receive port (request-response) to receive IDOCs from the back to the SAP system. If not, the SAP system does not send the next IDOC.
1. Right-click the BizTalk project, point to Add, and select New Item.
2. From the dialog box, do the following:
Use this
Categories Visual Studio installed templates Name
Components toolbox, drag the Flat file assembler pipeline component into the Assemble stage of the send pipeline. 4. From the Pipeline Component Properties view, specify a value for the Document Schema property. From the drop-down make sure you select the schema corresponding to the IDOC receive operation.
Shape
ListenToSAP
Properties
SaveIDOC
SendResponse
After you have specified these properties, the message shapes and ports are connected and your orchestration is complete. You must now build the BizTalk solution and deploy it to a BizTalk Server. For more information, see "Building and Running Orchestrations" at http://go.microsoft.com/fwlink/?LinkId=102359.
After you have deployed the BizTalk project, the orchestration you created earlier is listed under the Orchestrations pane in the BizTalk Server Administration console. You must use the BizTalk Server Administration console to configure the application. For more information about configuring an application, see "How to Configure an Application" athttp://go.microsoft.com/fwlink/?LinkId=102360. Configuring an application involves:
Mapping the ports that you created in your orchestration to physical ports in the BizTalk Server Administration console. For this orchestration you must:
Define send locations and physical send port. This location will contain
Important
For the XMLTransmit pipeline, make sure you select SendIDOC. You created this pipe
Define a WCF-Custom receive port. This port will receive an inbound
IDOC from the SAP system and pass it on to the orchestration. This port also sends the response to the SAP system. For information about how to create WCF-Custom ports, see Manually Configuring a Physical Port Binding to the SAP Adapter.
Important
Make sure the binding property ReceiveIDocFormat is set to Typed.
Important
If the binding property EnableBizTalkCompatibilityMode is set to true, make sure adapter as a resource in your BizTalk application, that is, the application in which you resources see Troubleshooting Operational Issues.
Note
Generating the schema using the Consume Adapter Service BizTalk Project Add-in als the ports and the actions to be set for those ports. You can import this binding file fro ports (for outbound calls) or receive ports (for inbound calls). For more information, se Binding File.
You must also add the assembly for the IdocReceiveResponseMessageCreator project to your BizTalk application. You created this project to generate the response to be sent to the SAP system. To do so: 1. In the console tree on the left side of the BizTalk Server Administration console, under the BizTalk application where you imported the bindings, right-click Resources, point to Add and then click BizTalk Assemblies. 2. In the Add Resources dialog box, Click Add and navigate to the folder containing IdocReceiveResponseMessageCreator.dll. Select the file and then click Open. 3. In the Add Resources dialog box, click OK.
The WCF-Custom receive port to receive IDOCs from the SAP system is running. The BizTalk orchestration for the operation is running.
Possible Exceptions
For information about the exceptions you might encounter while receiving an IDOC from an SAP system using BizTalk Server, see Exceptions and Error Handling.
Best Practices
After you have deployed and configured the BizTalk project, you can export configuration settings to an XML file called the bindings file. Once you generate a bindings file, you can import the configuration settings from the file so that you do not need to create the send ports, receive ports, etc. for the same orchestration. For more information about binding files, see Reusing Adapter Bindings.