by community-syndication | Nov 11, 2010 | BizTalk Community Blogs via Syndication
On Tuesday, November 9th, Krish Mandal, Eric Fitchett, Paul Hurlock and I attended an event in New York called HTML5 Live. My intentions going into this were to get a better understanding of HTML5, where it is now, and where it’s going.
I actually got more out of the conference than I had anticipated. I was […]
by community-syndication | Nov 11, 2010 | BizTalk Community Blogs via Syndication
Some of customers who have migrated for the old Sap Adapter (BizTalk Adapter 2.0 for mySAP Business Suite) to WCF-SAP adapter (comes with BizTalk Adapter Pack), have come back saying that there are some differences in behavior of the old SAP adapter and WCF-SAP adapter, which can break their scenarios.
Following differences are the most talked about –
- The old version of the adapter accepted RFC messages with a date field is empty. In the new version, the same call results in an error. This is because WCF-SAP adapter doesn’t allow blank XML nodes.
- Unlike the old version, the new version does not accept ‘,’ (comma) as decimal separator for fields of type DECIMAL. It mandates that ‘.'(Period) should be used as decimal separator.
- WCF-SAP adapter doesn’t return back tables exposed as CHANGING parameter, if the corresponding request message doesn’t contain the table. You can refer to the post – “When I Execute BAPIs, I don’t get back any data”. Help!” for the details.
All these three behaviors are correct from a design perspective , justification follows –
- Any XML node, if present should confirm to the data-type restrictions, or should have xsi:nil=”true”.
- w3.org XML specification mandates a period(.) should be used as decimal separator.
- This is an optimization in the WCF-SAP adapter to decrease the data transfer over-head.
—–
That said, many customers who are migrating from the Old SAP adapter do face these issues.
I have written a custom pipeline component that can help resolve these three issues.
The pipeline has three configuration properties, which can be used to tailor the behavior as per requirements –
|
Issue
|
Property Name
|
Description
|
Default Value
|
|
WCF-SAP adapter doesn’t allow blank XML nodes, if the min-length is more than zero.
(fields like DateTime )
|
RemoveEmptyDataNodesInRequest
(bool)
|
When true, all empty leaf level node will be removed from the request message.
|
false
|
|
WCF-SAP adapter doesn’t allow ‘,’ as decimal separator
|
CultureInfoForDecimal
(string)
Eg: en-US, es-ES
|
Culture code for the CultureInfo to use for parsing decimal fields.
When a valid culture code is specified, it will use the given Culture Info for parsing the xs:decimal, xs:float , xs:double fields and convert it to culture-invariant string representation(expected by the WCF-SAP adapter ).
Vice-versa for response.
|
null
|
|
WCF-SAP adapter doesn’t return back tables exposed as CHANGING parameter, if the corresponding request message doesn’t contain the table.
On the other hand, it returns a blank table node even if there is no data in the table, if the table is present in request message.
|
FetchAllTables
(bool)
|
When true, will add empty nodes for all tables which don’t exist in request message.
It will also remove empty table nodes from response message to get a response similar to the old adapter.
|
false
|
The outcome –
- RemoveEmptyDataNodesInRequest (true) – You don’t need to worry about removing empty XML tags from the input message, for fields like DateTime.
- CultureInfoForDecimal(es-ES) – If the incoming message is using ‘,'(comma) as decimal separator, the message will be sent to the WCF-SAP adapter successfully. Also, in the response message, you will have ‘,'(comma) as decimal separator.
- FetchAllTables(true) – When this property is set to true, all the tables will be fetched in the response message, irrespective of whether a corresponding node is present in the request message.
How to set the properties on the pipeline component –
- While building the pipeline from this pipeline component (inside the pipeline editor in Visual Studio ), you can specify any valid culture-code , for CultureInfoForDecimal. This will become the default value for the pipeline.
Eg- You can use ‘en-US’ if you want ‘.’ as decimal separator.
‘es-ES’ if you want ‘,’ as decimal separator.
- Whenever you use the pipeline for any port (send/receive), the value you gave in step 1 will show as the default value.
- You can customize the value for a specific send port by opening the pipeline properties and specifying the desired value there.
Same applies for the other two properties.
Steps for using the pipeline component-
- Build the project, or use the pre-built SapBackCompatPipelineComponent.dll.
- Drop it here: <BizTalk Server installation folder>\Pipeline Components
- Create a new BizTalk project in Visual Studio.
- Pipeline Designer inside Visual Studio: toolbox -> choose items -> BizTalkPipeline components -> select your component -> ok.
- Drop your pipeline component in encode stage. Set the default values for pipeline properties.
- Build and deploy the BizTalk project.
- On the WCF-SAP send port select your pipeline.
- If you click the ellipses (…) button next to the pipelines selection drop-down, you will see a window where you can edit the properties for the specific instance of the pipeline.
Note:
- You don’t need to GAC any of the dlls.
- For this pipeline to behave correctly the instance xml should validate against the schema.
(It doesn’t log any error if validation fails.)
So, it’s recommended that you use this pipeline component in conjunction with “XML Validator” component.
- If you are using the pipeline component for making the old adapter installation work with the WCF-SAP adapter and are facing problems (1) and (2) mentioned in this blog, you can drop this pipeline component in a stage after that component in the pipeline designer.
However, you will need to generate the schemas for the new adapter, as this pipeline expects the new schemas to be present.
The source-code of the component is atttached, so you can modify the code(if need be) to tailor it to your requirements.
Rohit Singh
by community-syndication | Nov 10, 2010 | BizTalk Community Blogs via Syndication
Here is a Web2PDF online Service which enables you to browse the entire web from your Inbox. All you need is a valid email ID.
read more
by community-syndication | Nov 10, 2010 | BizTalk Community Blogs via Syndication
Handling Service Exceptions on WCF Clients
A WCF client must expect various types of exception when calling services
read more
by community-syndication | Nov 10, 2010 | BizTalk Community Blogs via Syndication
When an unexpected exception occurs, the WCF runtime generates a FaultException and sends it to the client.
read more
by community-syndication | Nov 10, 2010 | BizTalk Community Blogs via Syndication
It is good practice to add an outer try block to all of your service operations; the try block should encompass all of the code that is inside those operations.
read more
by community-syndication | Nov 10, 2010 | BizTalk Community Blogs via Syndication
Typed faults enable you to define custom data types to represent specific errors that occur in your WCF service.
read more
by community-syndication | Nov 10, 2010 | BizTalk Community Blogs via Syndication
It is important that your service handles errors so that it can continue to execute if an error occurs. There are three main categories of errors that your service should handle.
read more
by community-syndication | Nov 10, 2010 | BizTalk Community Blogs via Syndication
If a service operation has a fault contract defined for it, the fault definitions form part of the service metadata from which you can generate client-side artifacts. As an example, consider the following fault contract.
read more
by community-syndication | Nov 10, 2010 | BizTalk Community Blogs via Syndication
A SOAP fault is an XML representation of error information that is generated when a SOAP call fails. A SOAP fault contains several elements that you can use when defining your strategy for the transmission of error information:
read more