I recently built a POC that wrapped an SAP RFC call in a WCF Service exposed by BizTalk. I exposed schemas as WCF services instead of opting for exposing the Orchestration as a WCF Service. The purpose of the Service was to validate a utility meter’s status inside of SAP. Some of the statuses may include active/inactive/meter not found. The RFC that I used is called RFC_Read_Table. This is a pretty generic, out of box, RFC that allows you to query SAP tables. The RFC is fairly complex due to a lack of good documentation available. Perhaps I am just not part of the secret SAP consultant’s club where you can actually get useful documentation. I plan on documenting my findings in an upcoming post so that other people do not have to endure the pain I went through in order to get it working.
One of the benefits of InfoPath is the ability to consume a web service (asmx). I was pleasantly surprised that InfoPath can also consume some WCF endpoints(.svc). The endpoint type that I exposed was based on the basicHttpbinding which happens to be one of the more interoperable bindings. At this point, the SOAP adapter has been identified as an Adapter that will be removed in an upcoming release of BizTalk. The idea behind this is that people should be moving to the WCF adapter. There are some gaps between the SOAP and WCF adapter, which is outside the scope of this post, but my advice would be if you can use the WCF Adapter then you should. If you cannot, due to a limitation, then you should provide this feedback to Microsoft so they can either enhance the WCF adapter or hold off on removing the SOAP adapter.
The InfoPath service consumption wizard is fairly straight forward with the exception of “how the form works with the Web Service”. The 3 options that you do have include:
- Receive and submit data
- Submit data
- Receive data
When I think of a client consuming a Web Service, I think in terms of the client providing a Request message and the Server providing a Response. With this in mind, I decided to use the “Submit data” option. What I ran into is that I could submit data to my BizTalk Service, BizTalk would process the request and provide a response but nothing was being updated in my form. I discovered that I needed to use the “Receive and submit data” option instead. The description is counter intuitive as it implies I am receiving data first then I am submitting it. Perhaps if Microsoft would have called this option “Submit and receive data” this would have been a little clearer.
I have recently been teased by a few colleagues and friends about the amount of detail and screen shots that I have put in my blog posts. At the risk of more torture, here is a step by step guide of how I got this all working.
- Design a Form Template
- Select “Web Service'” and click OK
- If you want to submit data to a service and use the response data in your form, select “Receive and submit data'”
- Provide the destination of your WSDL and click “Next”
- The name of my operation is “ValidateMeter”, click “Next”
- Thus far, the information that has been provided is related to the Web Service response so I have provided a name for this data connection that reflects this.
- Since I am submitting data to this same service, I need to provide the WSDL URL again.
- Once again I need to provide the operation that I will be communicating with.
- The “ValidateMeter” operation has a single input parameter. I need to specify which field from the request schema will be sent to the Web Service. To do this I want to click on the following button:
- Select the field from Schema
- Click “Next” to proceed
- I now need to provide a name for this data connection
- At this point I have a blank canvas and I also have the ability to start dragging and dropping fields from my Web Service Request and Response schemas onto the canvas.
- I have expanded, the “queryFields” node and have dragged the “MeterNumber” element onto the canvas. If you recall the value that will be populated in this field will be sent as part of the Request message to the ValidateMeter Service.
- When BizTalk provides the response from SAP, I want to display this value on the form. In order to do this, I need to expand the “dataFields” node and select “MeterStatus” from the Web Service Response schema.
- To test my form, I can click on the “Preview” button
- I can now provide a Meter Number and click the “Run Query” button. Within a couple seconds I will see my Meter Status text get populated. In this particular instance, the Meter Number 123456 does not exist so the Meter Status text box is updated to reflects this.
4 comments:
Kent,
Well explained..thanks for the detailed post..
Thanks for the feedback Mahesh
Create post Kent ... any chance you'll be posting your experience with RFC_READ_TABLE anytime soon? :)
I'd really like to use this in a project I'm working on and would surely benefit from some guidance on how to properly use this RFC.
Cheers.
Mike
Hi Mike,
I will try to get the RFC_READ_TABLE post going this weekend.
There are a lot of other topics in my head as well and I have been having trouble finding the time to fit them in lately.
Kent
Post a Comment